# HG changeset patch # User Pat Downey # Date 1283340198 -3600 # Node ID 0e9bb658ef58e5a0ed8193f2aebaec43b4089c37 # Parent 4ea6f81c838a6ff86b6200b539da7b1937f85464 Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035 diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/bwins/alfwidgetutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/bwins/alfwidgetutilsu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +EXPORTS + ??0AlfAttributeException@osncore@@QAE@H@Z @ 1 NONAME ; osncore::AlfAttributeException::AlfAttributeException(int) + ??0AlfAttributeException@osncore@@QAE@HPBD0@Z @ 2 NONAME ; osncore::AlfAttributeException::AlfAttributeException(int, char const *, char const *) + ??0AlfDataException@osncore@@QAE@H@Z @ 3 NONAME ; osncore::AlfDataException::AlfDataException(int) + ??0AlfDataException@osncore@@QAE@HPBD0@Z @ 4 NONAME ; osncore::AlfDataException::AlfDataException(int, char const *, char const *) + ??0AlfElementException@osncore@@QAE@H@Z @ 5 NONAME ; osncore::AlfElementException::AlfElementException(int) + ??0AlfElementException@osncore@@QAE@HPBD0@Z @ 6 NONAME ; osncore::AlfElementException::AlfElementException(int, char const *, char const *) + ??0AlfException@osncore@@QAE@H@Z @ 7 NONAME ; osncore::AlfException::AlfException(int) + ??0AlfException@osncore@@QAE@HPBD0@Z @ 8 NONAME ; osncore::AlfException::AlfException(int, char const *, char const *) + ??0AlfException@osncore@@QAE@HPBD@Z @ 9 NONAME ; osncore::AlfException::AlfException(int, char const *) + ??0AlfFactoryPluginLoader@Alf@@QAE@XZ @ 10 NONAME ; Alf::AlfFactoryPluginLoader::AlfFactoryPluginLoader(void) + ??0AlfVisualException@osncore@@QAE@H@Z @ 11 NONAME ; osncore::AlfVisualException::AlfVisualException(int) + ??0AlfVisualException@osncore@@QAE@HPBD0@Z @ 12 NONAME ; osncore::AlfVisualException::AlfVisualException(int, char const *, char const *) + ??0AlfWidgetException@osncore@@QAE@H@Z @ 13 NONAME ; osncore::AlfWidgetException::AlfWidgetException(int) + ??0AlfWidgetException@osncore@@QAE@HPBD0@Z @ 14 NONAME ; osncore::AlfWidgetException::AlfWidgetException(int, char const *, char const *) + ??0AlfWidgetFactoryLoader@Alf@@QAE@XZ @ 15 NONAME ; Alf::AlfWidgetFactoryLoader::AlfWidgetFactoryLoader(void) + ??1AlfAttributeException@osncore@@UAE@XZ @ 16 NONAME ; osncore::AlfAttributeException::~AlfAttributeException(void) + ??1AlfDataException@osncore@@UAE@XZ @ 17 NONAME ; osncore::AlfDataException::~AlfDataException(void) + ??1AlfElementException@osncore@@UAE@XZ @ 18 NONAME ; osncore::AlfElementException::~AlfElementException(void) + ??1AlfException@osncore@@UAE@XZ @ 19 NONAME ; osncore::AlfException::~AlfException(void) + ??1AlfFactoryPluginLoader@Alf@@UAE@XZ @ 20 NONAME ; Alf::AlfFactoryPluginLoader::~AlfFactoryPluginLoader(void) + ??1AlfVisualException@osncore@@UAE@XZ @ 21 NONAME ; osncore::AlfVisualException::~AlfVisualException(void) + ??1AlfWidgetException@osncore@@UAE@XZ @ 22 NONAME ; osncore::AlfWidgetException::~AlfWidgetException(void) + ??1AlfWidgetFactoryLoader@Alf@@UAE@XZ @ 23 NONAME ; Alf::AlfWidgetFactoryLoader::~AlfWidgetFactoryLoader(void) + ?errorCode@AlfException@osncore@@UBEHXZ @ 24 NONAME ; int osncore::AlfException::errorCode(void) const + ?fileAndLine@AlfException@osncore@@QBEPBDXZ @ 25 NONAME ; char const * osncore::AlfException::fileAndLine(void) const + ?info@AlfException@osncore@@UBEPBDXZ @ 26 NONAME ; char const * osncore::AlfException::info(void) const + ?loadFactoryPlugin@AlfFactoryPluginLoader@Alf@@QAEPAVIAlfFactoryPlugin@2@PBD@Z @ 27 NONAME ; class Alf::IAlfFactoryPlugin * Alf::AlfFactoryPluginLoader::loadFactoryPlugin(char const *) + ?loadWidgetFactory@AlfWidgetFactoryLoader@Alf@@QAEPAVIAlfWidgetFactory@2@AAVCAlfEnv@@@Z @ 28 NONAME ; class Alf::IAlfWidgetFactory * Alf::AlfWidgetFactoryLoader::loadWidgetFactory(class CAlfEnv &) + ?what@AlfAttributeException@osncore@@UBEPBDXZ @ 29 NONAME ; char const * osncore::AlfAttributeException::what(void) const + ?what@AlfDataException@osncore@@UBEPBDXZ @ 30 NONAME ; char const * osncore::AlfDataException::what(void) const + ?what@AlfElementException@osncore@@UBEPBDXZ @ 31 NONAME ; char const * osncore::AlfElementException::what(void) const + ?what@AlfException@osncore@@UBEPBDXZ @ 32 NONAME ; char const * osncore::AlfException::what(void) const + ?what@AlfVisualException@osncore@@UBEPBDXZ @ 33 NONAME ; char const * osncore::AlfVisualException::what(void) const + ?what@AlfWidgetException@osncore@@UBEPBDXZ @ 34 NONAME ; char const * osncore::AlfWidgetException::what(void) const + diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/eabi/alfwidgetutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/eabi/alfwidgetutilsu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +EXPORTS + _ZN3Alf22AlfFactoryPluginLoader17loadFactoryPluginEPKc @ 1 NONAME + _ZN3Alf22AlfFactoryPluginLoaderC1Ev @ 2 NONAME + _ZN3Alf22AlfFactoryPluginLoaderC2Ev @ 3 NONAME + _ZN3Alf22AlfFactoryPluginLoaderD0Ev @ 4 NONAME + _ZN3Alf22AlfFactoryPluginLoaderD1Ev @ 5 NONAME + _ZN3Alf22AlfFactoryPluginLoaderD2Ev @ 6 NONAME + _ZN3Alf22AlfWidgetFactoryLoader17loadWidgetFactoryER7CAlfEnv @ 7 NONAME + _ZN3Alf22AlfWidgetFactoryLoaderC1Ev @ 8 NONAME + _ZN3Alf22AlfWidgetFactoryLoaderC2Ev @ 9 NONAME + _ZN3Alf22AlfWidgetFactoryLoaderD0Ev @ 10 NONAME + _ZN3Alf22AlfWidgetFactoryLoaderD1Ev @ 11 NONAME + _ZN3Alf22AlfWidgetFactoryLoaderD2Ev @ 12 NONAME + _ZN7osncore12AlfExceptionC1Ei @ 13 NONAME + _ZN7osncore12AlfExceptionC1EiPKc @ 14 NONAME + _ZN7osncore12AlfExceptionC1EiPKcS2_ @ 15 NONAME + _ZN7osncore12AlfExceptionC2Ei @ 16 NONAME + _ZN7osncore12AlfExceptionC2EiPKc @ 17 NONAME + _ZN7osncore12AlfExceptionC2EiPKcS2_ @ 18 NONAME + _ZN7osncore12AlfExceptionD0Ev @ 19 NONAME + _ZN7osncore12AlfExceptionD1Ev @ 20 NONAME + _ZN7osncore12AlfExceptionD2Ev @ 21 NONAME + _ZN7osncore16AlfDataExceptionC1Ei @ 22 NONAME + _ZN7osncore16AlfDataExceptionC1EiPKcS2_ @ 23 NONAME + _ZN7osncore16AlfDataExceptionC2Ei @ 24 NONAME + _ZN7osncore16AlfDataExceptionC2EiPKcS2_ @ 25 NONAME + _ZN7osncore16AlfDataExceptionD0Ev @ 26 NONAME + _ZN7osncore16AlfDataExceptionD1Ev @ 27 NONAME + _ZN7osncore16AlfDataExceptionD2Ev @ 28 NONAME + _ZN7osncore18AlfVisualExceptionC1Ei @ 29 NONAME + _ZN7osncore18AlfVisualExceptionC1EiPKcS2_ @ 30 NONAME + _ZN7osncore18AlfVisualExceptionC2Ei @ 31 NONAME + _ZN7osncore18AlfVisualExceptionC2EiPKcS2_ @ 32 NONAME + _ZN7osncore18AlfVisualExceptionD0Ev @ 33 NONAME + _ZN7osncore18AlfVisualExceptionD1Ev @ 34 NONAME + _ZN7osncore18AlfVisualExceptionD2Ev @ 35 NONAME + _ZN7osncore18AlfWidgetExceptionC1Ei @ 36 NONAME + _ZN7osncore18AlfWidgetExceptionC1EiPKcS2_ @ 37 NONAME + _ZN7osncore18AlfWidgetExceptionC2Ei @ 38 NONAME + _ZN7osncore18AlfWidgetExceptionC2EiPKcS2_ @ 39 NONAME + _ZN7osncore18AlfWidgetExceptionD0Ev @ 40 NONAME + _ZN7osncore18AlfWidgetExceptionD1Ev @ 41 NONAME + _ZN7osncore18AlfWidgetExceptionD2Ev @ 42 NONAME + _ZN7osncore19AlfElementExceptionC1Ei @ 43 NONAME + _ZN7osncore19AlfElementExceptionC1EiPKcS2_ @ 44 NONAME + _ZN7osncore19AlfElementExceptionC2Ei @ 45 NONAME + _ZN7osncore19AlfElementExceptionC2EiPKcS2_ @ 46 NONAME + _ZN7osncore19AlfElementExceptionD0Ev @ 47 NONAME + _ZN7osncore19AlfElementExceptionD1Ev @ 48 NONAME + _ZN7osncore19AlfElementExceptionD2Ev @ 49 NONAME + _ZN7osncore21AlfAttributeExceptionC1Ei @ 50 NONAME + _ZN7osncore21AlfAttributeExceptionC1EiPKcS2_ @ 51 NONAME + _ZN7osncore21AlfAttributeExceptionC2Ei @ 52 NONAME + _ZN7osncore21AlfAttributeExceptionC2EiPKcS2_ @ 53 NONAME + _ZN7osncore21AlfAttributeExceptionD0Ev @ 54 NONAME + _ZN7osncore21AlfAttributeExceptionD1Ev @ 55 NONAME + _ZN7osncore21AlfAttributeExceptionD2Ev @ 56 NONAME + _ZNK7osncore12AlfException11fileAndLineEv @ 57 NONAME + _ZNK7osncore12AlfException4infoEv @ 58 NONAME + _ZNK7osncore12AlfException4whatEv @ 59 NONAME + _ZNK7osncore12AlfException9errorCodeEv @ 60 NONAME + _ZNK7osncore16AlfDataException4whatEv @ 61 NONAME + _ZNK7osncore18AlfVisualException4whatEv @ 62 NONAME + _ZNK7osncore18AlfWidgetException4whatEv @ 63 NONAME + _ZNK7osncore19AlfElementException4whatEv @ 64 NONAME + _ZNK7osncore21AlfAttributeException4whatEv @ 65 NONAME + _ZTIN3Alf22AlfFactoryPluginLoaderE @ 66 NONAME ; ## + _ZTIN3Alf22AlfWidgetFactoryLoaderE @ 67 NONAME ; ## + _ZTIN3Alf26AlfFactoryPluginLoaderImplE @ 68 NONAME ; ## + _ZTIN3Alf26AlfWidgetFactoryLoaderImplE @ 69 NONAME ; ## + _ZTIN7osncore12AlfExceptionE @ 70 NONAME ; ## + _ZTIN7osncore16AlfDataExceptionE @ 71 NONAME ; ## + _ZTIN7osncore18AlfVisualExceptionE @ 72 NONAME ; ## + _ZTIN7osncore18AlfWidgetExceptionE @ 73 NONAME ; ## + _ZTIN7osncore19AlfElementExceptionE @ 74 NONAME ; ## + _ZTIN7osncore21AlfAttributeExceptionE @ 75 NONAME ; ## + _ZTVN3Alf22AlfFactoryPluginLoaderE @ 76 NONAME ; ## + _ZTVN3Alf22AlfWidgetFactoryLoaderE @ 77 NONAME ; ## + _ZTVN3Alf26AlfFactoryPluginLoaderImplE @ 78 NONAME ; ## + _ZTVN3Alf26AlfWidgetFactoryLoaderImplE @ 79 NONAME ; ## + _ZTVN7osncore12AlfExceptionE @ 80 NONAME ; ## + _ZTVN7osncore16AlfDataExceptionE @ 81 NONAME ; ## + _ZTVN7osncore18AlfVisualExceptionE @ 82 NONAME ; ## + _ZTVN7osncore18AlfWidgetExceptionE @ 83 NONAME ; ## + _ZTVN7osncore19AlfElementExceptionE @ 84 NONAME ; ## + _ZTVN7osncore21AlfAttributeExceptionE @ 85 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/group/alfwidgetutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/group/alfwidgetutils.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007 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: mmp file +* +*/ + +#include + +TARGET alfwidgetutils.dll +TARGETTYPE DLL + + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + + +SOURCEPATH ../src + +SOURCE alffactorypluginloader.cpp +SOURCE alffactorypluginloaderimpl.cpp +SOURCE alfwidgetfactoryloader.cpp +SOURCE alfwidgetfactoryloaderimpl.cpp + +SOURCE alfexception.cpp +SOURCE alfattributeexception.cpp +SOURCE alfvisualexception.cpp +SOURCE alfelementexception.cpp +SOURCE alfdataexception.cpp +SOURCE alfwidgetexception.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + + +MW_LAYER_SYSTEMINCLUDE + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY osncore.lib +LIBRARY libstdcpp.lib + +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + +LIBRARY libpthread.lib +LIBRARY libc.lib +LANG SC +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007 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: Builds alfwidgetutils. +* +*/ + + +#include + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES +alfwidgetutils.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + + +// End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/inc/alfexceptionstrings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/inc/alfexceptionstrings.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 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: error codes and descrptions for erros +* +*/ + + + +#ifndef ALFEXCEPTIONSTRINGS_H +#define ALFEXCEPTIONSTRINGS_H + +namespace osncore + { +static const char* const KErrorUndefinedException + = "Undefined Exception"; +static const char* const KErrorInvalidAttribute + = "Invalid Attribute"; +static const char* const KErrorInvalidAttributeValue + = "Invalid Attribute Value"; +static const char* const KErrorIncompleteAttributeValues + = "Incomplete Attribute Values"; +static const char* const KErrorInvalidVisual + = "Invalid Visual"; +static const char* const KErrorCanNotCreateVisual + = "Can Not Create Visual"; +static const char* const KErrorInvalidVisualValue + = "Invalid Visual Value"; +static const char* const KErrorInvalidElement + = "Invalid Element"; + +//Data Type Exception Strings +static const char* const KErrorInvalidVariantDataType + = "Invalid Variant Data Type"; +static const char* const KErrorInvalidArrayIndex + = "Invalid Array Index"; +static const char* const KErrorInvalidContainerOperation + = "Invalid Conatiner Operation"; +static const char* const KErrorInvalidMapOperation + = "Invalid Map Operation"; +static const char* const KErrorInvalidBranchOperation + = "Invalid Branch Operation"; +static const char* const KErrorInvalidModelOperation + = "Invalid Model Operation"; +static const char* const KErrorInvalidWidget + = "Invalid Widget"; + + } //namespace + +#endif //ALFEXCEPTIONSTRINGS_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/inc/alffactorypluginloaderimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/inc/alffactorypluginloaderimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 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: Factory plugin loader implementation +* +*/ + + + +#ifndef ALFFACTORYPLUGINLOADERIMPL_H +#define ALFFACTORYPLUGINLOADERIMPL_H + +#include + +using namespace osncore; + +namespace Alf + { + +class IAlfFactoryPlugin; +class AlfFactoryPluginMap; + + +/** + * @class AlfFactoryPluginLoaderImpl AlfFactoryPluginLoaderImpl.h "alf/alffactorypluginloaderimpl.h" + * + * Factory plugin loader loads factory plugins. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfFactoryPluginLoaderImpl + { +public: // Constructors and destructor + + /** + * Constructor + */ + AlfFactoryPluginLoaderImpl(); + + /** + * Destructor. + */ + virtual ~AlfFactoryPluginLoaderImpl(); + +public: + + /** + * Load a factory plugin. + * + * @param aLoadId Factory plugin identifier + * @since S60 5.0 + * @return Pointer to IAlfFactoryPlugin or NULL. + * Ownership is transferred to caller. + */ + IAlfFactoryPlugin* load(const char* aLoadId); + +private: + /** + * Owned factory plugins. + */ + AlfPtrVector mFactoryPluginList; + + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/inc/alfwidgetfactoryloaderimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/inc/alfwidgetfactoryloaderimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2007 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: Widget factory plugin loader implementation +* +*/ + + + +#ifndef ALFWIDGETFACTORYLOADERIMPL_H +#define ALFWIDGETFACTORYLOADERIMPL_H + + + +class CAlfEnv; + +namespace Alf + { +class IAlfFactoryPlugin; +class IAlfWidgetFactory; + + +/** + * + * @class AlfWidgetFactoryLoaderImpl AlfWidgetFactoryLoaderImpl.h "alf/alfwidgetfactoryloaderimpl.h" + * + * Factory plugin loader loads factory plugins. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfWidgetFactoryLoaderImpl + { +public: // Constructors and destructor + + /** + * Constructor + */ + AlfWidgetFactoryLoaderImpl(); + + /** + * Destructor. + */ + virtual ~AlfWidgetFactoryLoaderImpl(); + +public: + + /** + * Loads a widget factory plugin. + * + * @since S60 5.0 + * @return Pointer to IAlfWidgetFactory or NULL. + * Ownership is not transferred to caller. + */ + IAlfWidgetFactory* load(CAlfEnv& aEnv); + +private: + IAlfFactoryPlugin* mFactoryPlugin; + IAlfWidgetFactory* mWidgetFactory; + int mDtorKey; + + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfattributeexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfattributeexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2007 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: The implementation for attribute exception class. +* +*/ + + + +#include +#include "alfexceptionstrings.h" + +using namespace osncore; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeException::AlfAttributeException( int aErrorCode ) throw() : + AlfException( aErrorCode ) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeException::AlfAttributeException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() : + AlfException( aErrorCode, aInfo, aFileAndLine ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeException::~AlfAttributeException() throw() + { +// nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfAttributeException::what() const throw() + { + switch ( errorCode() ) + { + case EInvalidAttribute: + return KErrorInvalidAttribute; + case EInvalidAttributeValue: + return KErrorInvalidAttributeValue; + case EIncompleteAttributeValues: + return KErrorIncompleteAttributeValues; + default: + return KErrorUndefinedException; + } + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfdataexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfdataexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2007 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: element exception class. +* +*/ + + + +#include +#include "alfexceptionstrings.h" + +using namespace osncore; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfDataException::AlfDataException( int aErrorCode ) throw() : + AlfException( aErrorCode ) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfDataException::AlfDataException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() : + AlfException( aErrorCode, aInfo, aFileAndLine ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfDataException::~AlfDataException() throw() + { +// nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfDataException::what() const throw() + { + switch ( errorCode() ) + { + case EInvalidVariantDataType: + return KErrorInvalidVariantDataType; + + case EInvalidArrayIndex: + return KErrorInvalidArrayIndex; + + case EInvalidContainerOperation: + return KErrorInvalidContainerOperation; + + case EInvalidMapOperation: + return KErrorInvalidMapOperation; + + case EInvalidBranchOperation: + return KErrorInvalidBranchOperation; + + case EInvalidModelOperation: + return KErrorInvalidModelOperation; + + default: + return KErrorUndefinedException; + } + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfelementexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfelementexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 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: element exception class. +* +*/ + + + +#include +#include "alfexceptionstrings.h" + +using namespace osncore; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfElementException::AlfElementException( int aErrorCode ) throw() : + AlfException( aErrorCode ) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfElementException::AlfElementException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() : + AlfException( aErrorCode, aInfo, aFileAndLine ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfElementException::~AlfElementException() throw() + { +// nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfElementException::what() const throw() + { + switch ( errorCode() ) + { + case EInvalidElement: + return KErrorInvalidElement; + default: + return KErrorUndefinedException; + } + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2007 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: The basic implementation for presentation elements. +* +*/ + + + +#include + +using namespace std; +using namespace osncore; + + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfException::AlfException( const int aErrorCode ) throw() + { + mErrorCode = aErrorCode; + mInfo = 0; + mFileAndLine = 0; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfException::AlfException( + int aErrorCode, const char* aInfo ) throw() + { + mErrorCode = aErrorCode; + mInfo = aInfo; + mFileAndLine = 0; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfException::AlfException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() + { + mErrorCode = aErrorCode; + mInfo = aInfo; + mFileAndLine = aFileAndLine; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfException::~AlfException() throw() + { + // nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfException::what() const throw() + { + return ""; + } + +// --------------------------------------------------------------------------- +// Returns the error information in integer type +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfException::errorCode() const throw() + { + return mErrorCode; + } + +// --------------------------------------------------------------------------- +// Returns the error information in integer type +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfException::info() const throw() + { + if ( mInfo ) + { + return mInfo; + } + return ""; + } + +// --------------------------------------------------------------------------- +// Returns the file and line information +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfException::fileAndLine() const throw() + { + if ( mFileAndLine ) + { + return mFileAndLine; + } + return ""; + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alffactorypluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alffactorypluginloader.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007 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: Encapsulates factory plugin loading mechanism +* +*/ + +#include +#include +#include "alffactorypluginloaderimpl.h" + +namespace Alf + { + + +OSN_EXPORT AlfFactoryPluginLoader::AlfFactoryPluginLoader(): + mImpl(new (EMM)AlfFactoryPluginLoaderImpl()) + { + + } + +OSN_EXPORT AlfFactoryPluginLoader::~AlfFactoryPluginLoader() + { + + } + +OSN_EXPORT IAlfFactoryPlugin* AlfFactoryPluginLoader::loadFactoryPlugin( + const char* aLoadId) + { + return mImpl->load(aLoadId); + } + + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alffactorypluginloaderimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alffactorypluginloaderimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2007 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: Encapsulates factory plugin loading mechanism +* +*/ + + + +#include +//#include +#include +#include +#include +#include +#include + +#include "alf/alfecompluginfactoryuid.rh" +#include "alffactorypluginloaderimpl.h" + +using namespace std; + +namespace Alf + { + + + +class AlfFactoryPluginMap + { +public: + AlfFactoryPluginMap(); + ~AlfFactoryPluginMap(); + + /** + * Owned factory plugin. + */ + IAlfFactoryPlugin* mFactoryPlugin; + /** + * ECom destructor handle. + */ + int mDtorKey; + }; + +static bool loadPluginIntoMap( + AlfFactoryPluginMap*& aMap, + const char* aProduct) + { + TEComResolverParams resolverParams; + resolverParams.SetDataType(TPtrC8((TUint8*)aProduct)); + resolverParams.SetWildcardMatch(ETrue); + + TAny* plugin = NULL; + TUid tmpDtor; + + TRAPD(err,plugin = REComSession::CreateImplementationL( + TUid::Uid(KFactoryPluginUid), + tmpDtor,resolverParams)) + + + if (!err) + { + aMap->mDtorKey = tmpDtor.iUid; + aMap->mFactoryPlugin = reinterpret_cast( + plugin); + return true; + } + + return false; + } + +AlfFactoryPluginMap::AlfFactoryPluginMap() + :mFactoryPlugin(0),mDtorKey(0) + { + + } + +AlfFactoryPluginMap::~AlfFactoryPluginMap() + { + if (mFactoryPlugin) + { + REComSession::DestroyedImplementation(TUid::Uid(mDtorKey)); + delete mFactoryPlugin; + } + } + +AlfFactoryPluginLoaderImpl::AlfFactoryPluginLoaderImpl() + { + + } + +AlfFactoryPluginLoaderImpl::~AlfFactoryPluginLoaderImpl() + { + mFactoryPluginList.clear(); + + } + +IAlfFactoryPlugin* AlfFactoryPluginLoaderImpl::load( + const char* aLoadId) + { + IAlfFactoryPlugin* ret(0); + IAlfFactoryPlugin* tmp(0); + // Do we have it already? + unsigned int itemCount(mFactoryPluginList.count()); + + for (int i=0;imFactoryPlugin; + int productCount = tmp->productCount(); + for (int j=0;jproductInfo(j),aLoadId )) + { + ret = tmp; + } + } + } + if (!ret) + { + auto_ptr mapPtr(new(EMM)AlfFactoryPluginMap()); + AlfFactoryPluginMap* map = mapPtr.get(); + + if (loadPluginIntoMap(map,aLoadId)) + { + ret = mapPtr->mFactoryPlugin; + mFactoryPluginList.resize(itemCount+1); + mFactoryPluginList.insert(itemCount,map); + + mapPtr.release(); + + } + + } + + return ret; + + } + + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfvisualexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfvisualexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + + + +#include +#include "alfexceptionstrings.h" + +using namespace osncore; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVisualException::AlfVisualException( int aErrorCode ) throw() : + AlfException( aErrorCode ) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVisualException::AlfVisualException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() : + AlfException( aErrorCode, aInfo, aFileAndLine ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVisualException::~AlfVisualException() throw() + { +// nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfVisualException::what() const throw() + { + switch ( errorCode() ) + { + case EInvalidVisual: + return KErrorInvalidVisual; + case EInvalidVisualValue: + return KErrorInvalidVisualValue; + default: + return KErrorUndefinedException; + } + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfwidgetexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfwidgetexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 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: The implementation for widget exception class. +* +*/ + + + +#include +#include "alfexceptionstrings.h" + +using namespace osncore; + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidgetException::AlfWidgetException( int aErrorCode ) throw() : + AlfException( aErrorCode ) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidgetException::AlfWidgetException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw() : + AlfException( aErrorCode, aInfo, aFileAndLine ) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidgetException::~AlfWidgetException() throw() + { +// nothing to do! + } + +// --------------------------------------------------------------------------- +// Returns the error information in c-string style. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfWidgetException::what() const throw() + { + switch ( errorCode() ) + { + case EInvalidWidget: + return KErrorInvalidWidget; + default: + return KErrorUndefinedException; + } + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfwidgetfactoryloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfwidgetfactoryloader.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 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: Encapsulates widget factory plugin loading mechanism +* +*/ + +#include +#include +#include "alfwidgetfactoryloaderimpl.h" + +namespace Alf + { + +OSN_EXPORT AlfWidgetFactoryLoader::AlfWidgetFactoryLoader(): + mImpl(new (EMM)AlfWidgetFactoryLoaderImpl()) + { + + } + +OSN_EXPORT AlfWidgetFactoryLoader::~AlfWidgetFactoryLoader() + { + + } + +OSN_EXPORT IAlfWidgetFactory* AlfWidgetFactoryLoader::loadWidgetFactory( + CAlfEnv& aEnv) + { + return mImpl->load(aEnv); + } + + } + + +// End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 alfwidgetutils/src/alfwidgetfactoryloaderimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alfwidgetutils/src/alfwidgetfactoryloaderimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2007 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: Encapsulates factory plugin loading mechanism +* +*/ + + + +#include +//#include +#include +#include +#include + +#include "alf/alfecompluginfactoryuid.rh" +#include "alfwidgetfactoryloaderimpl.h" + +using namespace std; + +namespace Alf + { + +static const char* const KWidgetFactory ="alfwidgetfactory"; +const int KPluginIuid = 0x11201113; + +AlfWidgetFactoryLoaderImpl::AlfWidgetFactoryLoaderImpl(): + mFactoryPlugin(0), + mWidgetFactory(0), + mDtorKey(0) + { + + } + +AlfWidgetFactoryLoaderImpl::~AlfWidgetFactoryLoaderImpl() + { + delete mWidgetFactory; + if (mFactoryPlugin) + { + delete mFactoryPlugin; + REComSession::DestroyedImplementation(TUid::Uid(mDtorKey)); + } + + } + +IAlfWidgetFactory* AlfWidgetFactoryLoaderImpl::load(CAlfEnv& aEnv) + { + if (!mWidgetFactory) + { + TEComResolverParams resolverParams; + resolverParams.SetDataType(TPtrC8((TUint8*)KWidgetFactory)); + resolverParams.SetWildcardMatch(ETrue); + + TAny* plugin = NULL; + + TUid tmpDtor; + + TRAPD(err,plugin = REComSession::CreateImplementationL( + TUid::Uid(KPluginIuid),tmpDtor, + resolverParams)) + + + if (!err) + { + mDtorKey = tmpDtor.iUid; + mFactoryPlugin = reinterpret_cast(plugin); + IAlfInterfaceBase* tmp(0); + tmp = mFactoryPlugin->createProduct(KWidgetFactory,&aEnv); + mWidgetFactory = + IAlfInterfaceBase::makeInterface(tmp); + } + } + + return mWidgetFactory; + } + + } + + +// End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2006 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: Build information file for UI Accelerator Architetecture Domain +* +*/ + +#include +// notice, that the build order is important. + +#include "../mmuifw_plat/group/bld.inf" + +#include "../osncore/group/bld.inf" +#include "../alfwidgetutils/group/bld.inf" +#include "../resourcepool/group/bld.inf" +#include "../widgetmodel/group/bld.inf" + +#include "../mulwidgets/group/bld.inf" + + + + +PRJ_EXPORTS + +../rom/alfcollect.iby CORE_MW_LAYER_IBY_EXPORT_PATH(alfcollect.iby) +../rom/alfwidgets.iby CORE_MW_LAYER_IBY_EXPORT_PATH(alfwidgets.iby) \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfanchorlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfanchorlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2007 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: Anchor layout attribute setter header. +* +*/ + + +#ifndef ALFANCHORLAYOUTATTRIBUTESETTER_H +#define ALFANCHORLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + +/** + * @class AlfAnchorLayoutAttributeSetter alfanchorlayoutattributesetter.h "alf/alfanchorlayoutattributesetter.h" + * The implementation of the attribute setter for setting anchor layout attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfAnchorLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { + +public: + + /** + * Constructor. + * + */ + OSN_IMPORT AlfAnchorLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfAnchorLayoutAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not + * an anchor layout. + * @exception osncore::AlfVisualException Thrown with Symbian error code if anchor point attachment fails. + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + + +protected: + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData + */ + void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData + */ + void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData + */ + void handleStaticAttribute( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + +private: + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data. if not NULL, attribute value is fetched from the map. + * Ownership of the object is not transferred. + */ + bool doHandleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + +private: // data + }; + + } // namespace Alf + +#endif // C_ALFANCHORLAYOUTATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfattribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfattribute.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,461 @@ +/* +* Copyright (c) 2007 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: A class for attribute. +* +*/ + + +#ifndef ALFATTRIBUTE_H +#define ALFATTRIBUTE_H + +//INCLUDES +#include +#include +#include +#include +#include +#include "alf/alfattributevaluetype.h" + +using namespace osncore; + +// FORWARD DECLARATIONS + +namespace osncore + { +class UString; + } +using std::auto_ptr; + +namespace Alf + { + +class AlfAttributeImpl; +class AlfAttributeValueType; + +/** + * @class AlfAttribute alfattribute.h "alf/alfattribute.h" + * Class for holding attributes. + * AlfAttribute is a receptacle for holding data that can be applied to + * visuals/visual templates via the attribute setters. + * They can also be used hold data for properties of widgets or widget parts + * implement the IAlfAttributeOwner interface. + * An attribute can have one or more attribute value types. + * Attributes can be bunched together in attribute containers. + * @see IAlfAttributeSetter + * @see IAlfAttributeOwner + * @see AlfAttributeValueType + * @see AlfAtributeContainer + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfAttribute + { +public: + + /* See Declarative Hitchcock language specification + for more detail of attribute categories */ + enum attributecategory + { + EStatic, /* static attribute */ + EDynamic, /* dynamic attribute */ + EStaticData, /* static dataattribute */ + EDynamicData /* dynamic dataattribute */ + }; + + /** + * Constructor. + * @exception std::bad_alloc + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute(); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aName Attribute name. Makes a copy of the name. + * @param aCategory Attribute category. + * @return New object. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute(const char* aName, attributecategory aCategory); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aName Attribute name. Makes a copy of the name. + * @param aTargetValue The target value of the child attribute. + * @param aUnit Unit of the value. + * @param aCategory Attribute category. + * @return New object. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute(const char* aName, int aTargetValue, + TAlfUnit aUnit = EAlfUnitPixel, + attributecategory aCategory = EStatic); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aName Attribute name. Makes a copy of the name. + * @param aTargetValue The target value of the child attribute. + * @param aUnit Unit of the value. + * @param aCategory Attribute category. + * @return New object. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute(const char* aName, float aTargetValue, + TAlfUnit aUnit = EAlfUnitNormalized, + attributecategory aCategory = EStatic); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aName Attribute name. Makes a copy of the name. + * @param aTargetValue The target value of the child attribute. Makes a copy of the value. + * @param aCategory Attribute category. + * @return New object. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute(const char* aName, const UString& aTargetValue, + attributecategory aCategory = EStatic); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfAttribute(); + + /** + * Assignment operation. Assigns all the member variables + * to the values in the reference attribute. + * @exception std::bad_alloc + * + * @param aAttribute The source attribute. + * @return Reference to the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute& operator=(const AlfAttribute& aAttribute); + + /** + * Clones the attribute. + * @exception std::bad_alloc + * + * @return The cloned attribute. Ownership is transferred to the caller. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttribute* clone(); + + /** + * Gets the name of the attribute. + * + * @return The name of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT const char* name() const; + + /** + * Gets the category of the attribute. + * + * @return The category of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT attributecategory category() const; + + /** + * Gets the type of the attribute. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @return The type of the attribute target value. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttributeValueType::Type type(unsigned int aIndex = 0) const; + + /** + * Gets the int target value. Use this method only if the attribute type is EInt. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * @param aIndex The index of the attribute value. + * @return The integer value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT int intValue(unsigned int aIndex = 0) const; + + /** + * Gets the real target value. Use this method only if the attribute type is EFloat. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex The index of the attribute value. + * @return The float value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT float realValue(unsigned int aIndex = 0) const; + + /** + * Gets the string target value. Use this method only if the attribute type is EString. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex The index of the attribute value. + * @return The string value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& stringValue(unsigned int aIndex = 0) const; + + /** + * Returns true if the attribute value is set. + * + * @return The value state. + * @since S60 ?S60_version + */ + OSN_IMPORT bool isValueSet() const; + + /** + * Gets the unit of the value. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex The index of the attribute value. + * @return The unit. + * @since S60 ?S60_version + */ + OSN_IMPORT virtual TAlfUnit unit(unsigned int aIndex = 0) const; + + /** + * Adds a new target value to the attribute. + * + * @param aValue New value to be added. + * @since S60 ?S60_version + */ + OSN_IMPORT void addTargetValue(AlfAttributeValueType* aValue); + + /** + * Gets target value count. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @return Value count. + * @since S60 ?S60_version + */ + OSN_IMPORT unsigned int getTargetValueCount() const; + + /** + * Sets the target value of the attribute. + * + * @param aIndex The index of the attribute value. + * @param aValue The target value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT void setTargetValue(AlfAttributeValueType* aValue, + unsigned int aIndex = 0); + + /** + * Gets the target value of the attribute. + * + * @param aIndex The index of the attribute value. + * @return The target value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttributeValueType* getTargetValue( + unsigned int aIndex = 0) const; + + /** + * Removes the target value of the attribute. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex The index of the attribute value. + * @since S60 ?S60_version + */ + OSN_IMPORT void removeTargetValue(unsigned int aIndex = 0); + + /** + * Adds a new source value to the attribute. + * + * @param aValue New value to be added. + * @since S60 ?S60_version + */ + OSN_IMPORT void addSourceValue(AlfAttributeValueType* aValue); + + /** + * Gets source value count. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @return The source value count. + * @since S60 ?S60_version + */ + OSN_IMPORT unsigned int getSourceValueCount() const; + + /** + * Sets the source value of the attribute. + * + * @param aIndex The index of the attribute value. + * @param aValue The source value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT void setSourceValue(AlfAttributeValueType* aValue, + unsigned int aIndex = 0); + + /** + * Gets the source value of the attribute. + * + * @param aIndex The index of the attribute value. + * @return The source value of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfAttributeValueType* getSourceValue( + unsigned int aIndex = 0) const; + + /** + * Removes the source value of the attribute. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex The index of the attribute value. + * @since S60 ?S60_version + */ + OSN_IMPORT void removeSourceValue(unsigned int aIndex = 0); + + /** + * Sets the interpolation style of the attribute. + * + * @param aInterpolationStyle The interpolation style. + * @since S60 ?S60_version + */ + OSN_IMPORT void setInterpolationStyle(TAlfInterpolationStyle aInterpolationStyle); + + /** + * Gets the interpolation style of the attribute. + * + * @return The interpolation style of the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT TAlfInterpolationStyle getInterpolationStyle() const; + + /** + * Sets the transition time for the attribute. + * + * @param aTime The transition time for the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT void setTime(int aTime); + + /** + * Gets the transition time for the attribute. + * + * @return The transition time for the attribute. + */ + OSN_IMPORT int getTime() const; + + /** + * Sets the mapping function id for the attribute. + * + * @param aId The mapping function id for the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT void setMappingFunctionId(int aId); + + /** + * Gets the mapping function id for the attribute. + * + * @return The mapping function id for the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT int getMappingFunctionId() const; + + /** + * Sets the datafield for the attribute. + * + * @param aDataField The datafield for the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT void setDataField(const char* aDataField); + + /** + * Gets the datafield for the attribute. + * + * @return The datafield for the attribute. + * @since S60 ?S60_version + */ + OSN_IMPORT const char* getDataField() const; + + /** + * Sets the delay before the transition. + * + * @param aDelay The delay before the transition. + * @since S60 ?S60_version + */ + OSN_IMPORT void setDelay(int aDelay); + + /** + * Gets the delay before the transition. + * + * @return The delay before the transition. + * @since S60 ?S60_version + */ + OSN_IMPORT int getDelay() const; + + /** + * Gets the dirty information + * + * @return whether dirty or not + * @since S60 ?S60_version + */ + OSN_IMPORT bool isDirty( ) const; + + /** + * Sets the dirty information + * + * @param flag indicates whether remove or set dirtiness + * @since S60 ?S60_version + */ + OSN_IMPORT void setDirty(bool aFlag ); + +private: + + /** + * Resets the data. + * + * @param aName Attribute name. + * @param aValue The value of the attribute. + * @param aCategory Attribute category. + * @since S60 ?S60_version + */ + void reset(const char* aName, AlfAttributeValueType* aValue, + attributecategory aCategory); + + /** + * Declaring private copy construction to prevent usage. + * + * @param aAttribute The attribute. + * @since S60 ?S60_version + */ + AlfAttribute(const AlfAttribute& attribute); + + /** + * Helper function for cloning value type. + * @exception std::bad_alloc + * + * @param aValue The source attribute value. + * @since S60 ?S60_version + */ + AlfAttributeValueType* cloneValueType(AlfAttributeValueType* aValue) const; + +private: // data + + // Implementation data + auto_ptr mData; + }; + + } // namespace Alf + +#endif //ALFATTRIBUTE_H \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfattributecontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfattributecontainer.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2007 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: Attribute container. +* +*/ + + +#ifndef ALFATTRIBUTECONTAINER_H +#define ALFATTRIBUTECONTAINER_H + +#include +#include + +namespace Alf + { + +class AlfAttribute; +class AlfAttributeContainerImpl; + +/** + * @class AlfAttributeContainer alfattributecontainer.h "alf/alfattributecontainer.h" + * AlfAttributeContainer is a collection of attributes. It is used to bunch up a set + * of attributes. Attribute setters and implementations of the IAlfAttributeOwner interface + * can work with attribute containers. + * @see IAlfAttributeSetter + * @see IAlfAttributeOwner + * @see AlfAttribute + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfAttributeContainer + { +public: + + /** Type enumeration. */ + enum Type + { + EAlfCommonAttributeContainer = 0, + + EAlfSetFlagAttributeContainer, + EAlfClearFlagAttributeContainer, + + EAlfOpacityAttributeContainer, + EAlfXPosAttributeContainer, + EAlfYPosAttributeContainer, + EAlfWidthAttributeContainer, + EAlfHeightAttributeContainer, + EAlfDepthOffsetAttributeContainer, + EAlfScrollAttributeContainer, //not used yet + EAlfExpandAttributeContainer, + EAlfRowsAttributeContainer, + EAlfColumnsAttributeContainer, + EAlfAnchorPointAttributeContainer, + EAlfScalingAttributeContainer, + EAlfImageSecondaryAlphaAttributeContainer, + + EAlfPositionAttributeContainer, + EAlfSizeAttributeContainer, + EAlfScrollOffsetAttributeContainer, + EAlfTranslationAttributeContainer,//not implemented still + EAlfRotationXYZAAttributeContainer,//not implemented still + + EAlfPrimaryImageAttributeContainer, + EAlfSecondaryImageAttributeContainer, + EAlfTextAttributeContainer, + + EAlfViewportSizeAttributeContainer, + EAlfViewportVirtualSizeAttributeContainer, + EAlfViewportPosAttributeContainer, + EAlfSkinImageIDAttributeContainer, + EAlfSkinTextColorAttributeContainer, + }; + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aType a type of container. + */ + OSN_IMPORT AlfAttributeContainer(Type aType = EAlfCommonAttributeContainer); + + /** + * Destructor. + */ + OSN_IMPORT ~AlfAttributeContainer(); + + /** + * Gets the type of the container. + * + * @return The type of the container. + */ + OSN_IMPORT Type type() const; + + /** + * Adds a new attribute to the container. + * @exception std::bad_alloc + * + * @param aAttribute The new attribute, takes ownership. + */ + OSN_IMPORT void addAttribute( AlfAttribute* aAttribute); + + /** + * Returns the attribute count. + * + * @return the attribute count. + */ + OSN_IMPORT unsigned int attributeCount() const; + + /** + * Returns reference to the attribute. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex index of the attribute. + * @return The attribute. Throws CAlfDataException if index is invalid. + * Ownership is not transferred. + */ + OSN_IMPORT AlfAttribute& getAttribute(unsigned int aIndex) const; + + /** + * Returns the attribute. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aName is not found among attributes contained in the container. + * + * @param aName name of the attribute. + * @return the attribute. Throws CAlfDataException if attribute is not found. + * Ownership is not transferred. + */ + OSN_IMPORT AlfAttribute& getAttributeByName(const char* aName) const; + + /** + * Removes the attribute. Throws CAlfDataException if index is invalid. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. + * + * @param aIndex index of the attribute. + */ + OSN_IMPORT void removeAttribute(unsigned int aIndex); + + /** + * Sets the animation time of the attribute container. + * + * @param The time value (milliseconds). + */ + OSN_IMPORT void setTime(unsigned int aTime); + + /** + * Returns the animation time of the attribute container. + * + * @return The time value (milliseconds). + */ + OSN_IMPORT unsigned int getTime() const; + +private: + + /** + * Copy construction, not implemented. + */ + AlfAttributeContainer(const AlfAttributeContainer&); + + /** + * Assigment operation, not implemented. + */ + AlfAttributeContainer& operator=(const AlfAttributeContainer&); + +private: + + // Implementation data + std::auto_ptr mData; + }; + + } // namespace Alf + +#endif // ALFATTRIBUTECONTAINER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfattributevaluetype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfattributevaluetype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2007 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: attribute value type header. +* +*/ + + +#ifndef ALFATTRIBUTEVALUETYPE_H +#define ALFATTRIBUTEVALUETYPE_H + +#include +#include +#include + +namespace osncore + { +class UString; + } +using namespace osncore; +using std::auto_ptr; + +namespace Alf + { + +class AlfAttributeValueTypeImpl; + +/** + * @class AlfAttributeValueType alfattributevaluetype.h "alf/alfattributevaluetype.h" + * A class for attribute value type. Attributes are constructed using + * AlfAttributeValueType objects. AlfAttributeValueType can store integer,float,string, + * enum and RGB data. + * @see AlfAttribute + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfAttributeValueType + { + +public: + + /** Type enumeration. */ + enum Type + { + EInt, EFloat, EString + }; + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aValue The value of the attribute. + * @param aUnit Unit of the value. + */ + OSN_IMPORT AlfAttributeValueType(int aValue, + TAlfUnit aUnit = EAlfUnitPixel); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aValue The value of the attribute. + * @param aUnit Unit of the value. + */ + OSN_IMPORT AlfAttributeValueType(float aValue, + TAlfUnit aUnit = EAlfUnitNormalized); + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aValue The value of the attribute. Takes a copy of the object. + */ + OSN_IMPORT AlfAttributeValueType(const UString& aValue); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfAttributeValueType(); + + /** + * Gets the enum value. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttributeValue + * if the attribute value type is not of enum type. + * + * @return The integer value. + */ + OSN_IMPORT virtual int enumValue() const; + + /** + * Gets the string value. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttributeValue + * if the attribute value type is not of string type. + * + * @return The string value. + */ + OSN_IMPORT virtual const UString& stringValue() const; + + /** + * Gets the integer value. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttributeValue + * if the attribute value type is not of integer type. + * + * @return The integer value. + */ + OSN_IMPORT virtual int intValue() const; + + /** + * Gets the real value. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttributeValue + * if the attribute value type is not of float type. + * + * @return The real value. + */ + OSN_IMPORT virtual float realValue() const; + + /** + * Gets the RGB value. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttributeValue + * if the attribute value type is not of float type. + * + * @return The RGB value. + */ + OSN_IMPORT virtual float rgbValue() const; + + /** + * Gets the type of the attribute value. + * + * @return The type of the attribute value. + */ + OSN_IMPORT virtual Type type() const; + + /** + * Gets the unit of the value. + * + * @return The unit of the value. + */ + OSN_IMPORT virtual TAlfUnit unit() const; + +protected: + + /** + * Constructor. + */ + AlfAttributeValueType(); + +private: // data + + auto_ptr mData; + + }; + + } // namespace Alf + +#endif // ALFATTRIBUTEVALUETYPE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfcommonattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfcommonattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2007 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: attribute setter base implementation header. +* +*/ + + +#ifndef ALFCOMMONATTRIBUTESETTER_H +#define ALFCOMMONATTRIBUTESETTER_H + +#include "alf/ialfattributesetter.h" + +namespace Alf + { + +/** + * @class AlfCommonAttributeSetter alfcommonattributesetter.h "alf/alfcommonattributesetter.h" + * Base implementation for attribute setters. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfCommonAttributeSetter : public IAlfAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfCommonAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfCommonAttributeSetter(); + + // from base class IAlfAttributeSetter + + /** + * Returns the type of the attribute setter. + * + * @return The type of the attribute setter. + */ + OSN_IMPORT virtual SetterType setterType(); + + /** + * Sets an attribute value in the target visual immediately without a transition. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if aContainer is invalid. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + */ + OSN_IMPORT virtual void setAttributeValue( + CAlfVisual &aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData); + + /** + * Creates a command to change the value of an attribute in the target visual + * gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData, + int aTransitionTime = 0, CAlfVisual* aRefVisual = NULL); + + /** + * Creates commands to change the given attribute values in the target visual + * gradually with a transition.Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands(CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, CAlfVisual* aRefVisual = NULL); + +// from base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the element classes. + * Derived classes should always call the base class method + * from the overridden makeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT IAlfInterfaceBase* makeInterface(const IfId& aType); + + /** + * Converts text between Unicode (UCS-2) and the Unicode transformation format UTF-8. + * + * @param aSrc The source string. + * @return Converted string. + */ + HBufC* convertToUnicodeFromUtf8(const TPtrC8& aSrc) const; + + /** + * Sets Dirty check flag. + * + * @param aCheck whether dirty check should be enabled or not. + */ + OSN_IMPORT void enableDirtyCheck(bool aCheck); +protected: + + /** + * Sets a value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleDynamicAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a value for static data attribute in the target visual + * immediately without a transition using data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleStaticDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets a value for dynamic data attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleDynamicDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + +private: // data + bool mDoDirtycheck; + }; + + } // namespace Alf + +#endif // ALFCOMMONATTRIBUTESETTER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfcommonlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfcommonlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 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: layout attribute setters base implementation header. +* +*/ + + +#ifndef ALFCOMMONLAYOUTATTRIBUTESETTER_H +#define ALFCOMMONLAYOUTATTRIBUTESETTER_H + +#include +#include +#include +#include "alf/alfcommonvisualattributesetter.h" + +using namespace osncore; + +using std::auto_ptr; + +namespace Alf + { + +/** + * @class AlfCommonLayoutAttributeSetter alfcommonlayoutattributesetter.h "alf/alfcommonlayoutattributesetter.h" + * Base implementation for layout attribute setters. Attribute setters for custom layouts can derive from this + * class. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfCommonLayoutAttributeSetter : public AlfCommonVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfCommonLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfCommonLayoutAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not + * a layout. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + + + +protected: + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + }; + + } // namespace Alf + +#endif // ALFCOMMONLAYOUTATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfcommonvisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfcommonvisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2007 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: attributesetter for common visual attributes +* +*/ + + +#ifndef ALFCOMMONVISUALATTRIBUTESETTER_H +#define ALFCOMMONVISUALATTRIBUTESETTER_H + +#include +#include +#include +#include "alf/alfcommonattributesetter.h" + +using namespace osncore; + +using std::auto_ptr; + +namespace Alf + { + +/** + * @class AlfCommonVisualAttributeSetter alfcommonvisualattributesetter.h "alf/alfcommonvisualattributesetter.h" + * Base implementation for visual attribute setters. Attribute setters for custom visuals can derive from this + * class. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfCommonVisualAttributeSetter : public AlfCommonAttributeSetter + { +public: + + /** + * Constructor. + * + */ + OSN_IMPORT AlfCommonVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfCommonVisualAttributeSetter(); + + /** + * Creates a command to change the value of an attribute + * in the target visual gradually with a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, + * the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding + * attribute value in the reference visual. + * @return The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values + * in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. + * The container can hold new values for multiple different + * attributes, in which case several commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, + * the target value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute value + * in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + + /** + * From AlfCommonAttributeSetter + * Sets a value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * From AlfCommonAttributeSetter + * Sets a dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleDynamicAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * From AlfCommonAttributeSetter + * Sets a value for static data attribute in the target visual + * immediately without a transition using data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleStaticDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * From AlfCommonAttributeSetter + * Sets a value for dynamic data attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleDynamicDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + +private: + + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + * @param aImmediate if true, the change is immediate and time value of the attribute is not used. + * @return true, if attribute was handled, false otherwise. + */ + bool doHandleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, bool aImmediate = false); + + /** + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + * @param aImmediate if true, the change is immediate and time value of the attribute is not used. + */ + bool doHandleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate = false); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. + * @param aAttr main attribute, from which the command is created. + The function can also use other attributes found in the aContainer. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + void sendCommandsForAttribute(CAlfVisual& aVisual, + AlfAttributeContainer& aContainer, AlfAttribute& aAttr, + CAlfVisual* aRefVisual); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + void setPadding(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + void setMinSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + void setMaxSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); + + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + + void setPos(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + + void setSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + + void setRect(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); + + void setTactileFeedback(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); + +private: // data + }; + + } // namespace Alf + +#endif // ALFCOMMONVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfcurvepathlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfcurvepathlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2007 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: curve path layout attribute setter header. +* +*/ + + +#ifndef ALFCURVEPATHLAYOUTATTRIBUTESETTER_H +#define ALFCURVEPATHLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + +/** + * @class AlfCurvePathLayoutAttributeSetter alfcurvepathlayoutattributesetter.h "alf/alfcurvepathlayoutattributesetter.h" + * The implementation of the attribute setter for setting curve path layout attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfCurvePathLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { + +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfCurvePathLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfCurvePathLayoutAttributeSetter(); + + /** + * Sets an attribute value in the target visual immediately without + * a transition. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual + * is not a curvepath layout. + * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if the data field + * for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if aData + * for data attributes is 0. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if an + * attempt is made to set a line attribute to a curvepath layout + * with incomplete data. See language specification on how to + * create this attribute. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if an + * attempt is made to set an arc attribute to a curvepath layout + * with incomplete data. See language specification on how to + * create this attribute. + * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if the attribute + * (or aData in case of data attributes) contains invalid data types + * while setting a line or arc to a curvepath layout. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Deprecated! Do not use! + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the + * attribute.Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * @ret The command to gradually change the attribute in the target visual + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding attribute value(s) + * used by the attribute setter. Ownership is not + * transferred. The container can hold new values for + * multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + + +protected: + /** + * Sets an dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleDynamicAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object + * is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ); + + /** + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute ( CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Check if data in the attribute is int or float. + * Return the value as a float value + * + * @param aAttr The attribute containing the value + * @param aIndex The index of the value to be checked + * return Content of the attribute + */ + float floatOrInt(const AlfAttribute& aAttr, int aIndex); + + /** + * Check if data in the attribute is int or float. + * Return the value as a float value + * + * @param aData The variant type containing the value + * return Content of the variant type + */ + float floatOrIntFromData(IAlfVariantType* aData); + +private: // data + }; + + } // namespace Alf + +#endif // ALFCURVEPATHLAYOUTATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfdecklayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfdecklayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007 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: Deck layout attribute setter Header. +* +*/ + + +#ifndef ALFDECKLAYOUTATTRIBUTESETTER_H +#define ALFDECKLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + +/** + * @class AlfDeckLayoutAttributeSetter alfdecklayoutattributesetter.h "alf/alfdecklayoutattributesetter.h" + * The implementation of the attribute setter for setting curve path layout attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ + class AlfDeckLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { + +public: + + /** + * Constructor. + */ + OSN_IMPORT AlfDeckLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfDeckLayoutAttributeSetter(); + + + /** + * Sets an attribute value in the target visual immediately without a transition. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual + * is not a deck layout. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue (CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target visual + * gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand (CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, IAlfMap* aData, + int aTransitionTime = 0, CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. + * The container can hold new values for multiple different + * attributes, in which case several commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + + /** + * Sets a value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + */ + virtual void handleDynamicAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a value for static data attribute in the target visual + * immediately without a transition using data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleStaticDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets a value for dynamic data attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Ownership not passed. + * @param aAttr The attribute to process. Ownership not passed. + * @param aContainer The container holding attributes. Ownership not passed. + * @param aData Contains data. Ownership not passed. + */ + virtual void handleDynamicDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + +private:// data + }; + + }// namespace Alf + +#endif // ALFDECKLAYOUTATTRIBUTESETTER_H +// End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfecompluginfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfecompluginfactory.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002-2004 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: Ecom plugin Factory header. +* +*/ + + +#ifndef C_ALFECOMPLUGINFACTORY_H +#define C_ALFECOMPLUGINFACTORY_H + +#include +#include // for typedeffed RImplInfoPtrArray +#include + +namespace Alf + { + +/** + * @class CAlfEComPluginFactory alfecompluginfactory.h "alf/alfecompluginfactory.h" + * Base class for Ecom plugins. Takes care of ecom housekeeping. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class CAlfEComPluginFactory : public CBase, public IAlfInterfaceBase + { +public: // Constructors and destructor + + /** + * Factory method to create plugin for given interface + * @param aInterfaceUid UID of interface being queried/created. + * @param aImplKey Implementation Key + * @return An ecom plugin factory. + */ + IMPORT_C static CAlfEComPluginFactory* createPluginFactory( + TUid aInterfaceUid,const char* aImplKey); + + /** + * Destructor. + */ + IMPORT_C virtual ~CAlfEComPluginFactory(); + +public: + /** + * List available interface implementations. + * @since Series 60 3.2 + * @param aInterfaceUid: Interface Uid + * @param aImplInfoArray: Place holder which gets populated + * after function call + */ + IMPORT_C static void getImplementationsL( + TUid aInterfaceUid, + RImplInfoPtrArray& aImplInfoArray); + + /** + * List available interface implementations. + * @since Series 60 3.2 + * @param aInterfaceUid: Interface Uid + * @param aImplKey Implementation Key + * @param aImplInfoArray: Place holder which gets populated after + * function call + */ + IMPORT_C static void getImplementationsL(TUid aInterfaceUid, + const char* aImplKey, + RImplInfoPtrArray& aImplInfoArray); + +protected: + + /** + * C++ default constructor. + */ + IMPORT_C CAlfEComPluginFactory(); + +private: // Data + // Ecom instance release key + TUid mDtorKey; + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfecompluginfactoryuid.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfecompluginfactoryuid.rh Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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: Ecom Plugin factory UID +* +*/ + + +#ifndef RH_ALFECOMPLUGINFACTORY_H +#define RH_ALFECOMPLUGINFACTORY_H + +#define KFactoryPluginUid 0x10201112 +//#define KWidgetFactoryUid 0x11201113 +//#define KCustomWidgetFactoryUid 0x11112222 + + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,423 @@ +/* +* Copyright (c) 2007 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: The interface and the basic implementation for presentation elements. +* +*/ + + +#ifndef ALFELEMENT_H +#define ALFELEMENT_H + +#include +#include +#include +#include + +using osncore::AlfPtrVector; +using std::auto_ptr; + +class CAlfVisual; +class CAlfLayout; + +namespace Alf + { +class CAlfWidgetControl; +class IAlfVariantType; +class AlfReferenceToVisual; +class IAlfVisualTemplate; +class AlfElementImpl; +class IfId; + +/** @class AlfElement alfelement.h "alf/alfelement.h" + * The implementation of a generic element. Elements can be used, + * e.g., from declaration, to describe a specific part of + * the presentation of a component. The presentation may + * be predefined, or it may depend on the component data. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeOwner, IAlfElement + * @attributes duiuimodel::tactileattributes::KEventInput\n + * duiuimodel::tactileattributes::KFeedbackType\n + * duiuimodel::commonvisualattributes::KOpacity\n + * duiuimodel::layoutattributes::KPositionX\n + * duiuimodel::layoutattributes::KPositionY\n + * duiuimodel::layoutattributes::KWidth\n + * duiuimodel::layoutattributes::KHeight\n + * duiuimodel::layoutattributes::KMaxWidth\n + * duiuimodel::layoutattributes::KMaxHeight\n + * duiuimodel::layoutattributes::KMinWidth\n + * duiuimodel::layoutattributes::KMinHeight + */ +class AlfElement : public IAlfElement + { +public: + + + /** + * Static cnstructor. The new element is left on the cleanup stack. + * + * @since S60 ?S60_version + * @param aControl The owner control. + * @param aName The name of the element. + * @return New object. Should be added to the control. + */ + OSN_IMPORT AlfElement(CAlfWidgetControl& aControl, const char* aName); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfElement(); + + /** + * Returns name of element set via Constructor. + * + * @since S60 ?S60_version + * @return name of element. + */ + OSN_IMPORT const char* name() const; + + /** + * Creates a visual tree in given element. + * + * @since S60 ?S60_version + * @param aElement Element for which visual tree will be created + * @param aChildData Data for visual tree to be created + * @param aData Data for parent visual tree + * @param aIndex Position in parent layout at which new visual tree will be added + * @param aDataID Parent visual tree's data id + */ + OSN_IMPORT virtual void createChildVisualTree( IAlfElement* aElement, + IAlfVariantType& aChildData, + IAlfBranch& aData, + int aIndex, uint aDataID ); + + /** + * Creates a visual tree with the data given for visuals. + * + * @exception osncore::AlfElementException Thrown with the error code osncore::EInvalidElement\n + * when creation of visual tree fails. + * @since S60 ?S60_version + * @param aChildData Data for visual tree to be created + * @param aParentData Data for parent visual tree + * @param aIndex Position in parent layout at which new visual tree will be added + * @param aParentDataID Parent visual tree's data id + * @param aParentLayout Parent layout to which newly created visual tree will be added + * @param aLayoutIndex Position in parent layout at which new visual tree will be added + */ + OSN_IMPORT virtual CAlfVisual* createVisualTree( + IAlfVariantType& aChildData, IAlfBranch& aParentData, int aIndex, + uint aParentDataID, CAlfLayout* aParentLayout, int aLayoutIndex ); + + /** + * Creates a visual tree with the data given for visuals. + * + * @exception std::bad_alloc + * @exception osncore::AlfVisualException Thrown with the error code osncore::ECanNotCreateVisual\n + * when creation of visual fails. + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when wrond data id is supplied. + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aData Data for visual tree to be created + * @param aDataID Parent visual tree's data id + * @param aParentLayout Parent layout to which newly created visual tree will be added + * @param aLayoutIndex Position in parent layout at which new visual tree will be added + */ + OSN_IMPORT virtual CAlfVisual* createVisualTree( + IAlfVariantType& aData, uint aDataID, + CAlfLayout* aParentLayout, int aLayoutIndex ); + + /** + * Removes visual tree from given element. + * + * @since S60 ?S60_version + * @param aElement Element from which visual tree is to be removed + * @param aData + * @param aIndex + * @param aDataID + */ + OSN_IMPORT virtual void removeChildVisualTree( IAlfElement* aElement, + IAlfBranch& aData, + int aIndex, uint aDataID ); + + /** + * Removes visual tree. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when removal of visual tree fails. + * @since S60 ?S60_version + * @param aParentData + * @param aIndex + * @param aParentDataID + */ + OSN_IMPORT virtual void removeVisualTree( IAlfBranch& aParentData, + int aIndex, uint aParentDataID ); + + /** + * Removes visual tree. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when removal of visual tree fails. + * @since S60 ?S60_version + * @param aData + * @param aDataID + */ + OSN_IMPORT virtual void removeVisualTree( IAlfVariantType& aData, + uint aDataID ); + + /** + * Updates the visual tree. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when a visual can not be created. + * @since S60 ?S60_version + * @param aNewData + * @param aOldData + * @param aDataID + */ + OSN_IMPORT virtual void updateVisualTree( IAlfVariantType& aNewData, + IAlfVariantType& aOldData, + uint aDataID ); + + /** + * Replaces the visual tree. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when old data id is wrong. + * @since S60 ?S60_version + * @param aData + * @param aDataID + * @param aOldDataID + */ + OSN_IMPORT void replaceVisualTree( IAlfVariantType& aData, + uint aDataID, uint aOldDataID ); + + /** + * Add a new visual tree to the element. + * Used by derived classes. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when either the visual is NULL or data id is wrong. + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aVisualTree visual to be appended. + * @param aDataID data id of the visual. + */ + OSN_IMPORT void addVisualTree(CAlfVisual* aVisualTree, uint aDataID); + + /** + * Updates the Data ids in an the element. + * + * @since S60 ?S60_version + * @param aParentBranch Data in which IDs to be updated + * @param aStartIndex Index from which IDs to be updated + * @param aOffset Amount by which IDs are increased/decreased + * @param aOldParentDataId Not used. + * @param aParentDataID Parent data id of the element + */ + OSN_IMPORT void updateDataIDs( IAlfBranch& aParentBranch, int aStartIndex, + int aOffset, uint aOldParentDataId, uint aParentDataID ); + + /** + * Returns the default parent layout of visual tree in an element. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidVisual\n + * when wrong data id is supplied. + * @since S60 ?S60_version + * @param aParentDataIS + * @return Parent layout + */ + OSN_IMPORT CAlfLayout* defaultParentLayout(uint aParentDataID); + + /** + * Set reference to the default parent layout. + * + * @since S60 ?S60_version + * @param aReference The reference to the default parent layout. + */ + OSN_IMPORT void setDefaultParentLayout(AlfReferenceToVisual* aReference); + + /** + * Finds visual with the given name and id in visual tree of element. + * + * @since S60 ?S60_version + * @param aName Name of the visual + * @param aDataID Data id of the visual + * @return Visual.Returns NULL if no matching visual is found. + */ + OSN_IMPORT CAlfVisual* findVisual(const char* aName, uint aDataID); + + /** + * Get visual from the data id. + * + * @since S60 ?S60_version + * @param aDataID data id of the visual. + */ + OSN_IMPORT CAlfVisual* findVisual(uint aDataID); + + /** + * Returns the data id of given visual. + * + * @since S60 ?S60_version + * @param aVisual Reference to visual whose data id is needed. + * @return Data id of the visual + */ + OSN_IMPORT uint dataID(const CAlfVisual& aVisual) const; + + /** + * Returns parent element of the element. + * + * @since S60 ?S60_version + * @return Parent element. NULL, if there is no parent element. + */ + OSN_IMPORT const IAlfElement* parentElement() const; + + /** + * Makes the element child of given element. + * + * @since S60 ?S60_version + * @param aParent Parent element. + */ + OSN_IMPORT void setParentElement(IAlfElement& aParent); + + /** + * Sets the visual template for the element. This element + * will acquire ownership of the visual template hierarchy + * under the given visual template. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * @param aTemplate Root of the visual template hierarchy to be set + * into the widget element. + */ + OSN_IMPORT void setVisualTemplate(IAlfVisualTemplate& aTemplate) throw(); + + /** + * Returns the root visual template of the visual template hierarchy + * owned by this element. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT IAlfVisualTemplate* getVisualTemplate() const throw(); + + /** + * Destroyes the visual template object assigned to this element and the whole + * visual template hierarchy under it. + * + * @since S60 ?S60_version + */ + OSN_IMPORT void destroyVisualTemplate() throw(); + + /** + * Removes the visual template from this element. Returns pointer to the removed visual + * template object. The ownership of the visual template object is transferred to the + * caller. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVisualTemplate* removeVisualTemplate() throw(); + + /** + * Getter for the type identifier of this class. + * + * @since S60 ?S60_version + * @return A descriptor to identify the type of this class. + */ + + /** + * Template getter for interfaces provided by the element classes. + * The type of the queried interface is specified by the + * template parameter. + * + * @since S60 ?S60_version + * @param aElement The element to get the interface for. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + template + static T* makeInterface( AlfElement* aElement ); + +// from base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the element classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + + /** + * removes and destroys all the visuals in the element. + * + * @since S60 ?S60_version + * @param aTimeMilliseconds the animation time for remove. + */ + OSN_IMPORT void removeAndDestroyVisuals( int aTimeMilliseconds ); + + /** + * from IAlfElement + */ + OSN_IMPORT bool contains(CAlfVisual& aVisual) const; + +protected: + + /** + * The protected constructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfElement(); + + /** + * The second phase constructor. + * The element is added to the control. + * + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aControl The owner control. + * @param aName The name of the element. + */ + OSN_IMPORT void construct( CAlfWidgetControl& aControl, const char* aName ); + + /** + * APi to get the control containing the element. + * + * @since S60 ?S60_version + */ + OSN_IMPORT CAlfWidgetControl& control(); + +private: + + int findFromArray( uint aDataID ) const; + +private: // data + + auto_ptr mData; + }; + +#include "alf/alfelement.inl" + + } // namespace Alf +#endif // ALFELEMENT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfflowlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfflowlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2007 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: Flow Layout attribute setter Header. +* +*/ + + +#ifndef ALFFLOWLAYOUTATTRIBUTESETTER_H +#define ALFFLOWLAYOUTATTRIBUTESETTER_H + +#include +#include "alf/alfcommonlayoutattributesetter.h" + + +namespace Alf + { + +/** @class AlfFlowLayoutAttributeSetter alfflowlayoutattributesetter.h + * "alf/alfflowlayoutattributesetter.h" + * The implementation of the attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfFlowLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfFlowLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfFlowLayoutAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * + * @exception osncore::AlfVisualException Thrown with the error code + * osncore::EInvalidVisual when supplied visual is not a + * flow layout visual. + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition.Then sends the commands via the + * ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The + * container can hold new values for multiple different attributes, in + * which case several commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + + /** + * AlfCommonLayoutAttributeSetter + * Sets an dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * AlfCommonLayoutAttributeSetter + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidVariantDataType when no data is supplied. + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidAttribute when empty attribute is supplied. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * AlfCommonLayoutAttributeSetter + * Sets an value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * AlfCommonLayoutAttributeSetter + * Sets an value of a static attribute to target visual immediately + * without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +private: // data + }; + + } // namespace Alf + +#endif // ALFFLOWLAYOUTATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfgridlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfgridlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2007 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: Grid layout attribute setter Header. +* +*/ + + +#ifndef ALFGRIDLAYOUTATTRIBUTESETTER_H +#define ALFGRIDLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonlayoutattributesetter.h" + +//osn includes +#include + +namespace Alf + { + +/** @class AlfGridLayoutAttributeSetter alfgridlayoutattributesetter.h "alf/alfgridlayoutattributesetter.h" + * The implementation of the grid attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ + +class AlfGridLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { + +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfGridLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfGridLayoutAttributeSetter(); + + + /** + * Sets the attribute values to the target visual. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidVisual\n + * when supplied visual is not a grid layout visual. + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @deprecated use createAndSendCommands instead. + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @return The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = 0); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If valid pointer, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = 0); + +protected: + /** + * From AlfCommonLayoutAttributeSetter + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * From AlfCommonLayoutAttributeSetter + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @exception osncore::AlfDataException Thrown with the error code osncore::ECommonError\n + * when invalid data is supplied for grid layout. + * @exception osncore::AlfException Thrown with the error code osncore::ECommonError\n + * when there is an exception in setting attributes for grid layout. + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * From AlfCommonLayoutAttributeSetter + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * From AlfCommonLayoutAttributeSetter + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @exception osncore::AlfException Thrown with the error code osncore::ECommonError\n + * when there is an exception in setting attributes for grid layout. + * @exception osncore::AlfAttributeException Thrown with the error code osncore::EInvalidAttribute\n + * when invalid attributes are supplied for grid layout. + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + +private: // data + }; + + } // namespace Alf + +#endif // ALFGRIDLAYOUTATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfimagevisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfimagevisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2007 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: Image visual attribute setter Header. +* +*/ + + +#ifndef ALFIMAGEVISUALATTRIBUTESETTER_H +#define ALFIMAGEVISUALATTRIBUTESETTER_H + +#include +#include "alf/alfcommonvisualattributesetter.h" + +class CAlfImageVisual; + +namespace Alf + { +class AlfImageVisualAttributeSetterImpl; +class IAlfVariantType; +class ResourcePool; + +/** + * @class AlfImageVisualAttributeSetter alfimagevisualattributesetter.h "alf/alfimagevisualattributesetter.h" + * The implementation of the attribute setter for setting image visual attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfImageVisualAttributeSetter : public AlfCommonVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfImageVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfImageVisualAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual + * is not an image visual. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if the data field + * for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aData + * for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code osncore::EIncompleteAttributeValues if an + * attempt is made to set a color attribute with insufficient data. + * See language specification on how to create this attribute. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if an + * attempt is made to set a color attribute with incompatible data types. + * See language specification on how to create this attribute. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if an + * attempt is made to set a drop shadow attribute with incompatible data. + * See language specification on how to create this attribute. + * @exception osncore::AlfDataException Thrown with Symbian error code if the skin animation ID cannot be retreived + * while setting an animated skin image. + * @exception osncore::AlfDataException Thrown with Symbian error code if the skin frame ID cannot be retreived + * while setting an skin frame image. + * @exception osncore::ThemeException Thrown when skinid is not found. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership. + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * From AlfCommonVisualAttributeSetter + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + +private: + /** + * Sets FrameImage for aVisual using the frame skin id stored in aAttr + * + * @param aVisual The target visual. Doesn't take ownership + * @param aSkinFrameImage LogicalName for the frame image. Ownership of the object is not transferred + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData datamap used in staticdata case. Ownership of the object is not transferred. + * + * @exception osncore::ThemeException Thrown when SkinId is not found. + */ + void setFrameImage(CAlfVisual& aVisual,const Utf8* aSkinFrameID, const AlfAttributeContainer& aContainer,IAlfMap* aData=NULL); + /** + * Gets the attribute value based on whether attribute type is static or staticdata. + * + * @param aAttr The attribute to process. Doesn't take ownership. + * @param aData datamap used in staticdata case. Doesn't take ownership + * + * @return returns the attributeValue.. + */ + int getValueFromAttribute(const AlfAttribute& aAttr,IAlfMap* aData) const; + + void HandleImagePathAttribute( + const TPtrC8& aStringValue, + CAlfImageVisual* aImageVisual, + bool aPrimary ); + +private: // data + auto_ptr mImpl; + }; + + } // namespace Alf + +#endif // ALFIMAGEVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alflctanchorlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alflctanchorlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2007 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: Lct anchor layout attribute setter Header +* +*/ + + +#ifndef ALFLCTANCHORLAYOUTATTRIBUTESETTER_H +#define ALFLCTANCHORLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfanchorlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + +/** + * @class AlfLCTAnchorLayoutAttributeSetter alflctanchorlayoutattributesetter.h "alf/alflctanchorlayoutattributesetter.h" + * The implementation of the attribute setter for setting lct anchor layout attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfLCTAnchorLayoutAttributeSetter : public AlfAnchorLayoutAttributeSetter + { + +public: + + /** + * Constructor. + * + */ + OSN_IMPORT AlfLCTAnchorLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfLCTAnchorLayoutAttributeSetter(); + + /** + * Sets an attribute value in the target visual immediately without a transition. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not + * an lct anchor layout. + * @exception osncore::AlfVisualException Thrown with Symbian error code if anchor point attachment fails. + * @exception std::bad_alloc + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + OSN_IMPORT virtual void setAttributeValue (CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the + * value specific by aContainer to the corresponding + * attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand (CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, IAlfMap* aData, + int aTransitionTime = 0, CAlfVisual* aRefVisual = 0 ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition. Then sends the commands via the + * ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not + * transferred. The container can hold new values for + * multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands (CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, CAlfVisual* aRefVisual = 0 ); + + +protected: + /** + * Sets a dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +private: // data + }; + + } // namespace Alf + +#endif // ALFLCTANCHORLAYOUTATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alflctgridlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alflctgridlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2007 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: LCT grid layout attribute setter header. +* +*/ + + +#ifndef ALFLCTGRIDLAYOUTATTRIBUTESETTER_H +#define ALFLCTGRIDLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfgridlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + + + +/** + * @class AlfLCTGridLayoutAttributeSetter alflctgridlayoutattributesetter.h "alf/alflctgridlayoutattributesetter.h" + * The implementation of the attribute setter for setting lct grid layout attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfLCTGridLayoutAttributeSetter : public AlfGridLayoutAttributeSetter + { + +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfLCTGridLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfLCTGridLayoutAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not + * an lct grid layout. + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + + +protected: + /** + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer ); + +private: // data + }; + + } // namespace Alf + +#endif // ALFLCTGRIDLAYOUTATTRIBUTESETTER_H +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alflctimagevisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alflctimagevisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007 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: Lct image Visual attribute setter Header. +* +*/ + + +#ifndef ALFLCTIMAGEVISUALATTRIBUTESETTER_H +#define ALFLCTIMAGEVISUALATTRIBUTESETTER_H + +#include "alf/alfimagevisualattributesetter.h" + +namespace Alf + { + +/** @class AlfLctImageVisualAttributeSetter alflctimagevisualattributesetter.h "alf/alflctimagevisualattributesetter.h" + * The implementation of the attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfLctImageVisualAttributeSetter : public AlfImageVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfLctImageVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfLctImageVisualAttributeSetter(); + +// from base class MAlfAttributeSetter + + /** + * Creates a command to change the value of an attribute in the target visual + * gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData, + int aTransitionTime = 0, CAlfVisual* aRefVisual = NULL); + + /** + * Creates commands to change the given attribute values in the target visual + * gradually with a transition.Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands(CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, CAlfVisual* aRefVisual = NULL); + +protected: + + /** + * Sets an dynamic attribute value in the target visual + * using transitions defined in attributes. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value for dynamic attribute value in the target visual + * using transitions and data in map. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value of a static attribute to target visual immediately + * without a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + +private: // data + }; + + } // namespace Alf + +#endif // ALFLCTIMAGEVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alflcttextvisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alflcttextvisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 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: Text visual attribute setter header. +* +*/ + + +#ifndef ALFLCTTEXTVISUALATTRIBUTESETTER_H +#define ALFLCTTEXTVISUALATTRIBUTESETTER_H + +#include "alf/alftextvisualattributesetter.h" + +namespace Alf + { + +/** @class AlfLctTextVisualAttributeSetter alflcttextvisualattributesetter.h "alf/alflcttextvisualattributesetter.h" + * The implementation of the attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfLctTextVisualAttributeSetter : public AlfTextVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfLctTextVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfLctTextVisualAttributeSetter(); + + +// from base class MAlfAttributeSetter + + /** + * Sets the attribute values to the target visual. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidVisual\n + * when supplied visual is not a lct text visual. + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Creates a command to change the value of an attribute in the target visual + * gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData, + int aTransitionTime = 0, CAlfVisual* aRefVisual = NULL); + + /** + * Creates commands to change the given attribute values in the target visual + * gradually with a transition.Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value + * of the attribute is defined by adding the value specific by aContainer + * to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands(CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, CAlfVisual* aRefVisual = NULL); + +protected: + + /** + * Sets an dynamic attribute value in the target visual + * using transitions defined in attributes. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value for dynamic attribute value in the target visual + * using transitions and data in map. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value of a static attribute to target visual immediately + * without a transition. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. + * Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + +private: // data + }; + + } // namespace Alf + +#endif // ALFLCTTEXTVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alflinevisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alflinevisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,267 @@ +/* +* Copyright (c) 2007 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: Line visual attribute setter Header. +* +*/ + + +#ifndef ALFLINEVISUALATTRIBUTESETTER_H +#define ALFLINEVISUALATTRIBUTESETTER_H + +#include +#include "alf/alfcommonvisualattributesetter.h" + +class CAlfCurvePath; +class CAlfLineVisual; + +namespace Alf + { + +class AlfLineVisualAttributeSetterImpl; + +/** @class AlfLineVisualAttributeSetter alflinevisualattributesetter.h + * "alf/alflinevisualattributesetter.h" + * The implementation of the attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfLineVisualAttributeSetter : public AlfCommonVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @exception std::bad_alloc + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfLineVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfLineVisualAttributeSetter(); + + /** + * Sets an attribute value in the target visual immediately without + * a transition. + * + * @exception osncore::AlfVisualException Thrown with the error code + * osncore::EInvalidVisual when supplied visual is not a line visual. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + */ + OSN_IMPORT virtual void setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData); + + /** + * Deprecated! Do not use! + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the + * attribute.Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * @ret The command to gradually change the attribute in the target visual + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding attribute value(s) + * used by the attribute setter. Ownership is not + * transferred. The container can hold new values for + * multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value specific by + * aContainer to the corresponding attribute value in the reference + * visual + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + /** + * Sets an dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleDynamicAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a value for static attribute in the target visual immediately + * without any transition using data in map. + * + * @exception osncore::AlfDataException Thrown with the error code + * osncore::ECommonError when empty attribute for line visual + * is supplied . + * @exception osncore::AlfAttributeException Thrown with the error code + * osncore::EInvalidAttribute when wrong attribute for line visual + * is supplied . + * @exception osncore::AlfAttributeException Thrown with the error code + * osncore::EIncompleteAttributeValues when all values of an attribute + * for line visual are not supplied . + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ); + + /** + * Sets a value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @exception osncore::AlfDataException Thrown with the error code + * osncore::ECommonError when empty attribute for line visual + * is supplied . + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ); + + /** + * Sets a value of a static attribute to target visual immediately without + * any transition. + * + * @exception osncore::AlfAttributeException Thrown with the error code + * osncore::EInvalidAttribute when wrong attribute data for line visual + * is supplied . + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleStaticAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +private: + + /** + * Creates and returns a toolkit defined mappping function based on the + * attribute content. + * The int value-mapping function mapping is the following: + * 0 - KConstMappingFunction + * 1 - KLinearMappingFunction + * 2 - KSineMappingFunction + * 3 - KCosineMappingFunction + * @param aAttribute Attribute containing the deciding int value and data + * required for construction of the mapping function. + * @param aEnv Environment + * @result The mapping function pointer + */ + MAlfMappingFunction* getMappingFunction( + AlfAttribute& aAttribute , + CAlfEnv& aEnv); + + /** + * Creates and returns a toolkit defined mappping function based on the + * container content. + * The int value-mapping function mapping is the following: + * 0 - KConstMappingFunction + * 1 - KLinearMappingFunction + * 2 - KSineMappingFunction + * 3 - KCosineMappingFunction + * @param aContainer Container containing the deciding int value and data + * required for construction of the mapping function. + * @param aEnv Environment + * @result The mapping function pointer + */ + MAlfMappingFunction* getMappingFunctionFromContainer( + IAlfContainer* aContainer, + CAlfEnv& aEnv); + + + /** + * Gets the path from the line visual or creates it if does not exist + * @param aLineVisual Line Visual + * @result The curvepath + */ + CAlfCurvePath* getCurvePath(CAlfLineVisual* aLineVisual); + + /** + * Check if data in the attribute is int or float. + * Return the value as a float value + * + * @param aAttr The attribute containing the value + * @param aIndex The index of the value to be checked + * return Content of the attribute + */ + float floatOrInt(const AlfAttribute& aAttr, int aIndex); + + /** + * Check if data in the variant type is int or float. + * Return the value as a float value + * + * @param aData The variant type containing the value + * return Content of the variant type + */ + float floatOrIntFromData(IAlfVariantType* aData); + + + +private: // data + auto_ptr mImpl; + }; + + } // namespace Alf + +#endif // ALFLINEVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfmeshvisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfmeshvisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2007 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: Mesh visual attribute setter header. +* +*/ + + +#ifndef ALFMESHVISUALATTRIBUTESETTER_H +#define ALFMESHVISUALATTRIBUTESETTER_H + +#include +#include "alf/alfcommonvisualattributesetter.h" + +class CAlfMeshVisual; + +namespace Alf + { +class AlfMeshVisualAttributeSetterImpl; +class AlfAttribute; + +/** @class AlfMeshVisualAttributeSetter alfmeshvisualattributesetter.h "alf/alfmeshvisualattributesetter.h" + * The implementation of the attribute setter. + * + * @interfaces IAlfAttributeSetter + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfMeshVisualAttributeSetter : public AlfCommonVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @exception std::bad_alloc + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfMeshVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfMeshVisualAttributeSetter(); + + /** + * Sets an attribute value in the target visual . + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidVisual\n + * when supplied visual is not a Mesh visual. + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidVariantDataType\n + * when no data for line visual is supplied. + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidAttribute\n + * when wrong data for line visual is supplied. + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData); + + /** + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * @ret The command to gradually change the attribute in the target visual + */ + OSN_IMPORT virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition.Then sends the commands via the + * ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute + * value(s) used by the attribute setter. Ownership + * is not transferred. The container can hold new values + * for multiple different attributes, in which case + * several commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + +protected: + + /** + * Sets an dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets an value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +private: + + /** + * Sets an dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aImmediate if true, the change is immediate and time value of + * the attribute is not used. + */ + bool doHandleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, bool aImmediate = false); + + + /** + * Sets an value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + * @param aImmediate if true, the change is immediate and time value of + * the attribute is not used. + */ + bool doHandleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate = false); + + /** + * Gets the data from map pointed by attribute's field name. + * + * @param aAttr The attribute to process. Doesn't take ownership + * @param aData Contains data.Ownership of the object is not transferred. + * + * @return pointer to the data from map pointed by attribute's field name. + */ + IAlfVariantType* getData(AlfAttribute& aAttr, IAlfMap* aData); + + /** + * gets the time from attribute safely. + * + * @param aAttr The attribute to process. Doesn't take ownership + * @param aImmediate if true, returns 0 else the time set for the attribute + */ + int getTime(const AlfAttribute& aAttr, bool aImmediate = false); + + enum imageCategory + { + primary, + secondary, + specular + }; + + void HandleImagePathAttribute( + const TPtrC8& aStringValue, + CAlfMeshVisual* aImageVisual, + imageCategory aImageCategory ); + +private: // data + auto_ptr mImpl; + + }; + + } // namespace Alf + +#endif // ALFMESHVISUALATTRIBUTESETTER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfmodeloperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfmodeloperation.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + + +#ifndef ALFMODELOPERATION_H +#define ALFMODELOPERATION_H + + +//INCLUDES +#include +#include + +using namespace osncore; + +namespace Alf + { + +/* Forward declarations*/ +class IAlfVariantType; + +/** @class AlfModelOperation alfmodeloperation.h "alf/alfmodeloperation.h" +* A class for storing information about changes in the model. +* CAlfModelOperation can be used to make changes in a batch mode, +* i.e., executing multiple changes in one call. +* @lib hitchcockwidgetmodel.lib +* @since S60 ?S60_version +* @status Draft +*/ +class AlfModelOperation + { +public: + + /** The operation constants. */ + enum OperationType{EOperationAdd, EOperationRemove, EOperationUpdate}; + + /** + * constructor. The new operation is left on the cleanup stack. + * + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aOperation The operation to be performed. + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct location + * in the data hierarchy. The ownership is transferred. + * @param aData The new data in EOperationAdd and EOperationUpdate operations. + * The ownership is transferred. + */ + OSN_IMPORT static AlfModelOperation* create( OperationType aOperation, + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData = 0 ); + + /** + * constructor for adding or updating a map item. + * The new operation is left on the cleanup stack. + * + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aOperation The operation to be performed. + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct location + * in the data hierarchy. The ownership is transferred. + * @param aData The new data. The ownership is transferred. + * @param aDataName The name of the new data in EOperationAdd and EOperationUpdate + * operations. Only needed when adding or updating a map item. + */ + OSN_IMPORT static AlfModelOperation* create( OperationType aOperation, + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData, + const UString& aDataName ); + + /** Destructor.*/ + OSN_IMPORT ~AlfModelOperation(); + + /** + * Get the name of the new data field in the container map. + * Panics if the operation is EOperationRemove. + * + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidModelOperation\n + * when wrong operation is performed on Model. + * @return The new data. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& newDataName() const; + + /** + * Get the new data used in EOperationAdd or EOperationUpdate operations. + * Panics if the operation is EOperationRemove. + * + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidModelOperation\n + * when wrong operation is performed on Model. + * @return The new data. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType& newData() const; + + /** + * Get the new data used in EOperationAdd or EOperationUpdate operations. + * Panics if the operation is EOperationRemove. + * The ownership of the data is transferred to the caller, + * and the data of this operation is set to NULL. + * + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidModelOperation\n + * when wrong operation is performed on Model. + * @return The new data. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* getNewData(); + + /** + * Get the Operation. + * + * @return The new data. + * @since S60 ?S60_version + */ + OSN_IMPORT AlfModelOperation::OperationType operation() const; + + /** + * Get the parent data for the operation. The parent data + * is a container for the data to be added, removed or updated. + * The index of the data can be queried using Index(). + * + * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidContainerOperation\n + * when wrong operation is performed on Model. + * @param aRoot The root of the data hierarchy to perform the operation. + * @return The parent data. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* parentData(IAlfVariantType& aRoot ) const; + + /** + * Get the index of the data inside the parent container. + * The parent container can be queried using ParentData(). + * If the parent container is a branch, index 0 refers to + * the branch data, and index 1 refers to the child data. + * + * @return The new data. + * @since S60 ?S60_version + */ + OSN_IMPORT int index() const; + + /** + * Get the number of container indices to find the + * location in the data hierarchy. + * + * @return The number of container indices. + * @since S60 ?S60_version + */ + OSN_IMPORT int numContainerIndices() const; + + /** + * Get the container index to traverse through the data hierarchy. + * If the container in the hierarchy is a branch, index 0 refers to + * the branch data, and index 1 refers to the child data. + * + * @return The container index. + * @since S60 ?S60_version + */ + OSN_IMPORT int containerIndex( int aIndex ) const; + +private: + + AlfModelOperation( + OperationType aOperation, + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData = 0 ); + + AlfModelOperation( + OperationType aOperation, + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData, + const UString& aDataName ); + +private: // data + + // Target location in the data hierarchy + int mNumContainerIndices; + int* mContainerIndices; + + // The new data + IAlfVariantType* mData; + // The name of the new data, if adding or updating a map item + UString mDataName; + + // The operation to be performed + OperationType mOperation; + }; + + } // namespace Alf + +#endif // ALFMODELOPERATION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfrecyclinggridelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfrecyclinggridelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + + +#ifndef ALF_RECYCLINGGRIDELEMENT_H +#define ALF_RECYCLINGGRIDELEMENT_H + + +//INCLUDES +#include // TPoint +#include +#include "alf/alfelement.h" +#include + +class CAlfControl; + + +namespace Alf + { +class CAlfWidgetControl; +class AlfRecyclingGridElementImpl; + +namespace alfrecyclinggridelement + { +static const IfId Ident= + { + 0,"alfrecyclinggridelement" + }; + } + +/** @class AlfRecyclingGridElement alfrecyclinggridelement.h "alf/alfrecyclinggridelement.h" + * The implementation of a generic element with a functionality + * for recyclign the created visual trees. This is commonly used + * in scrolling list-like components, where only few of the items + * are visible at the same time. Scrolling is supported in both + * dimensions (rows / columns). + * + * @interfaces IAlfElement + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfRecyclingGridElement : public AlfElement, public IAlfWidgetEventHandler + { +public: + static inline const IfId& type() + { + return alfrecyclinggridelement::Ident; + } + /** + * Enumerations of the Fill Style + */ + OSN_IMPORT enum FillStyle{EColumnsFirst, ERowsFirst}; + + + + /** + * Constructor. + * @exception std::bad_alloc + * @param aControl - Widget Control + * @param aName - Name of the Recycling grid element + * @param aNumColumns - Number of Columns + * @param aNumRows - Number of Rows + * @since S60 ?S60_version + * @return New object. The widgets are owned by Alfred. The objects is pushed on to the cleanup stack + */ + OSN_IMPORT AlfRecyclingGridElement(CAlfWidgetControl& aControl, const char* aName, int aNumColumns, int aNumRows); + + + /** Class Destructor estructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT virtual ~AlfRecyclingGridElement(); + + /** + * Constructor. + * @param aFillStyle - style to be used to fill the grid + * @param aFillStyleParam - + * @since S60 ?S60_version + * @return New object. The widgets are owned by Alfred. The objects is pushed on to the cleanup stack + */ + OSN_IMPORT void setFillStyle(FillStyle aFillStyle, int aFillStyleParam); + /* + * Sets the animation times for diferent visual changes + * @param aScrollingTime - animation time while scrolling + * @param aFadeInTime - amination time for fading in + * @param aFadeinDelay - a delay time after which fade in starts + * @param aFadeOutTime - animation time for fading out + * @param aFadeOutDelay - a delay time after which fade out will start + */ + + OSN_IMPORT void setAnimationTimes( int aScrollingTime, + int aFadeInTime, int aFadeInDelay, + int aFadeOutTime, int aFadeOutDelay ); + + /** + * Creates a visual tree with the data given for visuals. + * + * @exception std::bad_alloc + * @exception osncore::AlfVisualException Thrown with the error code osncore::ECanNotCreateVisual\n + * when creation of visual fails. + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when wrond data id is supplied. + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aData Data for visual tree to be created + * @param aDataID Parent visual tree's data id + * @param aParentLayout Parent layout to which newly created visual tree will be added + * @param aLayoutIndex Position in parent layout at which new visual tree will be added + */ + + OSN_IMPORT virtual CAlfVisual* createVisualTree( + IAlfVariantType& aData, uint aDataID, + CAlfLayout* aParentLayout, int aLayoutIndex ); + + //Implementation of IAlfWidgetEventHandler + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. Pointer event handlers cannot be + * identified directly, since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * + * @since S60 ?S60_version + * @param aEvent The event. + * @return ETrue if the event can be processed. Otherwise EFalse. + */ + OSN_IMPORT virtual bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return Result of event processing. See AlfEventStatus. + */ + OSN_IMPORT AlfEventStatus offerEvent( CAlfWidgetControl& aControl,const TAlfEvent& aEvent ); + + /** + * @see MAlfWidgetEventHandler + */ + OSN_IMPORT void setActiveStates( unsigned int aStates ); + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * + * @param aData A data structure which contains for example id of the event + * handler. + */ + OSN_IMPORT void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + /** + * Returns AlfWidgetEventHandlerInitData. + * + * @return A pointer to AlfWidgetEventHandlerInitData structure which contains + * for example id of the event handler. + */ + OSN_IMPORT AlfWidgetEventHandlerInitData* eventHandlerData(); + + /** + * Returns the type of EventHandler. + * @see IAlfWidgetEventHandler::AlfEventHandlerType + * + * @return The type of event handler. + */ + IAlfWidgetEventHandler::AlfEventHandlerType eventHandlerType(); + + /** + * Returns information about the phase in the event handling cycle in + * which the event hadler will be executed. + * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + * + * @return Event handler execution phase. + */ + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase eventExecutionPhase(); + + /** + * From @see MAlfInterfaceBase. + * @since S60 ?S60_version + * @param aType The type of interface requested. + * @return Returns the new Interface + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + + + /** + * Creates a visual tree with the data given for visuals. + * + * @exception std::bad_alloc + * @exception osncore::AlfVisualException Thrown with the error code osncore::ECanNotCreateVisual\n + * when creation of visual fails. + * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n + * when wrond data id is supplied. + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aData Data for visual tree to be created + * @param aDataID Parent visual tree's data id + * @param aParentLayout Parent layout to which newly created visual tree will be added + * @param aLayoutIndex Position in parent layout at which new visual tree will be added + */ + OSN_IMPORT virtual void createChildVisualTree( IAlfElement* aElement, + IAlfVariantType& aChildData, + IAlfBranch& aData, + int aIndex, uint aDataID ); + /** + * Removes visual tree from given element. + * + * @since S60 ?S60_version + * @param aElement Element from which visual tree is to be removed + * @param aData + * @param aIndex + * @param aDataID + */ + OSN_IMPORT virtual void removeChildVisualTree( IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ); + + /** + * removes and destroys all the visuals. + * + * @param aTimeMilliseconds animation time for remove. + */ + OSN_IMPORT void removeAndDestroyVisuals( int aTimeMilliseconds ); + +private: + friend class AlfRecyclingGridElementImpl; + auto_ptr mImpl; + }; + + } // namespace + +#endif // ALF_RECYCLINGGRIDELEMENT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfreferencetovisual.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfreferencetovisual.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2007 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: Visual class for alfred widget model. + This class queries the visual by name and ID. +* +*/ + + +#ifndef ALFREFERENCETOVISUAL_H +#define ALFREFERENCETOVISUAL_H + +//INCLUDES +#include +#include +// FORWARD DECLARATIONS +class CAlfControl; +class CAlfVisual; + + +using namespace osncore; + +namespace Alf + { +class CAlfWidgetControl; + +/** @class AlfReferenceToVisual alfreferencetovisual.h "alf/alfreferencetovisual.h" + * A class for finding a specific visual according to + * the name of the visual, name of the parent element, + * and the associated data ID. The number of visual + * trees created by an element may depend on the data. + * Therefore, the visual structure is not always known + * beforehand. CAlfControl::FindElement() and MAlfElement::FindVisual + * can be used to find elements and visuals even in dynamic + * conditions. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfReferenceToVisual + { +public: + + /** + * constructor. + * + * @exception std::bad_alloc + * @since S60 ?S60_version + * @param aElementName The name of the element that is responsible + * for creating the visual. + * @param aVisualName The name of the visual. + * @param aUseDataID Deprecated and not used. The given data ID is always + * used when resolving the visual. Only if the visual is not found with + * the given data ID, then the data ID zero is tested for global visuals. + * @return New object. + */ + OSN_IMPORT static AlfReferenceToVisual* create( + const char* aElementName,const char* aVisualName, bool aUseDataID); + + /** Destructor. No derived classes, therefore not virtual. */ + OSN_IMPORT ~AlfReferenceToVisual(); + + + /** + * Find the referenced visual according to the given data ID. + * + * @exception osncore::AlfVisualException Thrown with the error code osncore::ECommonError\n + * when some operation performed on visual fails. + * @since S60 ?S60_version + * @param aControl The control containing the associated element. + * @param aDataID The data ID used to create the visual. The caller + * is responsible for determining what data ID + * is related to this reference. If the visual is not found with + * the given data ID, then the data ID zero is tried for global visuals. + * @return The resolved visual. + */ + OSN_IMPORT CAlfVisual* resolve(CAlfWidgetControl& aControl, unsigned int aDataID); + + /** + * Finds the referenced visual according to given pointer to visual + * + * @since S60 ?S60_version + * @param aControl The control containing the associated element. + * @param aSourceVisual Pointer to visual that needs to be queried. + */ + OSN_IMPORT CAlfVisual* resolve(CAlfWidgetControl &aControl, CAlfVisual* aSourceVisual); +private: + /** + * constructor + */ + AlfReferenceToVisual(const char* aElementName,const char* aVisualName, bool aUseDataID); + +private: + // The element name. Owned. + UString mElementName; + // The visual name. Owned. + UString mVisualName; + // The associated data ID. + bool mUseDataID; + }; + + } // namespace Alf + +#endif //ALFREFERENCETOVISUAL_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfsettertype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfsettertype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: Setter type Header. +* +*/ + + +#ifndef ALFSETTERTYPE_H +#define ALFSETTERTYPE_H + +#include + +enum SetterType + { + ECommandAttributeSetter, + EVisualAttributeSetter, + ELayoutAttributeSetter, + EWidgetAttributeSetter, + ECustomAttributeSetter + }; + +#endif // ALFSETTERTYPE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alftextvisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alftextvisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2007 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: Text visual attribute setter Header. +* +*/ + + +#ifndef ALFTEXTVISUALATTRIBUTESETTER_H +#define ALFTEXTVISUALATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonvisualattributesetter.h" + +//osn includes +#include + +namespace Alf + { + +/** + * @class AlfTextVisualAttributeSetter alftextvisualattributesetter.h "alf/alftextvisualattributesetter.h" + * The implementation of the attribute setter for setting text visual attributes. + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfTextVisualAttributeSetter : public AlfCommonVisualAttributeSetter + { + +public: + + /** + * Constructor. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not + * a text visual. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if the data field + * for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aData + * for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if setting of text color + * from skin fails. + * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if there are + * invalid number or type of attributes while attempting to set text color. + * See language specification on how to create these attributes. + * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if setting text to the + * text visual fails. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aData + * for data attributes is 0. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT AlfTextVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfTextVisualAttributeSetter(); + + /** + * Sets the attribute values to the target visual. + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the value of the attributes. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); +protected: + + /** + * From CAlfCommonVisualAttributeSetter + * Sets an value of a static attribute to target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * From CAlfCommonVisualAttributeSetter + * Sets an dynamic attribute value in the target visual using transitions defined in attributes + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + */ + virtual void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); + + /** + * From CAlfCommonVisualAttributeSetter + * Sets an value for static attribute in the target visual immediately without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * From CAlfCommonVisualAttributeSetter + * Sets an value for dynamic attribute value in the target visual using transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); + +private: // data + + /** + * Localisation attribute setter helper method. Helper Method. + * + * @aLocId localisationid defined in .loc files. + * @aLang Required language for the text. + * + */ + + void setLocalisedText(CAlfVisual& aVisual,const char* aLocId,AlfAttribute* aLangAttr,AlfAttribute* aVarArgsAttr); + + /** + * Helper method to set Text Visual color. + * + * @aTextVisual TextVisual to which Color has to be set. + * @aColorTable Logicalname for colortable. + * @aColorIndex Color Index for the colortable. + * + * @exception osncore::ThemeException Thrown when skinID is not found. + * + */ + void setTextSkinColor(CAlfTextVisual& aTextVisual, const Utf8* aColorTable, + const char* aColorIndex=NULL); + + }; + + } // namespace Alf + +#endif // ALFIMAGEVISUALATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfviewportlayoutattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfviewportlayoutattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2007 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: Viewport layout attribute setter header. +* +*/ + + +#ifndef ALFVIEWPORTLAYOUTATTRIBUTESETTER_H +#define ALFVIEWPORTLAYOUTATTRIBUTESETTER_H + +//includes + +//widget model includes +#include "alf/alfcommonlayoutattributesetter.h" + +//osn includes +#include + + +namespace Alf + { + +/** + * @class AlfViewportLayoutAttributeSetter alfviewportlayoutattributesetter.h + * "alf/alfviewportlayoutattributesetter.h" + * + * The implementation of the attribute setter for setting viewport + * layout attributes. + * + * @see IAlfAttributeSetter + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfAttributeSetter + */ +class AlfViewportLayoutAttributeSetter : public AlfCommonLayoutAttributeSetter + { + +public: + + /** + * Constructor. + */ + OSN_IMPORT AlfViewportLayoutAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfViewportLayoutAttributeSetter(); + + + /** + * Sets an attribute value in the target visual immediately without a transition. + * @exception osncore::AlfVisualException Thrown with error code + * osncore::EInvalidVisual if aVisual is not viewport layout. + * @exception osncore::AlfDataException Thrown with error code + * osncore::EInvalidVariantDataType if aData for data attributes is 0. + * @exception osncore::AlfDataException Thrown with error code + * osncore::EIncompleteAttributeValues if the aContainer contains an + * incomplete set of attributes. See language specification on creating + * attributes for viewport layout. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Used with data attributes to fetch the data. + */ + OSN_IMPORT virtual void setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + /** + * Depracated! Do not use! + * Creates a command to change the value of an attribute in the target + * visual gradually with a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value + * specific by aContainer to the corresponding attribute + * value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + OSN_IMPORT virtual TAlfCommand* createCommand ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ); + + /** + * Creates commands to change the given attribute values in the target + * visual gradually with a transition. Then sends the commands via the + * ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred.The + * container can hold new values for multiple different attributes, in + * which case several commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target + * value of the attribute is defined by adding the value specific by + * aContainer to the corresponding attribute value in the reference + * visual. + */ + OSN_IMPORT virtual void createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ); + + +protected: + + /** + * Sets a dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + */ + virtual void handleDynamicAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + /** + * Sets a value for static attribute in the target visual immediately + * without a transition using data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticDataAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ); + + /** + * Sets a value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleDynamicDataAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData); + + /** + * Sets a value of a static attribute to target visual immediately without + * a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + */ + virtual void handleStaticAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +private: + + /** + * Sets a dynamic attribute value in the target visual using transitions + * defined in attributes + * + * @since S60 ?S60_version + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aImmediate if true, the change is immediate and time value of + * the attribute is not used. + */ + bool doHandleDynamicAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, bool aImmediate = false); + + /** + * Sets a value for dynamic attribute value in the target visual using + * transitions and data in map. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aAttr The attribute to process. Doesn't take ownership + * @param aContainer The container holding attributes. Ownership of the + * object is not transferred. + * @param aData Contains data.Ownership of the object is not transferred. + * @param aImmediate if true, the change is immediate and time value of + * the attribute is not used. + */ + bool doHandleDynamicDataAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData, + bool aImmediate = false); + + /** + * Gets the data from map pointed by attribute's field name. + * + * @param aAttr The attribute to process. Doesn't take ownership + * @param aData Contains data.Ownership of the object is not transferred. + * + * @return pointer to the data from map pointed by attribute's field name. + */ + IAlfVariantType* getData(AlfAttribute& aAttr, IAlfMap* aData); + + /** + * gets the time from attribute safely. + * + * @param aAttr The attribute to process. Doesn't take ownership + * @param aImmediate if true, returns 0 else the time set for the attribute + */ + int getTime(const AlfAttribute& aAttr, bool aImmediate = false); + +private: // data + }; + + } // namespace Alf + +#endif // ALFVIEWPORTLAYOUTATTRIBUTESETTER_H +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfvisualtemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfvisualtemplate.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,651 @@ +/* +* Copyright (c) 2007 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: Visual template class for alfred widget model. +* This class creates and updates visual tree. +* +*/ + + +#ifndef ALF_VISUALTEMPLATE_H +#define ALF_VISUALTEMPLATE_H + +#include +#include +#include "alf/ialfvisualtemplate.h" +#include +#include +#include +#include + +class CAlfControl; +class CAlfBrush; +class CAlfVisual; + +using namespace osncore; + +namespace Alf + { +// FORWARD DECLARATIONS +class IAlfMap; +class IAlfAttributeSetter; +class AlfAttributeContainer; + +/** + * @class AlfVisualTemplate alfvisualtemplate.h "alf/alfvisualtemplate.h" + * A generic visual template for creating or updating a visual tree. + * The visual templates may form a tree structure that matches + * the visual tree to be created or updated. Each template is + * responsible for creating and initializing a single visual. + * Visual templates contain a number of attribute setters + * to initialize or update the visuals. Attribute setters use values + * from the corresponding attribute containers. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfVisualTemplate + */ +class AlfVisualTemplate : public IAlfVisualTemplate + { +public: + + /** + * Constructor for a template for creating a visual. + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * + * @param aType The type of the visual to create. + */ + OSN_IMPORT static AlfVisualTemplate* create(TAlfVisualType aType); + + /** + * Constructor for a template for creating a layout. + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * + * @param aType The type of the layout to create. + */ + OSN_IMPORT static AlfVisualTemplate* create(TAlfLayoutType aType); + + /** + * Constructor for an empty template. + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * + */ + OSN_IMPORT static AlfVisualTemplate* create(); + + // Destructor. + OSN_IMPORT virtual ~AlfVisualTemplate(); + + //From IAlfVisualTemplate + + /** + * Sets the owner element. User should not call this method directly. It will + * be called implicitly by Alf::IAlfElement::setVisualTemplate() method. + * Call to this method cannot throw an exception. + * + * @see Alf::IAlfElement::setVisualTemplate() + * + * @since S60 ?S60_version + * + * @param aOwner Element that owns this root visual template. + */ + OSN_IMPORT void setOwner(IAlfElement* aElement) throw(); + + /** + * Returns the owner element. Call to this method cannot + * throw an exception. + * + * @see Alf::IAlfElement::setVisualTemplate() + * + * @since S60 ?S60_version + * + * @return The owner element of a visual template, if this visual template is owned + * by an element. NULL if visual template is not owned by an element. + */ + OSN_IMPORT IAlfElement* owner() const throw(); + + /** + * Set name of the visual. This name is used when creating + * concrete visual trees. Name is assigned to each of the produced concrete + * visuals as a tag. Note thus that all concrete visual + * trees produced from this visual template share the same tag. + * + * @see name() + * + * @exception std::bad_alloc thrown if heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aName The name of the visual. + */ + OSN_IMPORT void setName(const char* aName); + + /** + * Returns the name of the visual. Call to this method + * cannot throw an exception. + * + * @see setName() + * + * @since S60 ?S60_version + * + * @return aName The name of the visual. + */ + OSN_IMPORT const char* name() const throw(); + + /** + * Get the number of child visual templates. + * This returns the number of child visual templates directly + * under this visual template in the visual template + * hierarchy. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return The number of direct child visual templates + * under this visual template in the visual template hierarchy. + */ + OSN_IMPORT int numChildTemplates() const throw(); + + /** + * Returns a child visual template at a given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the child visual template. + * + * @return Reference to the child visual template object. + */ + OSN_IMPORT IAlfVisualTemplate& childTemplate(int aIndex) const; + + /** + * Add a child visual template. The visual templates may form + * a tree structure to create and update a visual tree. The visuals + * created by children are added to the layout created by this + * visual template. This visual template acquires the ownership for the + * child visual template passed as an argument. + * + * If a visual template added as a child to this visual template is owned + * by an Alf::IAlfElement the connection between the child visual template + * and its owner element is implicitly removed in this call when a + * parent-child connection is created. Effectively having a parent visual + * template or being owned by an element are mutually exclusive properties + * for a visual template. Elements can own only root visual templates and + * if an owned root visual template becomes a child of another visual + * template the visual template will be removed from the associated owner + * element. + * + * @see insertChildTemplate() + * + * @exception std::bad_alloc Thrown if memory allocation fails in appending the child + * visual template to child array of this visual template. + * @exception osncore::AlfException thrown with error code osncore::EInvalidHierarchy if + * the call to this method would result in an invalid visual template hierarchy. + * This can occur if a child is added to a non-layout visual template or if a + * call would result in a parent becoming a descendant of it's child (a recursive + * tree). + * + * @since S60 ?S60_version + * + * @param aChild Child visual template to be appended to the children of this visual template. + */ + OSN_IMPORT void addChildTemplate(IAlfVisualTemplate& aChild); + + /** + * Inserts a child visual template at given index. The visual templates may form + * a tree structure to create and update a concrete visual tree. The concrete visuals + * created by children are added to the layout created by this + * visual template. This visual template acquires the ownership of the inserted + * child visual template. + * + * @see addChildTemplate() + * + * @exception std::bad_alloc thrown if memory allocation fails in inserting the child visual + * template to the child list of this visual template. + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex when + * index supplied is out of range for array of visual templates. + * @exception osncore::AlfException thrown with error code osncore::EInvalidHierarchy if + * the call to this method would result in an invalid visual template hierarchy. + * This can occur if a child is added to a non-layout visual template or if a + * call would result in a parent becoming a descendant of it's child (a recursive + * tree) or if the same child visual template is added to the hierarchy twice. + * + * @since S60 ?S60_version + * + * @param aChild The child visual template. + * @param aIndex Position at which child template is to be added. + */ + OSN_IMPORT void insertChildTemplate(IAlfVisualTemplate& aChild, int aIndex); + + /** + * Removes and destroyes a child visual template from an index in the child list + * of this visual template. This will recursively also destroy all child visual templates + * in the hierarchy below the destroyed child visual template. This call is silently + * ignored if the index is out of bounds. Call to this method cannot throw an + * exception. + * + * @since S60 ?S60_version + * + * @param aIndex Position from which child visual template is to be removed. + */ + OSN_IMPORT void destroyChildTemplate(int aIndex) throw(); + + /** + * Destroyes a child visual template with the given name and removes it from the children + * of this visual template. This will recursively also destroy all child visual templates + * in the hierarchy below the destroyed child visual template. This call is silently + * ignored if a child visual template with the given name is not found. Call + * to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @param aName Name of child visual template to be destroyed. + */ + OSN_IMPORT void destroyChildTemplate(const char* aName) throw(); + + /** + * Add a new attribute setter and associated attribute container to set visual attributes + * of the concrete visual hierarchies created or updated with this visual template hierarchy. + * This visual template object acquires ownership of both the passed attribute setter as well + * as the attribute container. Attribute containers in a visual template are iterated through + * whenever concrete visual trees are created or updated. Concrete visual tree attributes + * are set from the data passed in through the createVisualTree() and updateVisualTree() methods + * using the attribute setters and containers added into the visual template using this method. + * + * @see createVisualTree() + * @see updateVisualTree() + * + * @exception std::bad_alloc thrown if heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aSetter Attribute setter that will be used to set the attributes in the passed in + * container to concrete visuals. + * @param aContainer Container holding the attribute value used by the attribute setter. + */ + OSN_IMPORT void addAttributeSetter(IAlfAttributeSetter* aSetter, + AlfAttributeContainer* aContainer); + + /** + * Get the number of the attribute setters and the corresponding attribute containers. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return The number of the attribute setters and containers. + */ + OSN_IMPORT int numAttributeSetters() const throw(); + + /** + * Returns an attribute setter maintained in this visual template from the given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the visual attribute setter. + * @return Reference to the attribute setter object. + */ + OSN_IMPORT IAlfAttributeSetter& attributeSetter( int aIndex ) const; + + /** + * Returns an attribute container maintained in this visual template from the given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the visual attribute container. + * @return Reference to the attribute container object. + */ + OSN_IMPORT AlfAttributeContainer& attributeContainer( int aIndex ) const; + + /** + * Update an existing concrete visual tree with new values. The existing visual tree + * should be produced from this visual template hierarchy using the createVisualTree() - + * method. + * + * @see createVisualTree() + * @see setSelectChildMode() + * @see addAttributeSetter() + * + * @since S60 ?S60_version + * + * @param aData A map containing new data for the visuals. + * @param aOldData Old data, that will be replaced. This is used to for instance tear down + * the old selected child branch before creating a new branch in the selected + * child mode. + * @param aVisual The root of the concrete visual tree that will be updated. This root visual + * needs to match this visual template and should have been created using this + * visual template. + * @return Root visual of the updated concrete visual tree. + */ + OSN_IMPORT CAlfVisual* updateVisualTree(IAlfMap* aData, + IAlfMap* aOldData, CAlfVisual& aVisual); + + /** + * Creates a new concrete visual tree from this visual template hierarchy and initializes the visuals. + * Created visual tree matches the visual template hierarchy under this visual template. + * + * @see updateVisualTree() + * @see setSelectChildMode() + * @see addAttributeSetter() + * + * @since S60 ?S60_version + * + * @param aControl The owner control of the new concrete visual hierarchy. + * @param aData A map containing data for the visuals. This is used to set the attributes of the + * produced concrete visuals using the attribute containers and attribute setters + * added through the addAttributeSetter() - method. + * @param aParentLayout Concrete layout visual to insert the created concrete visual tree into. + * Parent layout for a created visual. + * @param aLayoutIndex Ordinal index, into where the created visual should be placed in the parent layout. + * + * @return Pointer to the root visual object of the concrete visual hierarchy that was constructed. + */ + OSN_IMPORT CAlfVisual* createVisualTree(CAlfControl& aControl, + IAlfMap* aData, CAlfLayout* aParentLayout, int aLayoutIndex); + + /** + * Set the visual type. Every visual template maps to + * one concrete visual or layout type. Each visual template + * node in the visual template hierarchy can produce + * only visuals that match its type. Container nodes + * in the visual template hierarchy map to layouts + * and leaf visual template nodes map to visuals. + * + * Call to this method will make this visual template + * a visual type. The type can thus change from layout + * type to a visual type. + * + * @see setLayoutType() + * @see visualType() + * @see layoutType() + * + * @since S60 ?S60_version + * + * @param aType Type of visual + */ + OSN_IMPORT void setVisualType(TAlfVisualType aType); + + /** + * Get the visual type + * + * @since S60 ?S60_version + * + * @return aType Type of visual + */ + OSN_IMPORT int visualType() const throw(); + + /** + * Set the layout type. Every visual template maps to + * one concrete visual or layout type. Each visual template + * node in the visual template hierarchy can produce + * only visuals that match its type. Container nodes + * in the visual template hierarchy map to layouts + * and leaf visual template nodes map to visuals. + * + * Call to this method will make this visual template + * a layout type. The type can thus change from visual + * producer to a layout producer. + * + * @see setVisualType() + * @see visualType() + * @see layoutType() + * + * @since S60 ?S60_version + * + * @param aType Type of layout + */ + OSN_IMPORT void setLayoutType(TAlfLayoutType aType); + + /** + * Get the layout type or a negative integer + * if this visual template is of visual type. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return Type of layout that this visual template produces + * or a negative integer if this visual template + * produces visuals. + */ + OSN_IMPORT int layoutType() const throw(); + + /** + * Adds brush to the brush array. + * + * All brushes added to a visual template will be applied to + * the produced concrete visual when one is produced. The same + * brush array is shared across all concrete visual instancies + * created from same visual template. + * + * @see brush() + * @see numBrushes() + * + * @exception std::bad_alloc thrown if a heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aBrush Brush to be added + */ + OSN_IMPORT void addBrush(CAlfBrush& aBrush); + + /** + * Get the munber of brushes + * + * @since S60 ?S60_version + * + * @return The number of brushes + */ + OSN_IMPORT int numBrushes() const; + + /** + * Returns a brush instance from the array of brushes. + * + * @see addBrush() + * @see numBrushes() + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index into the array of brushes. + * + * @return Reference to the brush object instance at the given array index. + */ + OSN_IMPORT CAlfBrush& brush(int aIndex) const; + + /** + * Enables or disables selected child mode. By default + * this is disabled and thus visual template creates or updates + * all its children when createVisualTree() or updateVisualTree() + * is called. If selected child mode is enabled the visual template + * will create or update only the selected child. The child which + * is affected in selected child mode is determined in the data passed + * in the createVisualTree() or updateVisualTree() method. In the + * passed data map a search is done to match the child index + * field name with the keys in the map. If an entry is found its value + * is used as an index to determine the child branch that is to be + * created or updated. + * + * @see createVisualTree() + * @see updateVisualTree() + * + * @since S60 ?S60_version + * + * @param aSelectChild Set to true to enable the child mode or false to disable the child mode. + * @param aChildIndFieldName Key in data map, from which entry the index of + * the selected child is fetched. + */ + OSN_IMPORT void setSelectChildMode(bool aSelectChild, + const UString& aChildIndFieldName ); + + //From IAlfInterfaceBase + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the visual template. + * Derived classes should always call the base class method + * from the overridden makeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + + /** + * Removes the given child visual template from this visual template. + * Call to this method is silently ignored if the given visual template + * is not found from children. The parent template of the removed child + * is set to null. Ownership of the removed child visual template is + * transferred to the caller of this method. Call to this method cannot + * throw an exception. + * + * @see setParent() + * @see parent() + * + * @param aChild Reference to the child visual template that is located + * and removed from this visual template. + */ + void removeChildTemplate(IAlfVisualTemplate& aChild) throw(); + + /** + * Retrieves pointer to the parent visual template. + * Returns NULL if this is a root visual template of a visual template + * hierarchy. Call to this method cannot throw an exception. + * + * @see addChildTemplate() + * @see insertChildTemplate() + * @see Alf::IAlfElement::setVisualTemplate() + * + * @return Pointer to a Alf::IAlfVisualTemplate object that this visual template + * is a child of. + */ + OSN_IMPORT IAlfVisualTemplate* parent() const throw(); + + /** + * Sets the parent visual template. + * + * User should not call this method directly. It will be called implicitly + * by addChildTemplate() or insertChildTemplate() methods of + * the parent visual template into which this visual template is + * added to. + * + * Parent visual template and owner element are mutually exclusive. + * If a visual template is added under another visual template + * in a visual template hierarchy the connection to owner element + * is implicitly removed. Alf::IAlfElement objects can thus own only + * roots of visual template hierarchies. + * + * Call to this method cannot throw an exception. + * + * @see addChildTemplate() + * @see insertChildTemplate() + * @see parent() + * @see Alf::IAlfElement::setVisualTemplate() + * + * @param aParent Pointer to a parent visual template under which this + * visual template is located in in the visual template + * hierarchy or null, if the visual template is removed from + * a visual template hierarchy. + */ + OSN_IMPORT void setParent(IAlfVisualTemplate* aParent) throw(); + +protected: + /** + * c++-constructor for a template for creating a visual. + * + * @since S60 ?S60_version + * + * @param aType The type of the visual to create. + */ + OSN_IMPORT AlfVisualTemplate(TAlfVisualType aType); + + /** + * c++-constructor for a template for creating a layout. + * + * @since S60 ?S60_version + * + * @param aType The type of the layout to create. + */ + OSN_IMPORT AlfVisualTemplate(TAlfLayoutType aType); + + /** + * c++-constructor for an empty template. + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVisualTemplate(); + +private: + /** + * returns the index to child, that should be created. The index is + * fetched from the data. + * + * @since S60 ?S60_version + * + * @param aData data-map, where the index is fetched. + * @return index to child, that should be created. + */ + int selectedChildInd(IAlfMap* aData); + +private: + + // Type of the visual to create. + // Negative values are layout types, positive values visual types. + int mVisualType; + + // The array containing child visual templates. Owned. + std::vector mChildren; + + // The tag of the visual to create. + UString mVisualName; + + // The array containing visual attribute setters. Owned. + AlfPtrVector mAttributeArray; + + // The array containing attribute containers. + AlfPtrVector mContainerArray; + + //The array containing brushes. Owned. + AlfPtrVector mBrushArray; + + //if true, creates only one child visual tree. + bool mSelectOneChild; + + //field name in data where child index is read. + //if iSelectOneChild is true, index points to child in childarray, to create. + UString mChildIndFieldName; + + // Owner element of this visual template. Not owned. + IAlfElement* mOwner; + + // Pointer to the parent visual template. + IAlfVisualTemplate* mParent; + }; + + } // namespace Alf + +#endif //ALF_VISUALTEMPLATE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2007 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: The base class for all widgets. +* +*/ + + +#ifndef ALFWIDGET_H +#define ALFWIDGET_H + +#include +#include +#include +#include +#include "alf/ialfcontainerwidget.h" +#include + +#include + + +class CAlfEnv; +class CAlfDisplay; + +namespace osncore + { +template class AlfPtrVector; + } + +using namespace std; +using namespace osncore; + + +namespace Alf + { + +//class CAlfWidgetControl; +class IAlfModel; +class IAlfWidgetFactory; +class AlfWidgetImpl; + + +/** + * @class AlfWidget alfwidget.h "alf/alfwidget.h" + * The base class for widgets. + * @see IAlfWidget IAlfContainerWidget IAlfHostApi + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfWidget,IAlfAttributeOwner,IAlfContainerWidget,IAlfWidgetControl,IAlfHostAPI, + * All interfaces returned by the elements associated with the widget's control, + * All interfaces returned by the layout manager associated widget control , + * All interfaces returned by the model assoiated with the widget. + */ +class AlfWidget : public IAlfContainerWidget + { +public: + /** + * Constructor. + * + * This will create a default control to the widget to enable the widget + * containment hierarchy from the beginning. User can replace the default + * control with custom control by calling the setControl() - method. + * @exception std::bad_alloc + * + * @see setControl() + * + * @param aWidgetName The name of the widget. + * @param aContainer Container widget that will contain this widget. + * @param aEnv Toolkit environment object that will be used to create the + * default control. + */ + OSN_IMPORT AlfWidget(const char* aWidgetName, IAlfContainerWidget& aContainer, CAlfEnv& aEnv); + + /** + * Constructor to be used only by view widget. + * All the other widgets should use the other public constructor to ensure + * widget hierarchy consistency from start. + * @exception std::bad_alloc + * + * @see AlfWidget(const char*, IAlfContainerWidget&, CAlfEnv&) + * + * @param aWidgetName The name of the widget. + */ + OSN_IMPORT AlfWidget(const char* aWidgetName); + + /** + * Destructor. + * + * It also takes care that all the child widgets contained by this widget + * are destroyed correctly, provided that they have been instantiated correctly + * (e.g. through widget factory) and thus added to the ALF environment (CAlfEnv). + * + * In other words, client code does not need to take care of destroying the child + * widgets contained by a container widget. + */ + OSN_IMPORT virtual ~AlfWidget(); + + /** + * Constructor. The new widget is left on the cleanup stack. + * + * @since S60 ?S60_version + * @param aWidgetName The name of the widget. + * @return New object. The widgets are owned by Alfred. + */ + OSN_IMPORT CAlfWidgetControl* control() const; + + /** + * Getter for the parent container. The ownership is not passed. + * + * @return the parent container or 0 if the widget is the root-widget. + */ + OSN_IMPORT IAlfContainerWidget* parent() const; + + /** + * Sets new widget control to this widget. + * @exception osncore::AlfException Thrown with error code osncore::EInvalidArgument if aControl is + * alreasy associated with another widget. + * @see IAlfWidget::setControl() + * + * @since S60 ?S60_version + * @param aControl Control to be set to the widget. + * @param aDeletePreviousControl If true, the previous widget control is destroyed. + */ + OSN_IMPORT void setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl = true); + + /** + * Constructor. The new widget is left on the cleanup stack. + * + * @since S60 ?S60_version + * @param aWidgetName The name of the widget. + * @return New object. The widgets are owned by Alfred. + */ + OSN_IMPORT IAlfModel* model(); + + /** + * Sets the model for the Widget. + * + * @since S60 ?S60_version + * @param aModel Model to be set to this widget. + * @param aTakeOwnership Whether takes ownership or not. + */ + OSN_IMPORT void setModel( IAlfModel* aModel,bool aTakeOwnerShip=true ); + + /** + * Constructor. The new widget is left on the cleanup stack. + * + * @since S60 ?S60_version + * @param aWidgetName The name of the widget. + * @return New object. The widgets are owned by Alfred. + */ + OSN_IMPORT const char* widgetName() const; + + //From IAlfInterfaceBase + /** + * Getter for interfaces provided by the widget, the control, + * or the model. + * + * @since S60 ?S60_version + * @param aWidget The widget to get the interface for. + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT static IAlfInterfaceBase* makeInterface( AlfWidget* aWidget, const IfId& aType ); + + /** + * Template getter for interfaces provided by the widget, the control, + * or the model. The type of the queried interface is specified by the + * template parameter. + * + * @since S60 ?S60_version + * @param aWidget The widget to get the interface for. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + template + static T* makeInterface( AlfWidget* aWidget ); + + // from base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the widget classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + + // from base class IAlfContainerWidget + + /** + * Returns total number of widgets contained by this container. + * + * @return int Total number of widgets. + */ + OSN_IMPORT int widgetCount() const; + + /** + * Adds a child widget to the container. + * + * @param aWidget Child widget to be added to container. + * return void + */ + OSN_IMPORT void addWidget(IAlfWidget& aWidget); + + /** + * Returns child widget at given index.If index is not found return null. + * + * @param aIndex Index of widget to be returned. + * @return Widget at given index + */ + OSN_IMPORT IAlfWidget* getWidget(int aIndex) const; + + /** + * Returns the child index, when given the child widget. + * + * @param aWidget child widget, which index is returned + * @return the index of the child widget, or -1, if widget is not child of this container. + */ + OSN_IMPORT int getWidgetIndex(IAlfWidget& aWidget) const; + + /** + * Removes the child widget from given index. + * + * @param aIndex Index from which widget has to be removed. + * return void + */ + void removeWidget(int aIndex); + + /** + * Sets the base layout of container widget. + * + * @param aLayout New base layout of container widget. + * return void + */ + OSN_IMPORT void applyLayout(IAlfLayoutManager& aLayout); + + //from IAlfWidget + + /** + * Sets/Releases the Focus from child widget of container. + * Does not set the actual focused status in roster. + * + * @since S60 ?S60_version + * @param aFocus boolean value for focused status + * return void + */ + OSN_IMPORT void setChildFocus(bool aFocus); + + /** + * Removes the given widget from this widget's child widget + * array. Does not modify control connections or control + * group containment. + * + * Does nothing if the given widget is not found from + * widget array. + * + * @param aWidget Reference to a widget that is searched + * from the widget array of this widget and removed + * of found. + */ + OSN_IMPORT void removeWidget(IAlfWidget& aWidget); + + /** + * Sets the presentation for the widget using presentation XML file. + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + OSN_IMPORT void setPresentation(const char* aFilePath); + +protected: + + /** + * The protected constructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfWidget(); + +private: + + /** + * Adds the Common Properties for the widget + * + * @since S60 ?S60_version + */ + void addCommonWidgetProperties(); + + /** + * Removes reference from this widget's control to this + * widget. + */ + void removeReferenceFromControl(); + +private: // data + + auto_ptr mImpl; + }; + +using namespace osncore; + +#include "alf/alfwidget.inl" + + } // namespace Alf + +#endif // ALFWIDGET_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/alfwidgetmodeldefines.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/alfwidgetmodeldefines.hrh Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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: Defines flags to enable debug macros +* +*/ + + +#ifndef ALFWIDGETMODELDEFINES_HRH +#define ALFWIDGETMODELDEFINES_HRH + +//Enable description in errors thrown +#define ALF_DEBUG_EXCEPTIONS + +//Enable performance logs +//#define ALF_DEBUG_PERFORMANCE + + +#endif //ALFWIDGETMODELDEFINES_HRH \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/ialfattributeowner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/ialfattributeowner.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2007 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: An interface for querying and setting attributes. +* +*/ + + +#ifndef I_ALFATTRIBUTEOWNER_H +#define I_ALFATTRIBUTEOWNER_H + +#include +#include + +namespace osncore + { +class UString; + } + +using namespace osncore; + +namespace Alf + { + +class AlfAttribute; +class AlfAttributeValueType; +class AlfAttributeContainer; + +namespace alfattributeowner + { +static const IfId ident = + { + 0, "alfattributeowner" + }; + } + +/** + * An interface for querying and setting attributes. + * The interface defines a generic functionality for setting + * any attributes of the implementing class. It can be used + * also to query the available set of attributes. + * + * The interface should by implemented by all widget classes. + * It can be also used by element classes. + * Widget attributes have often corresponding data fields in the + * model. In this case, setting new values should also update + * the model. If an attribute is related to the presentation of + * the widget, the presentation is updated when a new value is set + * for the attribute. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfAttributeOwner : public IAlfInterfaceBase + { +public: + /** + * Virtual destructor. + */ + virtual ~IAlfAttributeOwner() {} + + /** + * Get the number of available attributes. + * + * @return The number of attributes. + */ + virtual int attributeCount() const = 0; + + /** + * Gets the attribute with the given name. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aAttribName The name of the attribute. + * @return The attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute( const UString& aAttribName ) const = 0; + + /** + * Set a value of an attribute. + * + * If no value is present in passed attribute parameter, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + * Attribute is added to container even if it not supported. + */ + virtual bool setAttribute( const AlfAttribute& aAttribute ) = 0; + + /** + * Set a value of an attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * If no value is present in passed attributevalue parameter, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + * Attribute is added to container even if it not supported. + */ + virtual bool setAttribute( const UString& aAttribName, + AlfAttributeValueType* aValue ) = 0; + /** + * Sets values of each attribute in given container + * + * If no value is present in an attribute in the container, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * @return True if all attributes were supported, false if at least 1 attribute was not supported + */ + virtual bool setAttributeContainer( AlfAttributeContainer& aAttributeContainer ) = 0; + + /** + * Sets a value of an attribute to a specific target. + * The target is identified by using aTargetId parameter. + * + * If no value is present in passed attribute parameter, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId , + AlfAttribute& aAttribute ) = 0; + + + + /** + * Sets a value of an static attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * If no value is present in passed attributevalue parameter, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId, + const UString& aAttribName, + AlfAttributeValueType* aValue ) = 0; + + /** + * Sets values of each attribute in given container to a specific target. + * The target is identified by using aTargetId parameter. + * + * If no value is present in an attribute in the container, + * an AlfAttributeException-exception + * is thrown with EInvalidAttribute error code. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * @return True if all attributes were supported, false if at least 1 attribute was not supported + */ + virtual bool setAttributeContainer( const UString& aTargetId , + AlfAttributeContainer& aAttributeContainer ) = 0; + + /** + * Gets the attribute with the given name from specific target. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName The name of the attribute. + * @return A pointer to the attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute( const UString& aTargetId , + const UString& aAttribName ) const = 0; + + + + /** + * Getter for the type identifier of this interface. + * + * @since S60 ?S60_versio + * @return Identifier of this interface. + */ + static inline const IfId& type() + { + return alfattributeowner::ident; + } + }; + + } // namespace Alf + +#endif // I_ALFATTRIBUTEOWNER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/ialfattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/ialfattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: Attribute setter Interface header. +* +*/ + + +#ifndef I_ALFATTRIBUTESETTER_H +#define I_ALFATTRIBUTESETTER_H + +#include +#include +#include "alf/alfsettertype.h" +#include +#include +#include +#include + +namespace Alf + { + +class CAlfWidgetControl; +class AlfAttribute; +class AlfAttributeContainer; +namespace alfattributesetter + { +static const IfId ident = + { + 0, "alfattributesetter" + }; + } +/** + * The interface for attribute setters used by widget controls. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfAttributeSetter : public IAlfInterfaceBase + { +public: + + static inline const IfId& type() + { + return alfattributesetter::ident; + } + + virtual inline ~IAlfAttributeSetter() {} + + /** + * Returns the type of the attribute setter. + * + * @return The type of the attribute setter. + */ + virtual SetterType setterType() = 0; + + /** + * Sets an attribute value in the target visual immediately without a transition. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + */ + virtual void setAttributeValue( + CAlfVisual& aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData ) = 0; + + /** + * Creates a command to change the value of an attribute in the target visual gradually with a transition. + * + * @deprecated USE CREATEANDSENDCOMMANDS INSTEAD!!! + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. + * @param aData Not used currently. + * @param aTransitionTime Time used for the transition. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + * @ret The command to gradually change the attribute in the target visual. + */ + virtual TAlfCommand* createCommand( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData, + int aTransitionTime = 0, + CAlfVisual* aRefVisual = NULL ) = 0; + + /** + * Creates commands to change the given attribute values in the target visual gradually with a transition. + * Then sends the commands via the ALF environment. + * + * @param aVisual The target visual. Doesn't take ownership + * @param aContainer The attribute container holding the attribute value(s) + * used by the attribute setter. Ownership is not transferred. The container + * can hold new values for multiple different attributes, in which case several + * commands are executed. + * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding + * the value specific by aContainer to the corresponding attribute value in the reference visual. + */ + virtual void createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual = NULL ) = 0; + + }; + + } // namespace Alf + +#endif // I_ALFATTRIBUTESETTER_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/ialfcontainerwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/ialfcontainerwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2007 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: Base interface for all container widgets +* +*/ + + +#ifndef I_ALFCONTAINERWIDGET_H +#define I_ALFCONTAINERWIDGET_H + +#include +class CAlfLayout; + +namespace Alf + { +class IAlfLayoutManager; + +namespace ialfcontainerwidget + { +static const IfId ident = + { + 0, "container" + }; + } + +/** + * The interface for container widget. + * + * Container widget maintains it's own control group. When a widget control is set to container + * widget throught the IAlfWidget::setControl() - method the control is automatically appended to the + * container widget's control group. If the control that is being set to the container widget is + * already part of another control group it will be removed from the previous control group and appended + * to the container widget's control group. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfContainerWidget : public IAlfWidget + { +public: + + static inline const IfId& type() + { + return ialfcontainerwidget::ident; + } + + virtual ~IAlfContainerWidget() {} + + /** + * Returns total number of widgets contained by this container. + * + * @return int Total number of widgets. + */ + virtual int widgetCount() const = 0; + + /** + * Adds a child widget to the container. + * + * This will throw an osncore::AlfException exception with error code + * osncore::EInvalidArgument if the aWidget is the same widget that the container + * widget itself or if user tries to add a view widget into a container + * widget. + * + * Adding a widget instance that is already added will be silently + * ignored. + * + * @exception osncore::AlfException with error code osncore::EInvalidArgument if the + * aWidget is the same widget as the container widget or when + * a view widget is attempted to be added to a container. + * + * @param aWidget Child widget to be added to container. + */ + virtual void addWidget(IAlfWidget& aWidget) = 0; + + /** + * Returns child widget at given index. If index is not found return null. + * + * @param aIndex Index of widget to be returned. + * @return Widget at given index or null if the widget is not found. + */ + virtual IAlfWidget* getWidget(int aIndex) const = 0; + + /** + * Returns the child index, when given the child widget. + * + * @param aWidget child widget, which index is returned + * @return the index of the child widget, or -1, if widget is not child of this container. + */ + virtual int getWidgetIndex(IAlfWidget& aWidget) const = 0; + + /** + * Removes the child widget from given index. + * + * If widget for the given index is not found then the call + * is silently ignored. + * + * @param aIndex Index from which widget has to be removed. + */ + virtual void removeWidget(int aIndex) = 0; + + /** + * Sets the base layout of container widget. Ownership of the + * layout manager is transferred to container widget. + * + * @param aLayout New base layout of container widget. + */ + virtual void applyLayout(IAlfLayoutManager& aLayout) = 0; + + + }; + + } // namespace Alf + +#endif // I_ALFCONTAINERWIDGET_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/alf/ialfvisualtemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/alf/ialfvisualtemplate.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,614 @@ +/* +* Copyright (c) 2007 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: Visual template class for alfred widget model. +* This class creates and updates visual tree. +* +*/ + + +#ifndef I_ALFVISUALTEMPLATE_H +#define I_ALFVISUALTEMPLATE_H + +#include +#include +#include +#include + +class CAlfVisual; +class CAlfControl; +class CAlfBrush; +class CAlfLayout; + +namespace duiuimodel + { + //FORWARD DECLARATIONS + class DuiNode; + } +using namespace duiuimodel; +using namespace osncore; + +namespace Alf + { +// FORWARD DECLARATIONS +class IAlfMap; +class IAlfAttributeSetter; +class IAlfElement; +class AlfAttributeContainer; +class AlfCustomInitDataBase; + +namespace alfvisualtemplate + { +static const IfId ident = + { + 0, "alfvisualtemplate" + }; + } + +//INTERFACE DECLARATIONS + +/** + * An interface for visual templates. + * + * A visual template hierarchy can be formed using visual template objects. From a visual template + * hierarchy a concrete visual tree can be constructed that composes of toolkit visuals. + * Produced concrete visual tree will match the visual template hierarchy constructed by + * adding visual templates as children of each other. User can create any number of identical + * visual trees from one visual template hierarchy. Each visual template object creates + * one visual in the produced concrete visual tree. + * + * A visual template can be owned by a widget element (Alf::IAlfElement). + * Only root visual templates of a visual template hierarchy can be owned by an element. + * As a consequence of this an owner element of a visual template and a parent visual template + * are mutually exclusive properties. That is, if a visual template is a child of + * another visual template it cannot be owned by an element. Also if an element + * owns a visual template it cannot be a child of another visual template. + * + * If a child visual template is set to an element the connection between child visual template + * and its parent is removed thus making the visual template a root of the visual template hierarchy + * below it. Similarly if a visual template owned by an element is set as a child to a visual template + * the ownership of that visual template by its element is removed leaving the element with no visual + * template. + * + * Concrete visual trees can be produced using createVisualTree() method. Existing concrete visual + * trees can be updated using the updateVisualTree() method. Attributes of the produced concrete + * visuals can be manipulated through attribute setters and containers assigned to visual template + * using method addAttributeSetter(). Data that is passed to the createVisualTree() and updateVisualTree() + * methods contain the attribute values that are set to the concrete visuals giving users a + * possibility to customize the produced concrete visual trees. + * + * @see Alf::IAlfElement + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfVisualTemplate : public IAlfInterfaceBase + { +public: + /** + * Getter for the type identifier of this interface. + * + * @since S60 ?S60_version + * @return Identifier of this interface. + */ + static inline const IfId& type() + { + return alfvisualtemplate::ident; + } + + /** Virtual destructor. */ + virtual ~IAlfVisualTemplate() {} + + /** + * Sets the owner element. User should not call this method directly. It will + * be called implicitly by Alf::IAlfElement::setVisualTemplate() method. + * Call to this method cannot throw an exception. + * + * @see Alf::IAlfElement::setVisualTemplate() + * + * @since S60 ?S60_version + * + * @param aOwner Element that owns this root visual template. + */ + virtual void setOwner(IAlfElement* aElement) throw() = 0; + + /** + * Returns the owner element. Call to this method cannot + * throw an exception. + * + * @see Alf::IAlfElement::setVisualTemplate() + * + * @since S60 ?S60_version + * + * @return The owner element of a visual template, if this visual template is owned + * by an element. NULL if visual template is not owned by an element. + */ + virtual IAlfElement* owner() const throw() = 0; + + /** + * Set name of the visual. This name is used when creating + * concrete visual trees. Name is assigned to each of the produced concrete + * visuals as a tag. Note thus that all concrete visual + * trees produced from this visual template share the same tag. + * + * @see name() + * + * @exception std::bad_alloc thrown if heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aName The name of the visual. + */ + virtual void setName(const char* aName) = 0; + + /** + * Returns the name of the visual. Call to this method + * cannot throw an exception. + * + * @see setName() + * + * @since S60 ?S60_version + * + * @return aName The name of the visual. + */ + virtual const char* name() const throw() = 0; + + /** + * Get the number of child visual templates. + * This returns the number of child visual templates directly + * under this visual template in the visual template + * hierarchy. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return The number of direct child visual templates + * under this visual template in the visual template hierarchy. + */ + virtual int numChildTemplates() const throw() = 0; + + /** + * Returns a child visual template at a given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the child visual template. + * + * @return Reference to the child visual template object. + */ + virtual IAlfVisualTemplate& childTemplate(int aIndex) const = 0; + + /** + * Set the visual type. Every visual template maps to + * one concrete visual or layout type. Each visual template + * node in the visual template hierarchy can produce + * only visuals that match its type. Container nodes + * in the visual template hierarchy map to layouts + * and leaf visual template nodes map to visuals. + * + * Call to this method will make this visual template + * a visual type. The type can thus change from layout + * type to a visual type. + * + * @see setLayoutType() + * @see visualType() + * @see layoutType() + * + * @since S60 ?S60_version + * + * @param aType Type of visual + */ + virtual void setVisualType(TAlfVisualType aType) = 0; + + /** + * Get the visual type or a negative integer + * if this visual template is of layout type. + * Call to this method cannot throw an exception. + * + * @see setVisualType() + * + * @since S60 ?S60_version + * + * @return Type of visual that this visual template produces + * or a negative integer if this visual template + * produces layouts. + */ + virtual int visualType() const throw() = 0; + + /** + * Set the layout type. Every visual template maps to + * one concrete visual or layout type. Each visual template + * node in the visual template hierarchy can produce + * only visuals that match its type. Container nodes + * in the visual template hierarchy map to layouts + * and leaf visual template nodes map to visuals. + * + * Call to this method will make this visual template + * a layout type. The type can thus change from visual + * producer to a layout producer. + * + * @see setVisualType() + * @see visualType() + * @see layoutType() + * + * @since S60 ?S60_version + * + * @param aType Type of layout + */ + virtual void setLayoutType(TAlfLayoutType aType) = 0; + + /** + * Get the layout type or a negative integer + * if this visual template is of visual type. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return Type of layout that this visual template produces + * or a negative integer if this visual template + * produces visuals. + */ + virtual int layoutType() const throw() = 0; + + /** + * Adds brush to the brush array. + * + * All brushes added to a visual template will be applied to + * the produced concrete visual when one is produced. The same + * brush array is shared across all concrete visual instancies + * created from same visual template. + * + * @see brush() + * @see numBrushes() + * + * @exception std::bad_alloc thrown if a heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aBrush Brush to be added + */ + virtual void addBrush(CAlfBrush& aBrush) = 0; + + /** + * Returns the number of brushes in the brush array. + * + * @since S60 ?S60_version + * + * @return The number of brushes + */ + virtual int numBrushes() const = 0; + + /** + * Returns a brush instance from the array of brushes. + * + * @see addBrush() + * @see numBrushes() + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index into the array of brushes. + * + * @return Reference to the brush object instance at the given array index. + */ + virtual CAlfBrush& brush(int aIndex) const = 0; + + /** + * Enables or disables selected child mode. By default + * this is disabled and thus visual template creates or updates + * all its children when createVisualTree() or updateVisualTree() + * is called. If selected child mode is enabled the visual template + * will create or update only the selected child. The child which + * is affected in selected child mode is determined in the data passed + * in the createVisualTree() or updateVisualTree() method. In the + * passed data map a search is done to match the child index + * field name with the keys in the map. If an entry is found its value + * is used as an index to determine the child branch that is to be + * created or updated. + * + * @see createVisualTree() + * @see updateVisualTree() + * + * @since S60 ?S60_version + * + * @param aSelectChild Set to true to enable the child mode or false to disable the child mode. + * @param aChildIndFieldName Key in data map, from which entry the index of + * the selected child is fetched. + */ + virtual void setSelectChildMode(bool aSelectChild, const UString& aChildIndFieldName) = 0; + + /** + * Add a child visual template. The visual templates may form + * a tree structure to create and update a visual tree. The visuals + * created by children are added to the layout created by this + * visual template. This visual template acquires the ownership for the + * child visual template passed as an argument. + * + * If a visual template added as a child to this visual template is owned + * by an Alf::IAlfElement the connection between the child visual template + * and its owner element is implicitly removed in this call when a + * parent-child connection is created. Effectively having a parent visual + * template or being owned by an element are mutually exclusive properties + * for a visual template. Elements can own only root visual templates and + * if an owned root visual template becomes a child of another visual + * template the visual template will be removed from the associated owner + * element. + * + * @see insertChildTemplate() + * + * @exception std::bad_alloc Thrown if memory allocation fails in appending the child + * visual template to child array of this visual template. + * @exception osncore::AlfException thrown with error code osncore::EInvalidHierarchy if + * the call to this method would result in an invalid visual template hierarchy. + * This can occur if a child is added to a non-layout visual template or if a + * call would result in a parent becoming a descendant of it's child (a recursive + * tree). + * + * @since S60 ?S60_version + * + * @param aChild Child visual template to be appended to the children of this visual template. + */ + virtual void addChildTemplate(IAlfVisualTemplate& aChild) = 0; + + /** + * Inserts a child visual template at given index. The visual templates may form + * a tree structure to create and update a concrete visual tree. The concrete visuals + * created by children are added to the layout created by this + * visual template. This visual template acquires the ownership of the inserted + * child visual template. + * + * @see addChildTemplate() + * + * @exception std::bad_alloc thrown if memory allocation fails in inserting the child visual + * template to the child list of this visual template. + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex when + * index supplied is out of range for array of visual templates. + * @exception osncore::AlfException thrown with error code osncore::EInvalidHierarchy if + * the call to this method would result in an invalid visual template hierarchy. + * This can occur if a child is added to a non-layout visual template or if a + * call would result in a parent becoming a descendant of it's child (a recursive + * tree) or if the same child visual template is added to the hierarchy twice. + * + * @since S60 ?S60_version + * + * @param aChild The child visual template. + * @param aIndex Position at which child template is to be added. + */ + virtual void insertChildTemplate(IAlfVisualTemplate& aChild, int aIndex) = 0; + + /** + * Removes and destroyes a child visual template from an index in the child list + * of this visual template. This will recursively also destroy all child visual templates + * in the hierarchy below the destroyed child visual template. This call is silently + * ignored if the index is out of bounds. Call to this method cannot throw an + * exception. + * + * @since S60 ?S60_version + * + * @param aIndex Position from which child visual template is to be removed. + */ + virtual void destroyChildTemplate(int aIndex) throw() = 0; + + /** + * Destroyes a child visual template with the given name and removes it from the children + * of this visual template. This will recursively also destroy all child visual templates + * in the hierarchy below the destroyed child visual template. This call is silently + * ignored if a child visual template with the given name is not found. Call + * to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @param aName Name of child visual template to be destroyed. + */ + virtual void destroyChildTemplate(const char* aName) throw() = 0; + + /** + * Update an existing concrete visual tree with new values. The existing visual tree + * should be produced from this visual template hierarchy using the createVisualTree() - + * method. + * + * @see createVisualTree() + * @see setSelectChildMode() + * @see addAttributeSetter() + * + * @since S60 ?S60_version + * + * @param aData A map containing new data for the visuals. + * @param aOldData Old data, that will be replaced. This is used to for instance tear down + * the old selected child branch before creating a new branch in the selected + * child mode. + * @param aVisual The root of the concrete visual tree that will be updated. This root visual + * needs to match this visual template and should have been created using this + * visual template. + * @return Root visual of the updated concrete visual tree. + */ + virtual CAlfVisual* updateVisualTree(IAlfMap* aData, IAlfMap* aOldData, CAlfVisual& aVisual) = 0; + + /** + * Creates a new concrete visual tree from this visual template hierarchy and initializes the visuals. + * Created visual tree matches the visual template hierarchy under this visual template. + * + * @see updateVisualTree() + * @see setSelectChildMode() + * @see addAttributeSetter() + * + * @since S60 ?S60_version + * + * @param aControl The owner control of the new concrete visual hierarchy. + * @param aData A map containing data for the visuals. This is used to set the attributes of the + * produced concrete visuals using the attribute containers and attribute setters + * added through the addAttributeSetter() - method. + * @param aParentLayout Concrete layout visual to insert the created concrete visual tree into. + * Parent layout for a created visual. + * @param aLayoutIndex Ordinal index, into where the created visual should be placed in the parent layout. + * + * @return Pointer to the root visual object of the concrete visual hierarchy that was constructed. + */ + virtual CAlfVisual* createVisualTree(CAlfControl& aControl, + IAlfMap* aData, CAlfLayout* aParentLayout, int aLayoutIndex) = 0; + + /** + * Add a new attribute setter and associated attribute container to set visual attributes + * of the concrete visual hierarchies created or updated with this visual template hierarchy. + * This visual template object acquires ownership of both the passed attribute setter as well + * as the attribute container. Attribute containers in a visual template are iterated through + * whenever concrete visual trees are created or updated. Concrete visual tree attributes + * are set from the data passed in through the createVisualTree() and updateVisualTree() methods + * using the attribute setters and containers added into the visual template using this method. + * + * @see createVisualTree() + * @see updateVisualTree() + * + * @exception std::bad_alloc thrown if heap memory allocation fails. + * + * @since S60 ?S60_version + * + * @param aSetter Attribute setter that will be used to set the attributes in the passed in + * container to concrete visuals. + * @param aContainer Container holding the attribute value used by the attribute setter. + */ + virtual void addAttributeSetter(IAlfAttributeSetter* aSetter, AlfAttributeContainer* aContainer) = 0; + + /** + * Get the number of the attribute setters and the corresponding attribute containers. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return The number of the attribute setters and containers. + */ + virtual int numAttributeSetters() const throw() = 0; + + /** + * Returns an attribute setter maintained in this visual template from the given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the visual attribute setter. + * @return Reference to the attribute setter object. + */ + virtual IAlfAttributeSetter& attributeSetter(int aIndex) const = 0; + + /** + * Returns an attribute container maintained in this visual template from the given index. + * + * @exception osncore::AlfException thrown with error code osncore::EInvalidArrayIndex if + * the given index is out of bounds. + * + * @since S60 ?S60_version + * + * @param aIndex The index of the visual attribute container. + * @return Reference to the attribute container object. + */ + virtual AlfAttributeContainer& attributeContainer(int aIndex) const = 0; + + /** + * Retrieves pointer to the parent visual template. + * Returns NULL if this is a root visual template of a visual template + * hierarchy. Call to this method cannot throw an exception. + * + * @see addChildTemplate() + * @see insertChildTemplate() + * @see Alf::IAlfElement::setVisualTemplate() + * + * @return Pointer to a Alf::IAlfVisualTemplate object that this visual template + * is a child of. + */ + virtual IAlfVisualTemplate* parent() const throw() = 0; + + /** + * Removes the given child visual template from this visual template. + * Call to this method is silently ignored if the given visual template + * is not found from children. The parent template of the removed child + * is set to null. Ownership of the removed child visual template is + * transferred to the caller of this method. Call to this method cannot + * throw an exception. + * + * @see setParent() + * @see parent() + * + * @param aChild Reference to the child visual template that is located + * and removed from this visual template. + */ + virtual void removeChildTemplate(IAlfVisualTemplate& aChild) throw() = 0; + + /** + * Sets the parent visual template. + * + * User should not call this method directly. It will be called implicitly + * by addChildTemplate() or insertChildTemplate() methods of + * the parent visual template into which this visual template is + * added to. + * + * Parent visual template and owner element are mutually exclusive. + * If a visual template is added under another visual template + * in a visual template hierarchy the connection to owner element + * is implicitly removed. Alf::IAlfElement objects can thus own only + * roots of visual template hierarchies. + * + * Call to this method cannot throw an exception. + * + * @see addChildTemplate() + * @see insertChildTemplate() + * @see parent() + * @see Alf::IAlfElement::setVisualTemplate() + * + * @param aParent Pointer to a parent visual template under which this + * visual template is located in in the visual template + * hierarchy or null, if the visual template is removed from + * a visual template hierarchy. + */ + virtual void setParent(IAlfVisualTemplate* aParent) throw() = 0; + + }; + +/** + * Placeholder for information required to instantiate a visual template + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfVisualTemplateInitData + { + /** + * Visual template instance ID.This uniquely identifies every visual template instance + */ + char* mVisualTemplateId; + + /** + * Pointer to node in declaration containing information for the widget. + */ + DuiNode* mNode; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + } // namespace Alf + +#endif // I_ALFVISUALTEMPLATE_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/mul/imulmodelaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mul/imulmodelaccessor.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2007-2008 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: Interface for model accessor + * +*/ + + +#ifndef I_MULMODELACCESSOR_H +#define I_MULMODELACCESSOR_H + +//Includes +#include +#include +#include + +#include + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + + /* Forward declarations*/ + class MulVisualItem; + class IMulModelObserver; + + /** + * An interface for accessing data model. Widgets use this interface to interact with Model. + * Data model implements this interface. + * @lib + */ + class IMulModelAccessor : public IAlfModel + { + public: + + /** + * The function to set a particular item as highlighted. + * + * @param aIndex Index of the item to be highlighted. + * @throws Invalid_argument Throws this exception if index is not a valid index. + */ + virtual void SetHighlight( int aItemIndex ) = 0; + + /** + * Scroll Window to mention item index + * it will check that data window needs to be updated or not + * and if required it update data window + * + * @aItemIndex item index + * @throws invaid_argument exception + */ + virtual void ScrollWindow( int aItemIndex ) = 0; + + /** + * Function to get the highlighted item index. + * + * @return Index of the highlighted index. + */ + virtual int Highlight() = 0; + + /** + * Function to get the count of items currently present in the model. + * This includes hidden items. + * + * @return Count of items existing in the model. + */ + virtual int CurrentItemCount() = 0; + + /** + * Set visible data window for model. + * + * @param aVisibleWindow No of visuals that widget can display at a time on screen. + */ + virtual void SetVisibleWindow( int aWindowSize, int aPageTopIndex = -1 ) = 0; + + /** + * Returns relative index from absolute index. + * + * @param aAbsoluteIndex Abosulte index + * @return Returns relative index from absolute index. + */ + virtual int RelativeIndex( int aAbsoluteIndex ) const = 0; + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + virtual int TopWindowOffset() const= 0; + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + virtual int BottomWindowOffset() const = 0; + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + virtual int TopOffset() const= 0; + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + virtual int BottomOffset() const = 0; + + /** + * Return rear buffer top offset + * + * @return Current window top offset + */ + virtual int RearTopOffset() const = 0; + + /** + * Return rear buffer bottom offset + * + * @return Current window top offset + */ + virtual int RearBottomOffset() const = 0; + + /** + * Check weather item at specified index is marked or not. + * + * @param aIndex Absolute index of item + * @return true if seleccted else otherwise + */ + virtual bool IsItemMarked( int aIndex ) = 0; + + /** + * Function for setting the item Marked or Unmarked. For mark and + * unmark operations, index of item should be provided. + * + * @param aType Type of marking operation to be performed. + * @param aItemsIndex Indices of the items to be changed + * @throw Invalid Argument, if type is specified as mark-all and unmark-all. + */ + virtual void SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ) = 0; + + /** + * Returns the visual item at the specified absolute index + * + * @param aIndex Absolute index of item + */ + virtual const MulVisualItem& Item( int aAbsoluteIndex ) = 0; + + /** + * Returns Absolute index from relative index + * + * @param aRelativeIndex Relative index + * @return Absolute index + */ + virtual int AbsoluteIndex( int aRelativeIndex ) = 0; + + /** + * Return whather currently looping is on or not + * + * @return true if looping is on false otherwise + */ + virtual bool IsLoopingOn() = 0; + + /** + * Add model state change observer. + * + * @param aObserver Observer- ownserhip is not transferred + */ + virtual void AddModelObserver( IMulModelObserver* aObserver ) = 0; + + /** + * Eemove model state change observer. + * + * @param aObserver Observer- ownserhip is not transferred + */ + virtual void RemoveModelObserver( IMulModelObserver* aObserver )= 0; + + /** + * Return default template + * + * @return Default template + */ + virtual mulwidget::TLogicalTemplate Template( ) = 0; + + }; + + + } // namespace Alf + +#endif // I_MULMODELACCESSOR_H diff -r 4ea6f81c838a -r 0e9bb658ef58 inc/mul/mulmodelutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mul/mulmodelutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for data model +* +*/ + + +#ifndef MULMODELUTILITY_H_ +#define MULMODELUTILITY_H_ + +#include +#include +#include +#include + +#include "mul/imulwidget.h" + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + +//Forward Declaration +class MulVisualItem; +class MulModelUtility + { +public: + + /** + * Create new Variant data from existing variant data. + * + * @param aValue Existing variant data; + * + * @reutrn new variant data, Ownership is transferred + */ + OSN_IMPORT static IAlfVariantType* CreateVariantType( IAlfVariantType& aValue ); + + /** + * Convert map of visual item to map of alf map. + * Ite create new Map and while returning new map owner ship of map is transfered + * + * @param aVisualItem Map of visual item + * @return Map + */ + OSN_IMPORT static std::auto_ptr ConvertVisualItemToMap( MulVisualItem& aVisualItem ); + + /** + * + * Convert AlfMap to visual item + * + * @param aMap IAlfMAP + * @return MulVisualItem ownership is trsnaferred + */ + OSN_IMPORT static std::auto_ptr ConvertMapToVisualItem( IAlfMap& aMap ); + + /** + * Check the prefix of the name to see whether they can be added in alfmodel + * + * @param aName Name whose prefix is to be checked + */ + static bool CheckNamePrefix( UString aName ) ; + + /** + * Convert UString to CAlfString + * + * @param aUString UString instance to convert to CAlfSTring + + * @return Converted CAlfString + */ + OSN_IMPORT static UString UStringToAlfString(const UString& aUString); + + /** + * Convsert CAlfString to UString + * + * @param aUString CAlfSTring instance to convert to UString + + * @return Converted UString + */ + OSN_IMPORT static UString AlfStringToUString(const UString& aAlfString); + + /** + * Covert integer to AlfString + * + * @param aNumber number to convert + * @return AlfString + */ + OSN_IMPORT static UString IntToUString( int aNumber ); + + /** + * Convert TDes to UString + * + * @param aDes a TDes type string to be converted + * @param aString the converted Ustring + */ + OSN_IMPORT static void ConvertTDesToUString (const TDesC& aDes, UString& aString); + + /** + * Convert TDes8 to UString + * + * @param aDes a TDes8 type string to be converted + * @param aString the converted Ustring + */ + OSN_IMPORT static void ConvertTDes8ToUString (const TDesC8& aDes, UString& aString); + + /** + * Convert UString to TDes + * + * @param aString a UString type string to be converted + * @param aDes the TDes type converted string + */ + OSN_IMPORT static void ConvertUStringToTDes (const UString& aString, TDes& aDes); + + /** + * Convert UString to TDes8 + * + * @param aString a UString type string to be converted + * @param aDes the TDes8 type converted string + */ + OSN_IMPORT static void ConvertUStringToTDes8 (const UString& aString, TDes8& aDes); + + /** + * Create a visualitem and set its default template + * + * @param aDefaultTemplate defaultTemplate for that visual item + */ + OSN_IMPORT static std::auto_ptr CreateVisualItem( mulwidget::TLogicalTemplate aDefaultTemplate ); + + + }; + + } //namespace Alf + +#endif /*MULMODELUTILITY_H_*/ + +//End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_containerwidget_api/alf_containerwidget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_containerwidget_api/alf_containerwidget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +alf containerwidget api +API for AlfContainerWidget +c++ +alfcontainerwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_containerwidget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_containerwidget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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: File that exports the files belonging to +: ALF container widget API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/alf/ialfcontainerwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfcontainerwidget.h) +../inc/alf/alfcontainerwidgetexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfcontainerwidgetexception.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_containerwidget_api/inc/alf/alfcontainerwidgetexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_containerwidget_api/inc/alf/alfcontainerwidgetexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: Container widget exception class. +* +*/ + + +#ifndef ALFCONTAINERWIDGETEXCEPTION_H +#define ALFCONTAINERWIDGETEXCEPTION_H + +// INCLUDES +#include +#include + +namespace Alf + { + +/** + * Error codes used with AlfContainerWidgetException. + * + * There is an offset in AlfContainerWidgetException error codes, so that + * AlfContainerWidget specific exceptions can be separated from + * osncore::AlfException base exceptions and exceptions of other widgets. + */ +enum TAlfContainerWidgetErrorCode + { + /** + * Error occured in construction or initialization of the container + * widget. + */ + EInitializationError = 500 + }; + +/** + * AlfContainerWidgetException is a base class for all container widget + * exceptions. + * + */ +class AlfContainerWidgetException : public osncore::AlfException + { +public: + // Constructors and destructor + + /** + * Constructor with AlfContainerWidget specific error code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + */ + AlfContainerWidgetException(int aError) throw(); + + /** + * Constructor with AlfContainerWidget specific error code + * and additional information. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + */ + AlfContainerWidgetException(int aError, const char* aInfo) throw(); + + /** + * Constructor with AlfContainerWidget specific error code, + * additional information, source file and line of code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + * @param aFileAndLine Optional file and line information or NULL. + */ + AlfContainerWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw(); + + /** + * Default destructor. + */ + virtual ~AlfContainerWidgetException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + const char* what() const throw(); + +private: + + /** + * Error description + */ + osncore::UString mDescription; + + }; + + } // Namespace Alf + +#endif // ALFCONTAINERWIDGETEXCEPTION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_containerwidget_api/inc/alf/ialfcontainerwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_containerwidget_api/inc/alf/ialfcontainerwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2007 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: Base interface for all container widgets +* +*/ + + +#ifndef I_ALFCONTAINERWIDGET_H +#define I_ALFCONTAINERWIDGET_H + +#include +class CAlfLayout; + +namespace Alf + { +class IAlfLayoutManager; + +namespace ialfcontainerwidget + { +static const IfId ident = + { + 0, "container" + }; + } + +/** + * The interface for container widget. + * + * Container widget maintains it's own control group. When a widget control is set to container + * widget throught the IAlfWidget::setControl() - method the control is automatically appended to the + * container widget's control group. If the control that is being set to the container widget is + * already part of another control group it will be removed from the previous control group and appended + * to the container widget's control group. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfContainerWidget : public IAlfWidget + { +public: + + static inline const IfId& type() + { + return ialfcontainerwidget::ident; + } + + virtual ~IAlfContainerWidget() {} + + /** + * Returns total number of widgets contained by this container. + * + * @return int Total number of widgets. + */ + virtual int widgetCount() const = 0; + + /** + * Adds a child widget to the container. + * + * This will throw an osncore::AlfException exception with error code + * osncore::EInvalidArgument if the aWidget is the same widget that the container + * widget itself or if user tries to add a view widget into a container + * widget. + * + * Adding a widget instance that is already added will be silently + * ignored. + * + * @exception osncore::AlfException with error code osncore::EInvalidArgument if the + * aWidget is the same widget as the container widget or when + * a view widget is attempted to be added to a container. + * + * @param aWidget Child widget to be added to container. + */ + virtual void addWidget(IAlfWidget& aWidget) = 0; + + /** + * Returns child widget at given index. If index is not found return null. + * + * @param aIndex Index of widget to be returned. + * @return Widget at given index or null if the widget is not found. + */ + virtual IAlfWidget* getWidget(int aIndex) const = 0; + + /** + * Returns the child index, when given the child widget. + * + * @param aWidget child widget, which index is returned + * @return the index of the child widget, or -1, if widget is not child of this container. + */ + virtual int getWidgetIndex(IAlfWidget& aWidget) const = 0; + + /** + * Removes the child widget from given index. + * + * If widget for the given index is not found then the call + * is silently ignored. + * + * @param aIndex Index from which widget has to be removed. + */ + virtual void removeWidget(int aIndex) = 0; + + /** + * Sets the base layout of container widget. Ownership of the + * layout manager is transferred to container widget. + * + * @param aLayout New base layout of container widget. + */ + virtual void applyLayout(IAlfLayoutManager& aLayout) = 0; + + + }; + + } // namespace Alf + +#endif // I_ALFCONTAINERWIDGET_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_customlayoutmanagers_api/alf_customlayoutmanagers_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_customlayoutmanagers_api/alf_customlayoutmanagers_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +alf customlayoutmanagers api +API for alfcustomlayoutmanagers +c++ +alfcustomlayoutmanagers + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_customlayoutmanagers_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_customlayoutmanagers_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008 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: File that exports the files belonging to +: ALF custom layout managers +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// To be removed once migration to the new internal export dir has been done + +../inc/alf/ialflctanchorlayoutpolicy.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialflctanchorlayoutpolicy.h) +../inc/alf/alflctanchorlayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alflctanchorlayoutmanager.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_customlayoutmanagers_api/inc/alf/alflctanchorlayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_customlayoutmanagers_api/inc/alf/alflctanchorlayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007 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: grid layout manager +* +*/ + + +#ifndef ALFLCTANCHORLAYOUTMANAGER_H +#define ALFLCTANCHORLAYOUTMANAGER_H + +#include +#include +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { +class IAlfWidgetControl; +class AlfLCTAnchorLayoutPreferencesImpl; +class AlfLCTAnchorLayoutPolicyImpl; + +/** + * Grid layout manager + * + * Layout manager handles the layouting of child widgets in the container widget. + * It uses IAlfLayoutPreferences-interface (@see IAlfLayoutPreferences) + * of child widgets as a guide for laying out the widgets. The layoutmanager + * is set to the IAlfHostApi- interface (@see IAlfHostApi::setBaseLayout) + * createLayout-method should be the first call after creating the layoutmanager. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfLCTAnchorLayoutManager : public AlfLayoutManager + { + friend class AlfLCTAnchorLayoutPreferencesImpl; + friend class AlfLCTAnchorLayoutPolicyImpl; + +public: + + /** + * layout manager constructor + * + */ + AlfLCTAnchorLayoutManager(); + + /** + * virtual destructor + */ + virtual ~AlfLCTAnchorLayoutManager(); + +public: + //from IAlfLayoutManager + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the child control's layout + * must be updated + * + * @param aControl control, which size has changed. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void updateChildLayout(CAlfWidgetControl* aControl); + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which has been removed from the layout. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void childRemoved(CAlfWidgetControl* aControl); +public: +protected: + + void doUpdateChildLayout(CAlfWidgetControl* aControl); +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: // data + auto_ptr mDataPreferences; + auto_ptr mDataPolicy; + }; + + } // namespace Alf + +#endif // ALFLCTANCHORLAYOUTMANAGER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_customlayoutmanagers_api/inc/alf/ialflctanchorlayoutpolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_customlayoutmanagers_api/inc/alf/ialflctanchorlayoutpolicy.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2008 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: interface for layout policy +* +*/ + + +#ifndef I_ALFLCTANCHORLAYOUTMANAGER +#define I_ALFLCTANCHORLAYOUTMANAGER + +#include +#include + +namespace osncore + { +class UString; + } + +class CAlfControl; +class TAknLayoutHierarchyComponentHandle; + +namespace Alf + { + +class CAlfWidgetControl; + +namespace ialflctanchorlayoutpolicy + { + static const IfId Ident = + { + 0, "lctanchorlayoutpolicy" + }; + } + +using namespace osncore; +using Alf::CAlfWidgetControl; + + + +/** + * The interface for grid layout policy + * + * Provides grid specific layout APIs + * + * @code + * // Create layout manager interface. + * IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control); + * + * // See if layout policy is supported in the given layout manager. + * IAlfLCTAnchorLayoutPolicy* layoutPolicy = IAlfInterfaceBase::makeInterface(layoutManager); + * + * if(layoutPolicy != 0) + * { + * int rows = layoutPolicy->Attach(componentHandle); + * } + * @endcode + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class IAlfLCTAnchorLayoutPolicy : public IAlfInterfaceBase + { +public: + + static inline const IfId& type() + { + return ialflctanchorlayoutpolicy::Ident; + } + + virtual inline ~IAlfLCTAnchorLayoutPolicy() {} + + + /** + * attach the anchors needed for a child visual, according to the layout data + * corresponding to the component handle. + * + * @note this should can be used for layout text components, but also use IAlfLCTTextLayoutPolicy + * with the contained text visual to set the text style and alignment + * + * @param aOrdinal the child visual index + * @param aComponentHandle the layout data to use + */ + virtual void Attach (int aOrdinal, const UString& aLCTString, int aVarietyIndex) = 0; + + +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0; + }; + + } // namespace Alf + +#endif // I_ALFLCTANCHORLAYOUTMANAGER diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_resourcepool_api/alf_resourcepool_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_resourcepool_api/alf_resourcepool_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +alf resourcepool api +Alf Resource Pool API +c++ +alfresourcepool + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_resourcepool_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_resourcepool_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008 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: File that exports the files belonging to +: ALF resouce pool API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// To be removed once migration to the new internal export dir has been done + +../inc/alf/alfresourcepool.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfresourcepool.h) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_resourcepool_api/inc/alf/alfresourcepool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_resourcepool_api/inc/alf/alfresourcepool.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,283 @@ +/* +* Copyright (c) 2008 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: API for handling alf graphic resources +* +*/ + + +#ifndef ALF_RESOURCEPOOL_H +#define ALF_RESOURCEPOOL_H + +#include +#include + +#include +class TAlfImage; +class CAlfTextureManager; +struct TAlfXYMetric; + +namespace Alf +{ + +#define KResourcePoolThemeDefinitionPrefixS60 "s60" + +using namespace osncore; + +class ResourcePoolImpl; + +/** + * Resoure pool is responsible of controlling commonly used image resources + * in an application. The resources will be indentified by tags, which are not + * case sensitive. + * + * @code + * // create image resources + * resourcePool->createLogicalImageResource( "qgn_indi_find_glass" ); + * resourcePool->setInitialSize( "qgn_indi_find_glass", XYMetric( 64, 64 ) ); + * resourcePool->setAspectRatio( "qgn_indi_find_glass", ResourcePool::aspectRatioPreserved ); + * + * resourcePool->createImageResource( + * "my_face", + * pic0001.jpg ); + * + * // utilize the resource + * imageVisual->setImage( + * resourcePool->getImageResource( "qgn_indi_find_glass" ) ); + * + * sharpImageVisual->setImage( + * resourcePool->getImageResource( "my_face" ), + * XYMetric( 256, 256 ) ); + * + * // when the resource in not used anymore, the resource can be deleted + * resourcePool->deleteImageResource( "qgn_indi_find_glass" ); + * resourcePool->deleteImageResource( "my_face" ); + * + * @endcode + * + * @lib alfresourcepool.lib + * @since S60 v5.0.1 + */ +class ResourcePool + { +public: + + // Aspect ratio of the image resource + // @see setAspectRatio + enum AspectRatio + { + /* + * Scales the icon to the maximum size that fits in the given size, + * whilst preserving the aspect ratio of the icon. The sizes of the resulting + * bitmaps are exactly of the given size. If the aspect ratio of + * the given size differs from the aspect ratio of the icon, + * the resulting bitmaps will contain an unused area. + */ + aspectRatioPreserved = 0, + + /* + * Scales the icon to the maximum size that fits in the given size, + * whilst preserving the aspect ratio of the icon. The resulting bitmaps + * are resized so that any unused portion of the given size is not + * present in them. + * + * This mode should be used when only the height or the width of the icon + * is known and the other should be based on the aspect ratio of the icon. + * The unknown dimension should be defined high enough so + * that it does not limit the scaling based on the aspect ratio of the icon. + */ + aspectRatioPreservedAndUnusedSpaceRemoved = 1, + + /* + * Scales the icon exactly to the given size. Does not preserve the aspect + * ratio of the icon. + */ + aspectRatioNotPreserved = 2, + + /* + * Scales the icon to the minimum size that covers the given size, + * whilst preserving the aspect ratio of the icon. The sizes of the resulting + * bitmaps are exactly of the given size. If the aspect ratio of + * the given size differs from the aspect ratio of the icon, some parts of the + * icon will be sliced from the resulting bitmaps. + */ + aspectRatioPreservedSlice = 3 + }; + +public: + + /** + * Constructs a resource pool + * + * @param aTextureManager Used texture manager. + * @param aParentPool Chained parent pool (optional) - not supported currently + */ + OSN_IMPORT ResourcePool( + CAlfTextureManager& aTextureManager, + ResourcePool* aParentPool = NULL); + + /** + * Destructor + */ + OSN_IMPORT ~ResourcePool(); + +public: + + /** + * Creates an image resource based on a logical name. The name will + * be also used as the image resource tag because the logical name + * is unique in the system. + * + * The logical name should be format "qgn_xxx_xxx" i.e. as stated + * in the S60 reference icons document. + * + * @note The KAknsIIDQgnXxxXxx format works for a while but it will be + * deprecated -> use the qgn_xxx_xxx format. + * + * @param aTag Resource tag. NULL terminated 8-bit string + * + * @exception invalid_argument if the tag cannot be matched with any + * logical name + */ + OSN_IMPORT void createLogicalImageResource( const Utf8* aTag ); + + /** + * Creates an image resource based on a theme definition. This definition + * may concists of several different theme systems. + * + * Currently supported formats: + * #1 S60 Skin; + * s60;mifFilePath;mifImageIndex;mifMaskIndex;majorID;minorId + * + * s60: literal "s60", which specifies that the following + * item definition is based on the S60 Skin system + * mifFilePath: literal into the multibitmap file (mif/mbm). Can be empty. + * mifImageIndex:unsigned integer which is the index to the mifFilePath. Only used if mifFilePath is given. + * mifMaskIndex: unsigned integer which is the mask index to the mifFilePath. Only used if mifFilePath is given. + * majorID: unsigned integer or hexadecimal starting with 0x of the Major skin ID. Can be empty. + * minorId: unsigned integer or hexadecimal starting with 0x of the Minor skin ID. Only used if majorID is given. + * + * examples: "s60;;;;268457670;76" // 0x100056c6;0x4c -> KAknsIIDQgnIndiFindGlass + * "s60;c:\myFile.mif;1;2;;" + * "s60;myMbmFile.mbm;435;;2342345;234" // If skin ID not found, use mbm file with index 435 (no mask) + * + * @param aTag Resource tag. + * @param aThemeDefinition Definition of the theme element. + * + * @exception invalid_argument theme definition is not supported. + */ + OSN_IMPORT void createThemeImageResource( + const Utf8* aTag, + const UString& aThemeDefinition ); + + /** + * Creates an image resource based on a file name. + * The aFileName can be a full path with the drive letter or it + * can be relative path to the texture manager defaul path + * + * @param aTag Resource tag. + * @param aFileName File name. + * @param aFlag How to convert the bitmap to texture + * default all fileimages will be treated as nonanimated + * @see TextureManager::setImagePath() + */ + OSN_IMPORT void createFileImageResource( + const Utf8* aTag, + const UString& aFileName ,TAlfTextureFlags aFlag = EAlfTextureFlagLoadAnimAsImage ); + + /** + * Deletes image resource + * + * @param aTag Resource tag. + */ + OSN_IMPORT void deleteImageResource( const Utf8* aTag ); + + /** + * Checks if the given resource identifier exists. + * + * @param aTag Resource tag. + * + * @return 'true' if the indentified resource exists. + */ + OSN_IMPORT bool hasImageResource( const Utf8* aTag ) const; + + /** + * Sets initial/default loading size for the image resource. The given size + * is only a hint and the resource pool may used it or ignore it. Without the + * initial size hint, the image will be rasterized to size determined by the + * resource pool. The initial size hint can be overridden with the appropriate + * getImageResource() function. + * + * @param aTag Resource tag. + * @param aInitialSizeHint Initial/default size hint (only Pixel and RelativeToDisplay supported) + */ + OSN_IMPORT void setInitialSize( + const Utf8* aTag, + const TAlfXYMetric& aInitialSizeHint ); + + /** + * Sets aspect ratio mode. This affects to the aspect ratio of the loaded image + * resource. The new setting will take place when the image resource is loaded. + * + * @note Currently only SVG icons are supported. For file image loading, the aspect ratio + * is preserved. + * + * @note The blitting of the image resource can still scale and change the aspect ratio + * of the drawn image. @see ImageVisual::setScaleMode + * + * @param aTag Resource tag. + * @param aAspectRatio Used aspect ratio. + */ + OSN_IMPORT void setAspectRatio( + const Utf8* aTag, + AspectRatio aAspectRatio ); + + /** + * Finds a image resource with the given tag. The initial size or system + * default size is used. + * + * If the given resource is not found, the Image::hasTexture() returns false. + * + * @param aTag Resource tag. + * + * @return Image which can be passed to any visual/brush. + * + * @exception invalid_argument if the resource is found but cannot be instantiated + */ + OSN_IMPORT TAlfImage getImageResource( const Utf8* aTag ); + + /** + * Finds a image resouce with the given tag. The size hint may be + * used to find/re-rasterize the image resource. + * + * If the given resource is not found, the Image::hasTexture() returns false. + * + * @param aTag Resource tag. + * @param aSizeHint Rasteration size hint (only Pixel and RelativeToDisplay supported) + * + * @return Image which can be passed to any visual/brush. + * + * @exception invalid_argument if the resource is found but cannot be instantiated + */ + OSN_IMPORT TAlfImage getImageResource( + const Utf8* aTag, + const TAlfXYMetric& aSizeHint ); + +private: + + auto_ptr mResourcePoolImpl; + }; + +} // namespace Alf + +#endif // ALF_RESOURCEPOOL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/alf_scrollbarwidget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/alf_scrollbarwidget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +alf scrollbarwidget api +API for alfscrollbarwidget +c++ +alfscrollbarwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget factory API +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +//../inc/alf/ialfscrollbararrowbaseelement MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfscrollbararrowbaseelement) +//../inc/alf/ialfscrollbarconstantthumbbaseelement.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfscrollbarconstantthumbbaseelement.h) +../inc/alf/ialfscrollbardefaultbaseelement.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfscrollbardefaultbaseelement.h) +../inc/alf/ialfscrollbarmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfscrollbarmodel.h) +../inc/alf/ialfscrollbarwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfscrollbarwidget.h) +../inc/alf/alfscrollevents.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfscrollevents.h) +../inc/alf/alfscrollbarproductids.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfscrollbarproductids.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/inc/alf/alfscrollbarproductids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/inc/alf/alfscrollbarproductids.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for scrollbar widget. +* +*/ + +#ifndef ALF_SCROLLBARPRODUCTIDS_H +#define ALF_SCROLLBARPRODUCTIDS_H + +static const char* const KScrollBarWidget = "scrollbarwidget"; +static const char* const KScrollBarModel = "scrollbarmodel"; +static const char* const KScrollBarDefaultBaseElement = + "scrollbardefaultbaseelement"; +#endif // ALF_SCROLLBARPRODUCTIDS_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/inc/alf/alfscrollevents.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/inc/alf/alfscrollevents.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for scrollbar widget. + * +*/ + + +#ifndef ALF_SCROLLEVENTS_H +#define ALF_SCROLLEVENTS_H + +// WidgetModel Includes +#include + +// Widget Includes +#include +#include + +namespace Alf + { + // forward declaration + class IAlfScrollBarDefaultBaseElement; + + /** + * Flags to indicate the changes being done in the scrollbar model + * ENoChange Flag to indicate no scrollbar model data is changed + * ESpanChanged Flag to indicate Span is changed + * EViewLengthChanged Flag to indicate view length is changed + * EViewStartPosChanged Flag to indicate view start position is changed + * EFocusPosChanged Flag to indicate focus position is changed + * + * @since S60 ?S60_version + */ + enum ScrollModelChangeMask + { + ENoChange = 0, // Flag if scrollbar model data is changed + ESpanChanged = 1, // Flag to indicate Span is changed + EViewLengthChanged = 2, // Flag to indicate view length is changed + EViewStartPosChanged = 4, // Flag if view start position is changed + }; + + /** + * This structure is used to send data along with + * EEventScrollModelChanged scroll event + * + * @since S60 ?S60_version + */ + struct ScrollModelChangedEventData + { + int mSpan; // Span + int mViewLength; // View Length + int mViewStartPos; // View Start position + int mChangedMask; // combination (ORing) of one or more + // TScrollModelChangeMask enums + }; + + } // namespace Alf + +#endif // IALF_SCROLLEVENTS_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbardefaultbaseelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbardefaultbaseelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007 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: interface for the scrollbar default lct base element. +* +*/ + +#ifndef I_ALF_SCROLLBARDEFAULTLCTBASEELEMENT_H +#define I_ALF_SCROLLBARDEFAULTLCTBASEELEMENT_H + +#include +#include +#include +#include +#include + +using namespace osncore; + +namespace Alf + { + /** + * @namespace alfscrollbardefaultbaseelement + * + * ident specifies the unique identifier for the base-element. + */ + namespace alfscrollbardefaultbaseelement + { + static const IfId ident = + { + 0,"BaseElement" + }; + } +/** + * An interface for the default base element of the scrollbar. + * + * The default base element is an interface that contains the basic layouting and scrolling logic of the scrollbar widget. + * The base element provides a simple scrollbar visualization. + * It allows the user to: + * 1. Specify the TotalLength ViewLength and ThumbWidth + * 2. Specify the opacity of thumb with respect to widget opacity + * + * The default base element of the scrollbar uses Anchor Layout + * + * The default base element also acts as an eventhandler and currently listens to following events: + * 1. EEventModelChanged, EEventScrollBarClicked + * + * default base element handles EEventScrollBarClicked event(Custom Event) which are convetred to higher level events + * like EEventScrollUp ,EEventScrollDown,EEventScrollLeft,EEventScrollRight , + * On receiving these events, the default base element accordingly changes the position of the thumb + * + * + * @lib alfscrollbarwidget.lib + + * @since S60 ?S60_version + */ +class IAlfScrollBarDefaultBaseElement: public IAlfInterfaceBase + { + +public: + + /** + * Getter for the type identifier of this interface. + * Usage: + * @code + * IAlfElement* element; + * IAlfBaseElement* baseElement = + * static_cast ( + * element->makeInterface (IAlfScrollBarBaseElement::type() ) ); + * @endcode + * @see \link IAlfInterfaceBase \endlink for + * \link IAlfInterfaceBase::makeInterface \endlink + * The above code provides all the interfaces of ScrollBar base element. + * @since S60 ?S60_version + * @return Identifier of this interface. + */ + static inline const IfId& type() + { + return alfscrollbardefaultbaseelement :: ident; + } + + + /** + * Sets the animation time for the thumb movement + * Controls the movement of the thumb in the context of + * scroll + * @param aTime, Animation time in milliseconds + */ + virtual void setThumbAnimationTime ( int aTime ) = 0; + + /** + * Gets the Thumb animation time. + * + * @return Animation time. + */ + virtual int getThumbAnimationTime() const = 0; + + /** + * This function is deprecated. Use attribute APIs to set or get opacity. + * Sets the Opacity of widget. + * Default value of scrollbar opacity is 1.0. + * + * @param aOpacity Opacity of the scrollbar. The value should be between 0.0 + * to 1.0. + * + * @exception AlfException + */ + virtual void setOpacity(float aOpacity)=0; + + /** + * This function is deprecated. Use attribute APIs to set or get opacity. + * Gets the Opacity of widget. + * + * @return: Thumb opacity + */ + virtual float getOpacity() const=0; + + /** + * Sets the Opacity of thumb. This is relative to widget opacity.Default value is 1.0. + * The value of aOpacity should be between 0.0 to 1.0 + * @param aOpacity Opacity of the thumb + */ + virtual void setThumbOpacity ( float aOpacity ) = 0; + + /** + * Gets the Opacity of thumb. + * + * @return: Thumb opacity + */ + virtual float getThumbOpacity() const = 0; + + + /** + * Destructor. + */ + virtual ~IAlfScrollBarDefaultBaseElement() {} + }; // class IAlfScrollBarDefaultBaseElement + } // namespace Alf + +#endif // IALF_SCROLLBARDEFAULTLCTBASEELEMENT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbarmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbarmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2007 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: Model interface with utilities for scrollbar widget. +* +*/ + + +#ifndef IALF_SCROLLBARMODEL_H +#define IALF_SCROLLBARMODEL_H + + +//WidgetModel Includes +#include + +using namespace osncore; + +namespace Alf + { + +namespace alfscrollbarmodel + { + static const IfId ident = + { + 0, "alfscrollbarmodel" + }; + } + +/** + * An interface of the scrollbar model. + */ +class IAlfScrollBarModel : public IAlfModel + { + +public: + + /** + * Getter for the type identifier of this interface. + * + * @return A descriptor to identify the type of this interface. + */ + static inline const IfId& type() + { + return alfscrollbarmodel::ident; + } + + /** + * Function for initializing the model. + * + * The unit of paremeters aTotalLength, aViewLength, aViewStartPosition + * depends on the user of scrollbar. For example editor may + * decide to support scrolling by line,means in case of editor + * aTotalLenght can be total number of lines in the document, + * aViewlength can be the number of lines which fit inside a page/view, + * aViewstartPosition can be the line number from which view starts and + * + * (currently no visualization is there for focus position inside scrollbar) + * + * @param aTotalLength - Total length of the content or document if it + * were laid out. Minimum Value of total length can be + * 1. If a value less than 1 is passed it is converted + * to 1 automatically. + * + * @param aViewLength - Amount of TotalLength which is viewable. Minmum + * value of viewlength is 1 and maximum value is equal + * to total length. If a value less than 1 is passed + * it is converted to 1 similarly, if a value greater + * than aTotalLength is passed it is converted to + * aTotalLength. + * @param aViewStartPosition - view start position. This can be between 0 + * and (aTotalLength - aViewLength). As in + * case of total length and view length, if a + * value out side range is passed it is convered + * to the nearest boundary value (0 or + * aTotalLength - aViewLength). + * @return void. + */ + virtual void initializeData( + int aTotalLength, + int aViewLength, + int aViewStartPosition) = 0; + + /** + * Sets the Total Length for the Scrollbar + * which is the length of the document or viewable data. + * + * Arbitrary units are used, but the same units as the rest of the model. + * This length is best current estimate of the length of the entire + * viewable data in this model's direction.(i.e, vertical, horizontal). + * It represents physical extent (e.g. could be pixels), not logical size + * of the data. + * It is understood to represent the physical laid out size of the data + * if it were possible to view it all at once. + * + * @param aTotalLength - Total length of the content or document. Minimum + * Value of total length can be 1. If a value less + * than 1 is passed, it is converted to 1 + * automatically. + * If the value passed is less than the current view + * length, current view length is also changed to the + * passed total length so that view length is still + * valid. Similarly if required, view start position + * is also changed so that it is still valid. + * See the documentation of initializeData() to know + * valid values of each model data. If change of more + * than one model data is required, use changeData() + * function. + * + * @return void. + */ + virtual void setTotalLength(int aTotalLength) = 0; + + /** + * Sets the View Length for the Scrollbar + * For horizontal models, this is the width of the view. + * For veritcal, this is the height of the view. + * + * Note the units are arbitrary but uniform with the rest of the model. + * Note that this measure is proportional to the physical width or height + * of the view.This metric is sometimes called the Thumb size. + * @param aViewLegth - Amount of Total Length which is viewable. Minmum + * value of viewlength is 1 and maximum value is equal + * to total length. If a value out of range is passed + * it is converted to the nearest boundary (1 or total + * length). + * See the documentation of initializeData() to know + * valid values of each model data. If change of more + * than one model data is required, use changeData() + * function. + * @return void. + */ + virtual void setViewLength(int aViewLength) = 0; + + /** + * Sets the View Start Position for the Scrollbar + * Position in arbitrary units of the start of the currently viewed data. + * For horizontal models, this is the position of the left of the view + * relative to the far left end of the document. + * For veritcal, this is the position of the top of the view from the + * top of the viewable data. + * + * Note the units are arbitrary but uniform with the rest of the model. + * Position is in physical space as if the entire data were laid out. + * This metric is sometimes called the Thumb position. + * + * @param aViewStartPosition - start position of the viewable area. This can + * be between 0 and (aTotalLength - aViewLength + * ). If a value out side range is passed, it + * is convered to the nearest boundary value (0 + * or totalLength - viewLength) + * See the documentation of initializeData() to + * know valid values of each model data. If + * change of more than one model data is + * required, use changeData() function. + * + * @return void. + */ + virtual void setViewStartPosition(int aViewStartPosition) = 0; + + /** + * Sets TotalLength, View length and ViewStartPosition for the Scrollbar. + * + * See the documentation of initializeData() to know valid values of each + * model data. If the value passed are not valid, they are changed to the + * closest valid value. + * + * @param aTotalLength - total length + * @param aViewLength - view Length + * @param aViewStartPosition - View Start Position + * @return void. + */ + virtual void changeData( + int aTotalLength, + int aViewLength, + int aViewStartPosition) = 0; + + /** + * Length of the document or viewable data. + * (refer setter function for detailed concept). + * @return length in arbitrary units of the viewable data + */ + virtual int getTotalLength() const = 0; + + /** + * Length of the view (refer setter function for detailed concept). + * + * @return view length + */ + virtual int getViewLength() const = 0; + + /** + * Position in arbitrary units of the start of the currently viewed data + * (refer setter function for detailed concept). + * @return position of the start of the view + */ + virtual int getViewStartPosition() const = 0; + + }; + + } // namespace Alf + +#endif // IALF_SCROLLBARMODEL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbarwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbarwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for scrollbar widget. +* +*/ + +#ifndef I_ALF_SCROLLBARWIDGET_H +#define I_ALF_SCROLLBARWIDGET_H + +//WidgetModel includes +#include +#include +#include +#include + +//osn includes +#include +#include + +namespace Alf + { +namespace alfscrollbarwidget + { + /** + * @namespace alfscrollbarwidget + * + * ident specifies the unique identifier for the grid widget. + */ + static const IfId ident = + { + 0, "alfscrollbarwidget" + }; + static const Utf8* const KBaseElementName = "BaseElement"; + } + +/** + * Enumeration of selectionchanged events generated by the grid widget. + */ +enum + { + EEventScrollBarClicked = ELastCommonWidgetEvent+1111, + EEventScrollBarTouchDown, + EEventScrollBarDrag + }; + + +/** + * Interface for the scrollbar widget. + * + * Default visualization of scrollbar contains following components. + *
    + *
  • Thumb (The size of the Thumb shows the amount of scrollable content)
  • + *
  • Track (Place holder for Thumb)
  • + *
+ * + * A scrollbar widget is used along with a scrollable widget, + *
    + *
  • to show the amount of scrollable content inside scrollable widget by + * means of thumb size
  • + *
  • to generate scroll events(MoveUp and Movedown, PageUp PageDown and drag) + *
  • + *
  • to show the view start position in the scrollbale content
  • + *
+ * + * The communication between scrollbar and scrollable widget happens through + * events. Scrollbar handles only pointer events which are converted to higher + * level events like EEventScrollUp, EEventScrollDown, EEventScrollLeft, + * EEventScrollRight, EEventScrollPageUp, EEventScrollPageDown, + * EEventScrollPageLeft and EEventScrollPageRight + * and sent to scrollable widget.Scrollable widget can also generate similar + * higher level events in response to key and pointer events.In which case it + * is scrollable widget's resposibility to send these events to scrollbar. + * + */ +class IAlfScrollBarWidget: public IAlfWidget + { +public: + /** + * Get the type of widget. + * + * @return The type of widget + */ + static const IfId& type() + { + return alfscrollbarwidget::ident; + } + + /** + * Gets the Base Element Name. + * + * @return The base element's name + */ + static inline const char* baseElementName() + { + return alfscrollbarwidget::KBaseElementName; + } + + /** + * Destructor. + */ + virtual ~IAlfScrollBarWidget() {} + /** + * Sets whether or not tactile feedback is enabled. + * + * @param aFlag Whether or not tactile is enabled. + */ + virtual void enableTactile(bool aFlag) = 0; + + /** + * Returns the state of tactile feedback whether it is enabled/disabled. + * + * @param aEnabled Whether or not tactile is enabled. + */ + virtual bool IsTactileEnabled() = 0; + + }; + + } // namespace Alf + +#endif // IALF_SCROLLBARWIDGET_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_viewwidget_api/alf_viewwidget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_viewwidget_api/alf_viewwidget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +alf viewwidget api +Alf View Widget API +c++ +alfviewwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_viewwidget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_viewwidget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget factory API +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/alf/ialfviewwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfviewwidget.h) +../inc/alf/alfviewwidgetexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfviewwidgetexception.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_viewwidget_api/inc/alf/alfviewwidgetexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_viewwidget_api/inc/alf/alfviewwidgetexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2007 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: View widget exception class. +* +*/ + + +#ifndef ALFVIEWWIDGETEXCEPTION_H +#define ALFVIEWWIDGETEXCEPTION_H + +// INCLUDES +#include +#include + +namespace Alf + { + +/** + * Error codes used with AlfViewWidgetException. + * + * There is an offset in AlfViewWidgetException error codes, so that + * AlfViewWidget specific exceptions can be separated from + * osncore::AlfException base exceptions and exceptions of other widgets. + */ +enum TAlfViewWidgetErrorCode + { + /** + * Error occured in construction or initialization of the view + * widget. + */ + EInitializationError = 600, + + /** + * Handle to status pane not found + */ + EStatusPaneError, + + /** + * Handle to control pane not found + */ + EControlPaneError, + + /** + * Control group id specified in the viewwidget constructor + * already reserved. + */ + EControlGroupAlreadyExists + }; + +/** + * AlfViewWidgetException is a base class for all view widget + * exceptions. + * + */ +class AlfViewWidgetException : public osncore::AlfException + { +public: + // Constructors and destructor + + /** + * Constructor with AlfViewWidget specific error code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + */ + AlfViewWidgetException(int aError) throw(); + + /** + * Constructor with AlfViewWidget specific error code + * and additional information. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + */ + AlfViewWidgetException(int aError, const char* aInfo) throw(); + + /** + * Constructor with AlfViewWidget specific error code, + * additional information, source file and line of code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + * @param aFileAndLine Optional file and line information or NULL. + */ + AlfViewWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw(); + + /** + * Default destructor. + */ + virtual ~AlfViewWidgetException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + const char* what() const throw(); + +private: + + /** + * Error description + */ + osncore::UString mDescription; + + }; + + } // Namespace Alf + +#endif // ALFVIEWWIDGETEXCEPTION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_viewwidget_api/inc/alf/ialfviewwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_viewwidget_api/inc/alf/ialfviewwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2007 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: View widget interface. +* +*/ + + +#ifndef IALF_VIEWWIDGET_H +#define IALF_VIEWWIDGET_H + +#include +#include + +//Forward Declaration +class TAknsItemID; +class CAlfDisplay; + +namespace Alf + { + +namespace alfviewwidget + { +static const IfId ident = + { + 0, "viewwidget" + }; + + } + +/** + * An interface for the view widget. + * + * @since S60 ?S60_version + */ + +class IAlfViewWidget : public IAlfContainerWidget + { + +public: + /** + * Getter for the type identifier of this interface. + * @return A descriptor to identify the type of this interface. + * + * @since S60 ?S60_version + */ + static inline const IfId& type() + { + return alfviewwidget::ident; + } + + + /** + * This will show the view widget. The view widget will be + * shown on the top of the view stack. If the view was already + * shown it will be moved on top of the view stack. + * + * @see getViewStackPosition() + * + * @param aShow true if the view is to be shown, false if + * the view will be hidden. The view is not shown, + * till this api is called with true parameter. + * @since S60 ?S60_version + */ + virtual void show(bool aShow = true) = 0 ; + + /** + * API to make the view widget accept events. + * + * @param aAccept true if the view is to accept inputs, else false + * default value is true + * @since S60 ?S60_version + */ + virtual void acceptEvents(bool aAccept = true) = 0 ; + + /** + * API to enable/disable Avkon status pane + * + * @param aEnable true to enable the status pane, else false + * the default value is true. + * @since S60 ?S60_version + */ + virtual void enableStatusPane(bool aEnable = true) = 0; + + /** + * API to hide/show Avkon control pane + * If the AlfDisplay bound to the view widget does not occupy the + * entire client rectangle, this API has no effect. + * + * @param aEnable true to enable the control pane, else false + * the default value is true. + * @since S60 ?S60_version + */ + virtual void enableControlPane(bool aEnable = true) = 0; + + /** + * API to enable/disable Avkon Skin to be used as view widget's background. + * + * @param aSkinBackground true if the view has to use Avkon Skin as background. + * false otherwise. + * @since S60 ?S60_version + */ + virtual void useSkinBackground(bool aSkinBackground = true) = 0; + + /** + * API to use Skin with the given ID to be used as view widget's background. + * Also enables skin background. See IAlfViewWidget::useSkinBackground() + * + * @param aID Skin id of the graphics to be used in the texture. + * + * @since S60 ?S60_version + */ + virtual void setSkinBackground(TAknsItemID aSkinID) = 0; + + /** + * API to check whether the view is shown + * + * @return true if the view is shown, else false + * + * @since S60 ?S60_version + */ + virtual bool shown() = 0; + + /** + * Returns the position of the view on the view stack. + * This tells the view Z-coordinate position relative to other views. + * Top-most view returns zero. Views under that have a growing + * number of position. If the view is hidden -1 is returned. + * Only view widgets are taken into consideration in the position calculation. + * Other control groups in the display roster are ignored. For example, + * position zero doesn't mean that the control group of this view would be + * top-most. + * + * Only top-most view is activate while all other views are being deactivate. + * + * @see show() + * + * @return Position of the view, -1 if view is hidden. + */ + virtual int getViewStackPosition() const = 0; + + /** + * API to check whether the view accepts events + * + * @return true if the view accepts events, else false + * + * @since S60 ?S60_version + */ + virtual bool eventsAccepted() = 0; + + /** + * API to check whether the status pane is enabled + * + * @return true if the status pane is enabled, else false + * + * @since S60 ?S60_version + */ + virtual bool statusPaneEnabled() = 0; + + /** + * API to check whether the control pane is enabled + * + * @return true if the control pane is enabled, else false + * + * @since S60 ?S60_version + */ + virtual bool controlPaneEnabled() = 0; + + /** + * API to check whether skin info is being used for background + * or not + * + * @return true if the skin info is being used, else false + * + * @since S60 ?S60_version + */ + virtual bool usingSkinBackground() = 0; + + /** + * API to get the Avkon Skin ID being used as view widget's background. + * Use IAlfViewWidget::usingSkinBackground() to check if this is + * being used. + * + * @return Avkon Skin ID being used for view's background. + * Returns an ID with major and minor fields=-1 if + * this info was never set. + * See IAlfViewWidget::setSkinBackground() + * + * @since S60 ?S60_version + */ + virtual TAknsItemID skinBackground() = 0; + + /** + * API to Set the display area of the view widget. + * This will set the alfdisplay area with param passed + * Client need to call this api with screen/apprect to make + * view full screen or application rect + * + * @param aDisplayRect: the area in which view widget should be + * displayed + * + * @since S60 ?S60_version + */ + virtual void setRect(const TRect& aDisplayRect) = 0; + + /** + * Virtual destructor. + */ + virtual ~IAlfViewWidget () {} + + }; + +/** + * Structure to store information required to instantiate a view widget + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin during the view widget construction. + */ +struct AlfViewWidgetInitData + { + /** + * Owner environment for the widget + */ + CAlfEnv* mEnv; + + /** + * Display pointer + */ + CAlfDisplay* mDisplay; + + /** + * Widget instance ID.This uniquely identifies every widget instance + * and is its name. + * @see AlfWidget::Widgetname() + */ + const char* mWidgetId; + + /** + * Control group ID that will be used to create a new control group + * and append the view widget into. + */ + int mControlGroupId; + + /** + * Pointer to node in declaration containing information for the widget. + */ + DuiNode* mNode; + + /** + * XML file name containing the declaration for the presention of the widget. + */ + const char* mFilePath; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + }//end of namespace + +#endif // IALF_VIEWWIDGET_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetfactory_api/alf_widgetfactory_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetfactory_api/alf_widgetfactory_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +alf widgetfactory api +API for AlfWidgetFactory +c++ +alfwidgetfactory + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetfactory_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetfactory_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget factory API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// To be removed once migration to the new internal export dir has been done + +../inc/alf/ialfwidgetfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfwidgetfactory.h) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetfactory_api/inc/alf/ialfwidgetfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetfactory_api/inc/alf/ialfwidgetfactory.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,567 @@ +/* +* Copyright (c) 2007 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: Custom widget factories are registered into factory chain +* +*/ + + +#ifndef I_ALFWIDGETFACTORY_H +#define I_ALFWIDGETFACTORY_H + +//Widget Utils includes +#include + +//Widget Model Includes +#include + +//Forward declaration +class CAlfDisplay; + +//Namespaces +namespace duiuimodel + { + class DuiNode; + } + +using namespace duiuimodel; + +namespace Alf + { + +//Forward declarations +class IAlfWidget; +class IAlfModel; +class IAlfWidgetControl; +class IAlfElement; +class IAlfVisualTemplate; +class IAlfWidgetEventHandler; +class IAlfFactoryPlugin; +class IAlfViewWidget; +class IAlfContainerWidget; +class IAlfLayoutManager; + +//Namespace +namespace category + { + static const char* const KWidget = "widget"; + static const char* const KModel = "model"; + static const char* const KControl ="control"; + static const char* const KElement ="element"; + static const char* const KVisualTemplate ="visualtemplate"; + static const char* const KEventHandler = "eventhandler"; + } + +namespace alfwidgetfactory + { + static const IfId ident= + { + 0,"alfwidgetfactory" + }; + + } + +/** + * @class AlfCustomInitDataBase ialfwidgetfactory.h "alf/ialfwidgetfactory.h" + * + * Empty placeholder for custom data to be plumbed through the factory while + * creating widgets or widget parts. + * Derive from this class to pass custom data via the factory. + * + * @lib alfwidgetfactory.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfCustomInitDataBase + { +public: + + /** + * Virtual destructor. + */ + virtual ~AlfCustomInitDataBase() {} + }; + + +/** + * @class IAlfWidgetFactory ialfwidgetfactory.h "alf/ialfwidgetfactory.h" + * + * Interface to create widgets, register custom widget factories and query + * factory products. + * + * Widget factory provides methods to create widgets, event handlers, + * controls, visual templates and elements through a factory chain. + * @code + * MAlfListWidget* list = widgetFactory.CreateWidget( + * "alflistwidget"); + * if( list ) + * { + * // do operations with widget + * } + * @endcode + * + * @lib alfwidgetfactory.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfWidgetFactory: public IAlfInterfaceBase + { +public: + static inline const IfId& type() + { + return alfwidgetfactory::ident; + } + + /** + * Destructor + */ + virtual ~IAlfWidgetFactory() {} + + // Templates + + /** + * Constructs a new widget. + * + * Each widget will have to be added into a container widget. The root + * container widget of an application user interface view can be created + * with the createViewWidget() method. The widget hierarchy can be + * constructed from the root container widget by using container and leaf + * widgets. When a new widget is created a container has to be specified + * that is going to contain the created widget. The container can be a + * root container widget or some of the inner container widgets in the + * widget containment hierarchy. + * + * Widget's control is bound to a display object when this widget is first + * shown. The widget is bound to the same display that was given in the + * constructor of its containing view. + * + * @see createViewWidget() + * @see Alf::IAlfContainerWidget + * + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidArgument if both node and declaration file + * path have non-null value at the same time. + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidWidgetInstanceId if an attempt is made to + * create a widget with the Instance ID of an existing widget. + * + * @param aLoadId Widget type identifier. + * @param aInstanceId Id or name of the widget to be created. + * @param aContainerWidget Reference to a container widget that will + * contain the created widget. + * @param aNode Declarative UI node which is used to construct + * and configure this widget from a declaration. + * Default implementation if aNode is NULL. + * @param aFilePath File handle to an XML file describing the + * presentation of the widget. Both aNode and + * aFilePath cannot be non-null values at the + * same time. + * @param aCustomData Custom data to be passed to the widget during + * construction. + * + * @return Pointer to the created widget or 0. The created widget is + * maintained in the UI Accelerator Toolkit environment. + */ + template + T* createWidget( + const char* aLoadId, const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode=0, const char* aFilePath=0, + AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createWidget(aLoadId,aInstanceId,aContainerWidget, + aNode,aFilePath,aCustomData)); + } + + /** + * Destroy widget + * + * @param aWidget A widget to be destroyed. + * @return Error code, if widget was not found, 0 otherwise. + */ + template + int destroyWidget(T* aWidget) + { + return destroyWidget(static_cast(aWidget)); + } + + /** + * Create a widget model + * + * @param aLoadId Implementation to load + * @param aCustomData Custom data to be passed to the model during + * construction. + * @return Pointer to model or 0. + */ + template + T* createModel(const char* aLoadId, AlfCustomInitDataBase* aCustomData=0) + { + return static_cast(createModel(aLoadId,aCustomData)); + } + + /** + * Create a control + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aDisplay Display where control is bound + * @param aCustomData Custom data to be passed to the control during + * construction. + * @return Pointer to control or 0. + */ + template T* createControl( + const char* aLoadId, const char* aInstanceId, + CAlfDisplay* aDisplay=0, AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createControl(aLoadId,aInstanceId,aDisplay,aCustomData)); + } + + /** + * Create an element + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aControl Control Use by element contructor + * @param aCustomData Custom data to be passed to the element during + * construction. + * @return Pointer to element or 0. + */ + template T* createElement( + const char* aLoadId, const char* aInstanceId, + IAlfWidgetControl& aControl, DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createElement(aLoadId,aInstanceId,aControl,aNode,aCustomData)); + } + + /** + * Create a visual template + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aCustomData Custom data to be passed to the visual template + * during construction. + * @return Pointer to visual template or 0. + */ + template T* createVisualTemplate( + const char* aLoadId, const char* aInstanceId, + DuiNode* aNode=0, AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createVisualTemplate(aLoadId,aInstanceId,aNode,aCustomData)); + } + + /** + * Create an event handler + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aCustomData Custom data to be passed to the event handler + * during construction. + * @return Pointer to event handler or 0. + */ + template T* createEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createEventHandler(aLoadId,aInstanceId,aNode,aCustomData)); + } + + /** + * Create an layoutmanager. + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aNode declaration node. + * @param aCustomData Custom data to be passed to the layout manager + * during construction. + * @return Pointer to instance or NULL + */ + template T* createLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) + { + return static_cast( + createLayoutManager(aLoadId,aInstanceId,aNode,aCustomData)); + } + +public: + + /** + * Constructs a new view widget. + * + * Application user interface contains always at least one view widget. + * + * View widget is a container widget that can be used to contain other + * container or leaf widgets. View widget is the root of the application + * user interface view into which the widget hierarchy can be built. + * + * View widget control is appended in a control group. Each view will be + * associated with a unique control group. A unique, unreserved control + * group ID should be passed through this construction method. + * Construction method will then create a new control group for the given + * ID and append the view widget's control into the control group. When + * the view widget is destroyed also its control group is destroyed and + * the control group ID is free to be used again. If an already reserved + * control group ID is passed an osncore::AlfException is thrown with + * error code osncore::EInvalidArgument. + * + * If the application contains multiple views it is possible to apply + * transitions from a view widget to another by manipulating the + * associated control groups. + * + * View widget is bound to a single display. If no display is given as a + * construction parameter then primary display of the UI Accelerator + * Toolkit environment is used. If no display is given and there is no + * primary display in the environment an osncore::AlfException is thrown + * with error code osncore::EDisplayNotFound. + * + * @see Alf::IAlfViewWidget + * @see Alf::IAlfContainerWidget + * @see CAlfControlGroup + * + * @exception osncore::AlfException Thrown with error code + * osncore::EInvalidArgument if a control group with the + * provided id already exists and with error code + * osncore::EDisplayNotFound if no display object is provided + * and there is no primary display. + * + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidArgument if both node and declaration + * file path have non-null value at the same time. + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidWidgetInstanceId if an attempt is made to + * create a view widget with the Instance ID of an existing widget. + * + * @param aInstanceId Id or name of the view widget to be created. + * @param aControlGroupId Id of the control group to be created. This has + * to be unique and unreserved control group id. + * @param aNode Declarative UI node which is used to construct + * and configure this widget from a declaration. + * Default implementation if aNode is NULL. + * @param aDisplay Display in which the view widget is maintained. + * Primary display is used if no display is + * provided. + * @param aFilePath File handle to an XML file describing the + * presentation of the view widget. Both aNode and + * aFilePath cannot be non-null values at the same + * time. + * @param aCustomData Custom data to be passed to the widget during + * construction. + * + * @return Pointer to a new view widget or 0. The created widget is + * maintained in the UI Accelerator Toolkit environment. + */ + virtual IAlfViewWidget* createViewWidget( + const char* aInstanceId, + int aControlGroupId, + DuiNode* aNode=0, + CAlfDisplay* aDisplay=0, + const char* aFilePath=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Constructs a new widget. + * + * Each widget will have to be added into a container widget. The root + * container widget of an application user interface view can be created + * with the createViewWidget() method. The widget hierarchy can be + * constructed from the root container widget by using container and leaf + * widgets. When a new widget is created a container has to be specified + * that is going to contain the created widget. The container can be a + * root container widget or some of the inner container widgets in the + * widget containment hierarchy. + * + * Widget's control is bound to a display object when this widget is first + * shown. The widget is bound to the same display that was given in the + * constructor of its containing view. + * + * @see createViewWidget() + * @see Alf::IAlfContainerWidget + * + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidArgument if both node and declaration file + * path have non-null value at the same time. + * @exception osncore::AlfWidgetException Thrown with error code + * osncore::EInvalidWidgetInstanceId if an attempt is made to + * create a widget with the Instance ID of an existing widget. + * + * @param aLoadId Widget type identifier. + * @param aInstanceId Id or name of the widget to be created. + * @param aContainerWidget Reference to a container widget that will + * contain the created widget. + * @param aNode Declarative UI node which is used to construct + * and configure this widget from a declaration. + * Default implementation if aNode is NULL. + * @param aFilePath File handle to an XML file describing the + * presentation of the widget. Both aNode and + * aFilePath cannot be non-null + * values at the same time. + * @param aCustomData Custom data to be passed to the widget during + * construction. + * + * @return Pointer to the created widget or 0. The created widget is + * maintained in the UI Accelerator Toolkit environment. + */ + virtual IAlfWidget* createWidget( + const char* aLoadId, + const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode=0, + const char* aFilePath=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Destroy widget + * + * @param aWidget A widget to be destroyed. + * @return -1, if widget was not found, 0 otherwise. + */ + virtual int destroyWidget(IAlfWidget* aWidget) = 0; + + /** + * Find named widgets owned by the factory + * + * @param aWidgetName A widget name to be found. + * + * @return The widget pointer if it is found, 0 otherwise. + */ + virtual IAlfWidget* findWidget(const char* aWidgetName)const = 0; + + + /** + * Append widgets into the widget factory + * + * @param aWidget A widget to be added + * + * @return -1, if widget was already added to the factory, 0 otherwise. + */ + virtual int appendWidget(IAlfWidget* aWidget) = 0; + + /** + * Create a widget model + * + * @param aLoadId Implementation to load + * @param aCustomData Custom data to be passed to the model during + * construction. + * @return Pointer to widget or 0. Ownership is transferred to caller. + */ + virtual IAlfModel* createModel( + const char* aLoadId, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Create a control + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aDisplay Display where control is bound + * @param aCustomData Custom data to be passed to the control during + * construction. + * @return Pointer to created control or 0. + */ + virtual IAlfWidgetControl* createControl( + const char* aLoadId, + const char* aInstanceId, + CAlfDisplay* aDisplay=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Create an element + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aControl Control Use by element contructor + * @param aCustomData Custom data to be passed to the element during + * construction. + * @return Pointer to created element or 0. + */ + virtual IAlfElement* createElement( + const char* aLoadId, + const char* aInstanceId, + IAlfWidgetControl& aControl, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Create a visual template + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aCustomData Custom data to be passed to the visual template + * during construction. + * @return Pointer to created visual template or 0. + */ + virtual IAlfVisualTemplate* createVisualTemplate( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Create an event handler + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aCustomData Custom data to be passed to the event handler + * during construction. + * @return Pointer to created event handler or 0. + */ + virtual IAlfWidgetEventHandler* createEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Create an layoutmanager. + * + * @param aLoadId Load identifier + * @param aInstanceId Instance identifier + * @param aNode declaration node. + * @param aCustomData Possible custom initialization data for the + * layoutmanager. + * @return Pointer to created layout manager or 0. + */ + virtual IAlfLayoutManager* createLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0) = 0; + + /** + * Application can register a custom factory to create custom factory + * products. + * Ownership is transferred to a widget factory chain, + * if call is successfull. + * + * @exception std::bad_alloc + * @param aFactory Custom factory + * @return void + */ + virtual void registerCustomWidgetFactory(IAlfFactoryPlugin* aFactory) = 0; + }; + + } // namespace Alf + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/alf_widgetmodel_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/alf_widgetmodel_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +alf widgetmodel api +Alf WidgetModel API +c++ +alfwidgetmodel + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget model API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// To be removed once migration to the new internal export dir has been done + +../inc/alf/ialfbranch.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfbranch.h) +../inc/alf/ialfcontainer.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfcontainer.h) +../inc/alf/ialfelement.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfelement.h) + +../inc/alf/ialfwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfwidget.h) +../inc/alf/ialfinterfacebase.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfinterfacebase.h) +../inc/alf/alfvarianttype.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfvarianttype.h) + +../inc/alf/ialfmap.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfmap.h) +../inc/alf/ialfmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfmodel.h) +../inc/alf/ialfmodelchangeobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfmodelchangeobserver.h) +../inc/alf/ialfnavigation.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfnavigation.h) + +../inc/alf/ialflayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialflayoutmanager.h) +../inc/alf/alflayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alflayoutmanager.h) +../inc/alf/alfgridlayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfgridlayoutmanager.h) +../inc/alf/alfanchorlayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfanchorlayoutmanager.h) +../inc/alf/ialflayoutpreferences.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialflayoutpreferences.h) +../inc/alf/ialfvarianttype.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfvarianttype.h) +../inc/alf/ialfsortfunction.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfsortfunction.h) + + +../inc/alf/ialfwidgetcontrol.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfwidgetcontrol.h) +../inc/alf/ialfwidgeteventhandler.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfwidgeteventhandler.h) +../inc/alf/alfwidgetcontrol.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetcontrol.h) +../inc/alf/alfmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfmodel.h) +../inc/alf/alfmodel.inl MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfmodel.inl) + +../inc/alf/alfwidget.inl MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidget.inl) +../inc/alf/alfwidgetcontrol.inl MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetcontrol.inl) + + +../inc/alf/alfeventoutputsignalsubscriber.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfeventoutputsignalsubscriber.h) + +../inc/alf/alfelement.inl MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfelement.inl) + +../inc/alf/alfwidgeteventhandler.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgeteventhandler.h) +../inc/alf/alfwidgeteventhandler.inl MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgeteventhandler.inl) + + +../inc/alf/alfwidgetevents.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetevents.h) +../inc/alf/ialfmodelbase.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfmodelbase.h) + +../inc/alf/alfwidgetenvextension.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetenvextension.h) +../inc/alf/alfwidgetcommand.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetcommand.h) +../inc/alf/ialfgridlayoutpolicy.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfgridlayoutpolicy.h) +../inc/alf/alfflowlayoutmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfflowlayoutmanager.h) +../inc/alf/ialfflowlayoutpolicy.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfflowlayoutpolicy.h) +../inc/alf/ialfappeventlistener.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialfappeventlistener.h) +../inc/alf/attrproperty.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/attrproperty.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfanchorlayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfanchorlayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 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: anchor layout manager +* +*/ + + +#ifndef ALFANCHORLAYOUTMANAGER_H +#define ALFANCHORLAYOUTMANAGER_H + +#include +#include +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { +class IAlfWidgetControl; +class AlfAnchorLayoutManagerImpl; + +/** + * @class AlfAnchorLayoutManager alfanchorlayoutmanager.h "alf/alfanchorlayoutmanager.h" + * Anchor layout manager + * Layout manager handles the layouting of child widgets in the container widget. + * It uses IAlfLayoutPreferences-interface (@see IAlfLayoutPreferences) + * of child widgets as a guide for laying out the widgets. The layoutmanager + * is set to the IAlfHostApi- interface (@see IAlfHostApi::setBaseLayout) + * createLayout-method should be the first call after creating the layoutmanager. + * @see IAlfLayoutPreferences + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfLayoutManager, IAlfLayoutPreferences + */ +class AlfAnchorLayoutManager : public AlfLayoutManager + { + friend class AlfAnchorLayoutManagerImpl; +public: + + /** + * Layout manager constructor + * @exception std::bad_alloc + */ + OSN_IMPORT AlfAnchorLayoutManager(); + + /** + * virtual destructor + */ + OSN_IMPORT virtual ~AlfAnchorLayoutManager(); + +public: + //from IAlfLayoutManager + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the child control's layout + * must be updated + * + * @param aControl control, which size has changed. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void updateChildLayout(CAlfWidgetControl* aControl); + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which has been removed from the layout. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void childRemoved(CAlfWidgetControl* aControl); +public: +protected: + + OSN_IMPORT void doUpdateChildLayout(CAlfWidgetControl* aControl); +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: // data + auto_ptr mData; + }; + + } // namespace Alf + +#endif // ALFANCHORLAYOUTMANAGER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfelement.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfelement.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: Template interface getter for CAlfElement class. +* +*/ + + +// ----------------------------------------------------------------------------- +// Template getter for interfaces provided by the the element classes. +// The type of the queried interface is specified by the +// template parameter. +// ----------------------------------------------------------------------------- +// +template +T* AlfElement::makeInterface( AlfElement* aElement ) + { + if (aElement) + { + return static_cast< T* >( aElement->makeInterface( T::type() ) ); + } + return 0; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfeventoutputsignalsubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfeventoutputsignalsubscriber.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008 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: Event output signal subscriber interface +* +*/ + + +#ifndef ALFEVENTOUTPUTSIGNALSUBSCRIBER_H +#define ALFEVENTOUTPUTSIGNALSUBSCRIBER_H + +#include +//using namespace osncore; + +namespace Alf + { + +/** + * Event output signal subscriber interface. + */ +class IAlfEventOutputSignalSubscriber + { +public: + /** + * Called by event output signal. This method calls subscriber's callback method. + */ + virtual void receiveSignal() = 0; + virtual ~IAlfEventOutputSignalSubscriber() {} + }; + +/** + * Event output signal subscriber. + */ +template +OSN_NONSHARABLE_CLASS( AlfEventOutputSignalSubscriber ) + : public IAlfEventOutputSignalSubscriber + { +public: + explicit AlfEventOutputSignalSubscriber(T& aSubscriber, void (T::*aFnc)(void)) + :mSubscriber(aSubscriber), mFnc(aFnc) {} + + void receiveSignal() {(mSubscriber.*mFnc)();} + +private: // data + // Subscriber + T& mSubscriber; + // Callback + void (T::*mFnc)(void); + }; + + } // namespace Alf + +#endif // ALFEVENTOUTPUTSIGNALSUBSCRIBER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfflowlayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfflowlayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007 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: flow layoutmanager. +* +*/ + + +#ifndef ALFFLOWLAYOUTMANAGER +#define ALFFLOWLAYOUTMANAGER + +#include +#include +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { +class AlfFlowLayoutPolicyImpl; +class AlfFlowLayoutPreferencesImpl; + +/** @class AlfFlowLayoutManager alfflowlayoutmanager.h "alf/alfflowlayoutmanager.h" + * Flow layout manager positions children next to each other either horizontally or + * vertically. The manager sizes the children by using the preferred sizes of the + * children. @see IAlfLayoutPreferences::getPreferredSize() + * + * + * Flow layout manager takes system wide layout mirroring into consideration. + * In western locales the visuals are layed out from left to right whereas + * in arabic locale for instance the visuals are layed out from right to left. + * Mirroring is considered only when the flow is horizontal. The layout manager + * will always lay its children from top to bottom. + * + * @interfaces IAlfLayoutManager, IAlfLayoutPreferences + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ + +class AlfFlowLayoutManager : public AlfLayoutManager + { +public: + friend class AlfFlowLayoutPolicyImpl; + friend class AlfFlowLayoutPreferencesImpl; +public: + + /** + * layout manager constructor + * + * @exception std::bad_alloc + * @param aLayoutType type of layout used by this manager. + */ + OSN_IMPORT AlfFlowLayoutManager(); + + /** + * virtual destructor + */ + OSN_IMPORT virtual ~AlfFlowLayoutManager(); + +public: + //from AlfLayoutManager + + /** + * from AlfLayoutManager + * Notifies the layout manager, that the child control's layout + * must be updated. + * + * @param aControl control, which size has changed. + */ + OSN_IMPORT virtual void updateChildLayout(CAlfWidgetControl* aControl); + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); +protected: + +private: // data + + auto_ptr mData; + auto_ptr mPrefImpl; + }; + + } // namespace Alf + +#endif // ALFFLOWLAYOUTMANAGER diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfgridlayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfgridlayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007 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: grid layout manager +* +*/ + + +#ifndef ALFGRIDLAYOUTMANAGER_H +#define ALFGRIDLAYOUTMANAGER_H + +#include +#include +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { +class IAlfWidgetControl; +class AlfGridLayoutManagerImpl; +class AlfGridLayoutPolicyImpl; + +/** + * @class AlfGridLayoutManager alfgridlayoutmanager.h "alf/alfgridlayoutmanager.h" + * Grid layout manager + * Layout manager handles the layouting of child widgets in the container widget. + * It uses IAlfLayoutPreferences-interface (@see IAlfLayoutPreferences) + * of child widgets as a guide for laying out the widgets. The layoutmanager + * is set to the IAlfHostApi- interface (@see IAlfHostApi::setBaseLayout) + * createLayout-method should be the first call after creating the layoutmanager. + * @see IAlfLayoutPreferences + * @see IAlfGridLayoutPolicy + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfLayoutManager, IAlfLayoutPreferences, IAlfGridLayoutPolicy + */ +class AlfGridLayoutManager : public AlfLayoutManager + { + friend class AlfGridLayoutManagerImpl; + friend class AlfGridLayoutPolicyImpl; +public: + + /** + * Layout manager constructor + * @exception std::bad_alloc + */ + OSN_IMPORT AlfGridLayoutManager(); + + /** + * virtual destructor + */ + OSN_IMPORT virtual ~AlfGridLayoutManager(); + +public: + //from IAlfLayoutManager + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the child control's layout + * must be updated + * + * @param aControl control, which size has changed. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void updateChildLayout(CAlfWidgetControl* aControl); + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which has been removed from the layout. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void childRemoved(CAlfWidgetControl* aControl); +public: +protected: + + OSN_IMPORT void doUpdateChildLayout(CAlfWidgetControl* aControl); +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: // data + auto_ptr mData; + auto_ptr mDataPolicy; + }; + + } // namespace Alf + +#endif // ALFGRIDLAYOUTMANAGER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alflayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alflayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,243 @@ +/* +* Copyright (c) 2007 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: interface for layout managers +* +*/ + + +#ifndef ALFLAYOUTMANAGER +#define ALFLAYOUTMANAGER + +#include +#include +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { +class IAlfWidgetControl; +class AlfLayoutManagerImpl; +class IAlfLayoutPreferences; + + +/** + * @class AlfLayoutManager alflayoutmanager.h "alf/alflayoutmanager.h" + * The interface for layout managers + * + * Layout manager handles the layouting of child widgets in the container widget. + * It uses IAlfLayoutPreferences-interface (@see IAlfLayoutPreferences) + * of child widgets as a guide for laying out the widgets. The layoutmanager + * is set to the IAlfHostApi- interface (@see IAlfHostApi::setBaseLayout) + * createLayout-method should be the first call after creating the layoutmanager. + * + * Layout manager may also provide information about the layout preferences of its + * children. If this is supported the layout manager will combine the layout preferences + * of its children taking into consideration the technique used to lay out the children + * using the layout manager. This will provide information about the whole display area + * occupied by the layout manager. For instance vertical flow layout manager will provide + * preferred size area of its children by summing their heights and providing the maximum + * width among the children. + * + * @code + * // Create layout manager interface. + * IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control); + * + * // See if layout preferences is supported in the given layout manager. + * IAlfLayoutPreferences* layoutPreferences = IAlfInterfaceBase::makeInterface(layoutManager); + * + * if(layoutPreferences != 0) + * { + * TAlfXYMetric preferredSize; + * // This will report the preferred size of the layout by combining together preferred sizes of its children. + * bool result = layoutPreferences->getPreferredSize(preferredSize); + * } + * @endcode + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfLayoutManager, IAlfLayoutPreferences + */ +class AlfLayoutManager : public IAlfLayoutManager + { +public: + + /** + * layout manager constructor + * + * @param aLayoutType type of layout used by this manager. + */ + OSN_IMPORT AlfLayoutManager(TAlfLayoutType aLayoutType); + + /** + * virtual destructor + */ + OSN_IMPORT virtual ~AlfLayoutManager(); + +public: + + /** + * @return the owner control of the layoutmanager. + */ + OSN_IMPORT CAlfWidgetControl& owner() const; + + /** + * returns the control at aIndex. + * + * @param aIndex index for the control. + * @return control at aIndex + */ + OSN_IMPORT CAlfWidgetControl* getControl(int aIndex) const; + + /** + * returns the count of controls inside layoutmanager. + * + * @return count of controls inside layoutmanager + */ + OSN_IMPORT int count() const; + +public: + //from IAlfLayoutManager + + /** + * creates the layout used by this layoutmanager. + * + * @param aOwner, owner-control of the the created layout. + * @param aParentLayout parent for the created layout + * @param aLayoutIndex index, where created visual should be placed in the parent layout. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aLayoutIndex is out of bounds. + * @exception osncore::AlfVisualException Thrown with error code osncore::ECanNotCreateVisual if the layout creation failed. + */ + OSN_IMPORT virtual void createLayout(CAlfWidgetControl& aOwner, + CAlfLayout* aParentLayout, int aLayoutIndex); + + /** + * from IAlfLayoutManager + * Returns the layout used by this layoutmanager. + * + * @return layout used by this layoutmanager. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if layout is not created. + */ + OSN_IMPORT virtual CAlfLayout& getLayout() const; + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the child control's layout + * must be updated + * + * @param aControl control, which size has changed. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if layout is not created. + * + */ + OSN_IMPORT virtual void updateChildLayout(CAlfWidgetControl* aControl); + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that all the child control's layouts + * must be updated. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if layout is not created. + */ + OSN_IMPORT virtual void updateChildrenLayout(); + + /** + * from IAlfLayoutManager + * Notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which has been removed from the layout. + * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if layout is not created. + */ + OSN_IMPORT virtual void childRemoved(CAlfWidgetControl* aControl); + +protected: + /** + * Notifies the layout manager, that the child control's layout + * must be updated. Called in updateChildLayout for the updated control + * and in updateChildrenLayout for all the controls in the layout. + * + * @param aControl control, which size has changed. + */ + OSN_IMPORT virtual void doUpdateChildLayout(CAlfWidgetControl* aControl); + + /** + * returns the rect of the control. + * + * @param aControl, control, which size is queried. + * @param aRect will receive the rect of aControl, if return value is true. + * @return true, if control rect was fetched, false, if the control hasn't + * got a visualization. + */ + OSN_IMPORT bool controlRect( + CAlfWidgetControl& aControl, TAlfRealRect& aRect); + + /** + * sets the size and position to the control + * + * @param aControl, control, which size and position is being set. + * @param aRect, rect for aControl + */ + OSN_IMPORT void setControlRect( + CAlfWidgetControl& aControl, const TAlfRealRect &aRect); + + /** + * sets the position to the control + * + * @param aControl, control, which position is being set. + * @param aPos, position for aControl + */ + OSN_IMPORT void setControlPosition( + CAlfWidgetControl& aControl, const TAlfRealPoint& aPos); + + /** + * sets the size to control + * + * @param aControl, control, which size is being set. + * @param aSize, new size for aControl. + */ + OSN_IMPORT void setControlSize( + CAlfWidgetControl& aControl, const TAlfRealPoint &aSize); + + /** + * returns layout preferences for aControl + * + * @return layout preferences for aControl. + */ + OSN_IMPORT const IAlfLayoutPreferences* getLayoutPreferences( + CAlfWidgetControl* aControl) const; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); +private: // data + + auto_ptr mData; + + }; + + } // namespace Alf + +#endif // ALFLAYOUTMANAGER diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + + +#ifndef ALFMODEL_H +#define ALFMODEL_H + + +//INCLUDES +#include +#include +#include +#include +namespace osncore + { +template class AlfPtrVector; + } +namespace std + { +template class auto_ptr; + } + +using namespace osncore; +using namespace std; + +namespace Alf + { + +/* Forward declarations*/ +class IAlfVariantType; +class IAlfModelChangeObserver; +class AlfModelOperation; +class AlfWidgetImpl; +class AlfModelImpl; +class IfId; + + +/** @class AlfModel alfmodel.h "alf/alfmodel.h" + * Concerete implementation of the IAlfModel + * + * @interfaces IAlfModel + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfModel : public IAlfModel + { +public: + + /** + * Constructor. + * @exception std::bad_alloc + * + * @param aDataSource - datasource from where the model is initialized, + * ownership is transferred to the model + * @since S60 ?S60_version + * @return New object. + */ + OSN_IMPORT AlfModel( IAlfVariantType* aDataSource); + + + /** + * The Default constructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfModel(); + + /** + * Class Destructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT virtual ~AlfModel(); + + + //IAlfModel virtual Methods + + /** + * From IAlfModel. + * Add a new observer to be notified of any changes in the model. + * + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * @param aObserver The model change observer to be added. + * + * @return void + */ + OSN_IMPORT virtual void addModelChangeObserver( + IAlfModelChangeObserver &aObserver); + + /** + * From IAlfModel. + * Remove an observer which is added to get notified of any changes + * in the model. + * + * @since S60 ?S60_version + * @param aObserver The model change observer to be removed. + * + * @return void + */ + OSN_IMPORT virtual void removeModelChangeObserver( + IAlfModelChangeObserver &aObserver); + + + /** + * From IAlfModel. + * Get the root data object of this model. + * + * @since S60 ?S60_version + * @return The root data object. + */ + OSN_IMPORT virtual IAlfVariantType* data() const; + + /** + * From IAlfModel. + * Clears the Model. + * + * @since S60 ?S60_version + * @return void + */ + OSN_IMPORT virtual void clearModel(); + + + /** + * Api to change the model completely at one short. From IAlfModel + * + * @since S60 ?S60_version + * @param aData The new data. + */ + OSN_IMPORT void setData(IAlfVariantType* aData); + + /** + * Change a given of data fields in the model . All model change + * observers are notified about the change. + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidModelOperation when the operation fails. + * + * @since S60 ?S60_version + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + * @param aData - The new data to be set + */ + OSN_IMPORT void updateData( + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData ) ; + + /** + * Add a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidModelOperation when the operation fails. + * + * @since S60 ?S60_version + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + * + * @param aData The new data. + */ + OSN_IMPORT void addData( + int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData ); + + /** + * Remove a number of data fields in the model data. All model change + * observers are notified about the change. + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidModelOperation when the operation fails. + * + * @since S60 ?S60_version + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + */ + OSN_IMPORT void removeData( + int aNumContainerIndices, + int* aContainerIndices) ; + + /** + * Api for executing batch operations + * + * @exception osncore::AlfDataException Thrown with the error code + * osncore::EInvalidModelOperation when the operation fails. + * + * @since S60 ?S60_version + * @param aOperationsArray - An RPOinterArray containing the list of + * operations to be executed in batch. + */ + OSN_IMPORT void executeOperations( + AlfPtrVector& aOperationsArray); + + /** + * Api for executing one operation at a Time + * + * @since S60 ?S60_version + * @param aOperation - An Operation to be executed on the model. + */ + OSN_IMPORT void executeOperation(AlfModelOperation* aOperation); + + /** + * Notifies the observers, that the model has changed. + */ + OSN_IMPORT void notifyModelChanged(); + + +// from base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the widget classes. + * Derived classes should always call the base class method + * from the overridden makeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + + +protected: + +private: + /** + * Internal addDataL method . + * @param aAddOperation - An Addoperation + * @since S60 ?S60_version + */ + void addData(AlfModelOperation* aAddOperation); + + /** + * Internal removeDataL method . + * @param aRemoveOperation - A remove operation + * @since S60 ?S60_version + */ + void removeData(AlfModelOperation* aRemoveOperation); + + /** + * Internal updateDataL method . + * @param aUpdateOperation - An update operation + * @since S60 ?S60_version + */ + void updateData(AlfModelOperation* aUpdateOperation); + +private: + + auto_ptr mData; + + }; + + } // namespace Alf + +#endif // ALFMODEL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfmodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfmodel.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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: The base class for all widgets. +* +*/ + + +// ----------------------------------------------------------------------------- +// Template getter for interfaces provided by the widget, the control, +// or the model. The type of the queried interface is specified by the +// template parameter. +// ----------------------------------------------------------------------------- +// +template +T* AlfModel::makeInterface( AlfModel* aWidget ) + { + return static_cast< T* >( AlfModel::makeInterface( aWidget, T::type() ) ); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfvarianttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfvarianttype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1102 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + +#ifndef ALFVARIANTTYPE_H +#define ALFVARIANTTYPE_H + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace osncore + { +class UString; + } +namespace std + { +template class auto_ptr; + } + +using namespace osncore; +using std::auto_ptr; + +namespace Alf + { + +// FORWARD DECLARATIONS +class IAlfContainer; +class IAlfMap; +class AlfBranch; +class AlfVariantDataImpl; +class AlfContainerDataImpl; +class AlfMapDataImpl; +class AlfBranchDataImpl; +class IAlfModelBase; +// CLASS DECLARATIONS + +/** + * @class AlfVariantType alfvarianttype.h "alf/alfvarianttype.h" + * Concrete implementation of the variant data type interface. + * AlfVariantType can hold data of integer,real,string and unsigned integer types. + * @see IAlfVariantType + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfVariantType: public IAlfVariantType + { +public: + + /** + * Constructor for variant data type creation for a descriprtor type of data + * @exception std::bad_alloc + * + * @param aValue - Descriptor to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(const UString& aValue); + + + /** + * Constructor for variant data type creation for a integer type of data + * @exception std::bad_alloc + * + * @param aValue - integer to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(const int& aValue); + + + /** + * Constructor for variant data type creation for a Unsigned integer type of data + * @exception std::bad_alloc + * + * @param aValue - unsigned integer to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(const uint& aValue); + + + /** + * Constructor for variant data type creation for a real type of data + * @exception std::bad_alloc + * + * @param aValue - Real value to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(const double& aValue); + + + /** + * Constructor for variant data type creation for a user defined type of data + * @exception std::bad_alloc + * + * @param aValue - IAlfModelBase* to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(IAlfModelBase* aValue) ; + + /** + * Constructor for variant data type creation for a bool type of data + * @exception std::bad_alloc + * + * @param aValue - Boolean value to be assigned for the variant data + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(const bool& aValue); + + //from IAlfVariantType Interface + /** + * Set the Data the variantData. From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is of invalid type. + * @exception std::bad_alloc + * + * @param aValue The new value. + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void set(IAlfVariantType& aValue); + + /** + * Get the data type.From IAlfVariantType Interface + * + * @since S60 ?S60_version + * @return The data type. + */ + OSN_IMPORT IAlfVariantType::Type type() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of boolean type. + * + * @return bool data value. + * @since S60 ?S60_version + */ + OSN_IMPORT bool boolean() const; + + /** + * Get the data value as an Integer .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of integer type. + * + * @return Integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT int integer() const; + + /** + * Get the data value as unsigned int.From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of unsigned integer type. + * + * @return unsigned integer value. + * @since S60 ?S60_version + */ + OSN_IMPORT uint uinteger() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of real type. + * + * @return real data value. + * @since S60 ?S60_version + */ + OSN_IMPORT double real() const; + + /** + * Get the data value as an Descriptor .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of string type. + * + * @return string data value. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& string() const; + + /** + * Get the data value as an Container .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfVariantType is not a container. + * + * @return AlfContainer . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfContainer* container(); + + /** + * Get the data value as Map .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfVariantType is not a map. + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* map() ; + + /** + * Get the data value as Branch .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfVariantType is not a branch. + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfBranch* branch() ; + + /** + * Get the data value as a User Defined Data Pointer. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is not of custom type. + * + * @return IAlfModelBase interface. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfModelBase* customData(); + + /** + * Destructor + * + * @return + * @since S60 ?S60_version + */ + OSN_IMPORT ~AlfVariantType(); + + + /** + * The default constructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfVariantType(); + + /** + * Equality comparison operator. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aValue + * is of invalid type. + * + * @param aOther object to compare against. + * @since S60 ?S60_version + */ + OSN_IMPORT bool operator==(const IAlfVariantType& aOther) const; + +private: + + + /** + * 2nd Phase Constructor + * + * @since S60 ?S60_version + * @param aType + */ + void construct(Type aType); + + +private: + //data owned + auto_ptr mVarData; + + }; + + +/** + * @class AlfVariantType alfvarianttype.h "alf/alfvarianttype.h" + * Concrete implementation of the variant data type interface. + * Simple default container of variant types. + * @see IAlfContainer + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfContainer : public IAlfContainer + { +public: + + /** + * Constructor for creating a variant data type which can store a alfcontainer + * @exception std::bad_alloc + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfContainer(); + + /** + * Destructor + * @since S60 ?S60_version + */ + OSN_IMPORT ~AlfContainer(); + + //IAlfContainer APIs + + /** + * Adds a variantData item into the container .From IAlfContainer interface + * @aData variant data to be added into the container. Ownership is transferred + * if the method completes without exceptions. If there is an exception + * (e.g. due to out of memory), the client code is responsible for cleaning up the object. + * @exception std::bad_alloc + * + * @return void. + * @since S60 ?S60_version + */ + OSN_IMPORT void addItem(IAlfVariantType* aData); + + /** + * Adds a variantData item into the container .From IAlfContainer interface + * @aIndex index where the data is added + * @aData variant data to be added into the container. Ownership is transferred + * if the method completes without exceptions. If there is an exception + * (e.g. due to out of memory), the client code is responsible for cleaning up the object. + * @exception std::bad_alloc + * + * @return void. + * @since S60 ?S60_version + */ + OSN_IMPORT void addItem(uint aIndex, IAlfVariantType* aData); + + /** + * Gets the Number of items in the container . From IAlfContainer interface + * + * @return number of items in the container + * @since S60 ?S60_version + */ + OSN_IMPORT int count(); + + /** + * Gets the Item at a given index in the container From IAlfContainer interface + * @param aIndex - index at which the element is required + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* item(uint aIndex); + + /** + * Clones the entire container From IAlfContainer interface + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if + * there is an invalid data type in the container. + * + * @return the cloned container + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfContainer* clone(); + + + /** + * Removes an item from given index in the container. From IAlfContainer interface + * @param aIndex - index at which the element is to be removed. + * @return item as a IAlfVariantType + * @since S60 ?S60_version + */ + OSN_IMPORT void removeItem(uint aIndex); + + /** + * Clear the Container. From IAlfContainer interface + * + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void clear() ; + + /** + * Replace an item from given index in the container. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidContainerOperation if + * the replaceItem fails. + * + * @param aIndex - index at which the element is to be replaced + * @param aNewData - new Data to be replaced + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void replaceItem(uint aIndex, IAlfVariantType* aNewData ); + + /** + * sorts the container using user defined sort function. + * + * @param aSortFunction - sort function. + * @since S60 ?S60_version + */ + OSN_IMPORT void sort( const IAlfSortFunction& aSortFunction ); + + //from IAlfVariantType Interface + /** + * Set the Data the variantData. From IAlfVariantType Interface. + * Always throws an exception always. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidContainerOperation always. + * Use the addItem API. + * + * @param aValue The new value. + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void set(IAlfVariantType& aValue); + + /** + * Get the data type.From IAlfVariantType Interface + * + * @return The data type. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType::Type type() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not boolean. + * + * @return bool data value. + * @since S60 ?S60_version + */ + OSN_IMPORT bool boolean() const; + + /** + * Get the data value as an Integer .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not an integer. + * + * @return Integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT int integer() const; + + /** + * Get the data value as unsigned int.From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not an unsigned integer. + * + * @return unsigned integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT uint uinteger() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not a real value. + * + * @return real data value. + * @since S60 ?S60_version + */ + OSN_IMPORT double real() const; + + /** + * Get the data value as an Descriptor .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not a string. + * + * @return string data value. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& string() const; + + /** + * Get the data value as an Conatiner .From IAlfVariantType Interface. + * + * @return AlfContainer . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfContainer* container(); + + /** + * Get the data value as Map .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not a map. + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* map(); + + /** + * Get the data value as Branch .From IAlfVariantType Interface. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not a map. + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfBranch* branch(); + + /** + * Get the data value as a User Defined Data Pointer. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfContainer is not a custom data type. + * + * @return IAlfModelBase interface. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfModelBase* customData(); + + /** + * Equality comparison operator. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidContainerOperation always. + * + * @param aOther object to compare against. + * @since S60 ?S60_version + */ + OSN_IMPORT bool operator==(const IAlfVariantType& aOther) const; +private: + void construct(); + //Data owned + auto_ptr mContainerData; + + }; + +/** + * @class AlfMap alfvarianttype.h "alf/alfvarianttype.h" + * Concrete implementation of the variant data type interface. + * Simple map of variant types.The map is contains data and a key. + * @see IAlfMap + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfMap : public IAlfMap + { +public: + + + /** + * 1st phase Constructor for creating a variant data type which can store a AlfMap + * @exception std::bad_alloc + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfMap(); + + + + //IAlfContainer APIs + + /** + * Gets the Number of items in the container . From IAlfContainer interface + * + * @return number of items in the container + * @since S60 ?S60_version + */ + OSN_IMPORT int count() const; + + /** + * Gets the Item at a given index in the container From IAlfContainer interface + * @param aIndex - index at which the element is required + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* item(uint aIndex); + + /** + * Clones the entire container From IAlfContainer interface + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if + * there is an invalid data type in the container. + * + * @return the cloned container + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* clone(); + + + /** + * Removes an item from given index in the container. From IAlfContainer interface. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidMapOperation if + * the removeItem fails. + * + * @param aIndex - index at which the element is to be removed + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void removeItem(uint aIndex); + + /** + * Clear the Container. From IAlfContainer interface + * + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void clear() ; + + /** + * Replace an item from given index in the container + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidMapOperation if + * the replaceItem fails. + * @param aIndex - index at which the element is to be replaced + * @param aNewData - new Data to be replaced + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void replaceItem(uint aIndex, IAlfVariantType* aNewData ); + + + + //IAlfMap Interface APis + + /** + * Gets the Item for a given name in the map. From IAlfContainer interface + * @param aName - name of the element that is required + * @return item as a IAlfVariantType + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* item(const UString& aName); + + /** + * Gets the index of the item by the given name. + * @param aName The name associated with requested item. + * @return The index corresponding to the name of the item. + * @since S60 ?S60_version + */ + OSN_IMPORT int itemIndex(const UString& aName); + + /** + * Removes an item for a given Name in map. From IAlfContainer interface + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidMapOperation if + * the removeItem fails. + * + * @param aName - name of the element that is to be removed + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + OSN_IMPORT void removeItem(const UString& aName); + + /** + * Replace an item for a given name in the container + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidMapOperation if + * the replaceItem fails. + * + * @param aName - name of the element that is to be replaced + * @param aNewData - new Data to be replaced + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void replaceItem(const UString& aName,IAlfVariantType* aNewData); + + /** + * Adds a variantData item into the container .From IAlfContainer interface + * @exception std::bad_alloc + * + * @param aName - name of the data that needs to be added + * @param aData- variant data to be added into the container. Ownership is transferred + * if the method completes without exceptions. If there is an exception + * (e.g. due to out of memory), the client code is responsible for cleaning up the object. + * @return void. + * @since S60 ?S60_version + */ + OSN_IMPORT void addItem(IAlfVariantType* aData, const UString& aName); + + /** + * Adds a variantData item into the container .From IAlfContainer interface + * @exception std::bad_alloc + * + * @aIndex index where the data is added + * @param aName - name of the data that needs to be added + * @param aData- variant data to be added into the container. Ownership is transferred + * if the method completes without exceptions. If there is an exception + * (e.g. due to out of memory), the client code is responsible for cleaning up the object. + * @return void. + * @since S60 ?S60_version + */ + OSN_IMPORT void addItem(uint aIndex, IAlfVariantType* aData, const UString& aName); + + /** + * Gets the Name at a given index in the container + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidArrayIndex if + * aIndex is invalid. + * + * @param aIndex - index at which the name of the element in the map is required + * @return item name as a TPtr + * @since S60 ?S60_version + */ + const UString& name(uint aIndex) const; + + //class methods + /** + * Destructor + * @since S60 ?S60_version + */ + OSN_IMPORT ~AlfMap(); + + + //from IAlfVariantType Interface + /** + * Set the Data the variantData. From IAlfVariantType Interface. + * Always throws an exception always. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidMapOperation always. + * Use the addItem API. + * @param aValue The new value. + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void set(IAlfVariantType& aValue); + + /** + * Get the data type.From IAlfVariantType Interface + * + * @return The data type. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType::Type type() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not boolean. + * + * @return bool data value. + * @since S60 ?S60_version + */ + OSN_IMPORT bool boolean() const; + + /** + * Get the data value as an Integer .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not an integer. + * + * @return Integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT int integer() const; + + /** + * Get the data value as unsigned int.From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not an unsigned integer. + * + * @return unsigned integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT uint uinteger() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not a real value. + * + * @return double data value. + * @since S60 ?S60_version + */ + OSN_IMPORT double real() const; + + /** + * Get the data value as an Descriptor .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not a string value. + * + * @return string data value. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& string() const; + + /** + * Get the data value as an Conatiner .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not a container. + * + * @return AlfContiner . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfContainer* container(); + + /** + * Get the data value as Map .From IAlfVariantType Interface + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* map(); + + /** + * Get the data value as Branch .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not a branch. + * + * @return Branch + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfBranch* branch(); + + /** + * Get the data value as a User Defined Data Pointer. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfMap is not a custom data type. + * + * @return IAlfModelBase interface. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfModelBase* customData(); + + /** + * Equality comparison operator. + * + * @since S60 ?S60_version + */ + OSN_IMPORT bool operator==(const IAlfVariantType& aOther) const; + +private: + void construct(); + //data + auto_ptr mMapDataImpl; + }; + +/** + * @class AlfBranch alfvarianttype.h "alf/alfvarianttype.h" + * Concrete implementation of the variant data type interface. + * @see IAlfBranch + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfBranch: public IAlfBranch + { +public: + + + /** + * Parameterized Constructor + * @exception std::bad_alloc + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfBranch( IAlfMap* aData, IAlfMap* aChildData); + + /** + * Default Constructor + * @exception std::bad_alloc + * + * @since S60 ?S60_version + */ + OSN_IMPORT AlfBranch(); + + /** + * + * @return + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* data(); + + /** + * + * @param aData - + * @return void. + * @since S60 ?S60_version + */ + OSN_IMPORT void setData( IAlfMap* aData ); + + /** + * + * @param aIndex - + * @return . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType* childData(int aIndex); + + /** + * + * @param aIndex - + * @return . + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& childName(int aIndex); + + /** + * + * @return . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* childData(); + + /** + * + * @param aChildData - + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void setChildData( IAlfMap* aChildData ); + + /** + * + * @return + * @since S60 ?S60_version + */ + OSN_IMPORT uint childrenCount(); + + /** + * Destructor + * @since S60 ?S60_version + */ + OSN_IMPORT ~AlfBranch(); + + /** + * sorts the branch using user defined sort function. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidBranchOperation if + * sorting fails. + * + * @param aSortFunction - sort function. + * return void + * @since S60 ?S60_version + */ + OSN_IMPORT void sort( const IAlfSortFunction& aSortFunction ); + + /** + * Function to Clone the Branch + * @exception std::bad_alloc + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidBranchOperation if + * cloning fails. + * + * @return + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfBranch* clone(); + + + //from IAlfVariantType Interface + /** + * Set the Data the variantData. From IAlfVariantType Interface + * Always throws an exception always. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidBranchOperation always. + * Use the setData API. + * + * @param aValue The new value. + * @return void + * @since S60 ?S60_version + */ + OSN_IMPORT void set(IAlfVariantType& aValue); + + /** + * Get the data type.From IAlfVariantType Interface + * + * @return The data type. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfVariantType::Type type() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not boolean. + * @return bool data value. + * @since S60 ?S60_version + */ + OSN_IMPORT bool boolean() const; + + /** + * Get the data value as an Integer .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not an integer. + * + * @return Integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT int integer() const; + + /** + * Get the data value as unsigned int.From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not an unsigned integer. + * + * @return unsigned integer data value. + * @since S60 ?S60_version + */ + OSN_IMPORT uint uinteger() const; + + /** + * Get the data value as an bool .From IAlfVariantType Interface + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not a real value. + * + * @return real data value. + * @since S60 ?S60_version + */ + OSN_IMPORT double real() const; + + /** + * Get the data value as an Descriptor .From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not a string value. + * + * @return string data value. + * @since S60 ?S60_version + */ + OSN_IMPORT const UString& string() const; + + /** + * Get the data value as an Conatiner. From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not a container. + * + * @return AlfContiner . + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfContainer* container(); + + /** + * Get the data value as Map. From IAlfVariantType Interface + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not a map. + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfMap* map(); + + /** + * Get the data value as Branch. From IAlfVariantType Interface + * + * @return Map + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfBranch* branch(); + + /** + * Get the data value as a User Defined Data Pointer. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType always + * since AlfBranch is not a custom value. + * + * @return IAlfModelBase interface. + * @since S60 ?S60_version + */ + OSN_IMPORT IAlfModelBase* customData(); + + /** + * Equality comparison operator. + * Always throws an exception. + * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidBranchOperation always. + * + * @param aOther object to compare against. + * @since S60 ?S60_version + */ + OSN_IMPORT bool operator==(const IAlfVariantType& aOther) const; +private: + /** + * 2nd Phase Constructor + * @return + * @since S60 ?S60_version + */ + void construct( IAlfMap* aData, IAlfMap* aChildData); + +private: + + //Data - owned + auto_ptr mBranchData; + + + }; + + } // namespace Alf + +#endif // ALFVARIANTTYPE_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidget.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidget.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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: Template interface getter for CAlfWidget class. +* +*/ + + +// ----------------------------------------------------------------------------- +// Template getter for interfaces provided by the widget, the control, +// or the model. The type of the queried interface is specified by the +// template parameter. +// ----------------------------------------------------------------------------- +// +template +T* AlfWidget::makeInterface( AlfWidget* aWidget ) + { + return static_cast< T* >( AlfWidget::makeInterface( aWidget, T::type() ) ); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcommand.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2007 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: widget commands +* +*/ + + +#ifndef ALFWIDGETCOMMAND_H +#define ALFWIDGETCOMMAND_H + +#include +#include + +using namespace osncore; + +namespace Alf + { + +// FORWARD DECLARATIONS + class AlfAttribute; + class AlfWidget; + +/** + * @class TAlfWidgetAttributeCommand alfwidgetcommand.h "alf/alfwidgetcommand.h" + * + * AlfCommand type for carrying an attribute and delivering + * it to a presentation element of a recipient widget. + * + * @see AlfAttribute + * @since S60 ?S60_version + */ +class TAlfWidgetAttributeCommand : public TAlfObjectCommand + { + public: + /** + * Constructor. + * + * @param aAttribute The attributes to be set + * @param aTarget Name of the target AlfElement instance + * @param aRecipient Widget that the command is to be executed on + * @since S60 ?S60_version + */ + TAlfWidgetAttributeCommand( + AlfAttribute* aAttribute, + UString& aTarget, + AlfWidget* aRecipient ); + + /** + * Destructor + */ + ~TAlfWidgetAttributeCommand(); + + /* Implementation of TAlfCommand::ExecuteL(). */ + void ExecuteL(CAlfEnv& aEnv) const; + + /* Implementation of TAlfCommand::Size(). */ + TInt Size() const; + + public: + AlfAttribute* mOwnedAttribute; // Owned + UString mTarget; + }; + + + } // namespace Alf + +#endif // ALFWIDGETCOMMAND_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,718 @@ +/* +* Copyright (c) 2007 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: The base class for all widget controls. +* +*/ + + +#ifndef ALFWIDGETCONTROL_H +#define ALFWIDGETCONTROL_H + +#include +#include // for OSN operator new parameter types +#include +#include +#include +#include +namespace osncore + { +template class AlfPtrVector; + } + +namespace std + { +template class auto_ptr; + } + +using namespace osncore; +using namespace std; + +namespace Alf + { +class IAlfContainerWidget; +class IAlfWidgetEventHandler; +class IAlfElement; +class AlfWidget; +class IAlfMap; +class IAlfVariantType; +class AlfWidgetControlImpl; +class IAlfHostAPI; +class IfId; +class ElementData; + +/** @class CAlfWidgetControl alfwidgetcontrol.h "alf/alfwidgetcontrol.h" + * The base class for all widget controls. + * Widget controls are derived from Alfred controls, and owned by + * the Alfred environment or control groups. Controls are responsible + * for the widget logic, i.e., storing and controlling the state of + * the widget. This usually includes input event handling, updating + * the presentation, and communication with the model, the application, + * and other controls. Event handlers can be used to implement parts + * of the widget logic. + * + * @interfaces IAlfWidgetControl, IAlfHostAPI, IAlfAttributeOwner + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class CAlfWidgetControl : + public CAlfControl, + public IAlfModelChangeObserver, + public IAlfWidgetControl + { +public: + + /** + * The constructor. + * + * @since S60 ?S60_version + * @param aEnv The Alfred environment. + */ + OSN_IMPORT CAlfWidgetControl(CAlfEnv& aEnv); + + + /** + * operator new method to ensure correct OS-neutral handling of failure to + * allocate memory. + * + * This operator will throw std::bad_alloc if memory cannot be allocated. + * If memory is successfully allocated, it will fill all bytes of allocated + * memory with zero. + * + * Note that the parameter list below is not relevant to the actual usage + * which is typically: + * + * auto_ptr control(new(EMM) CAlfWidgetControl(aEnv)); + * or + * CAlfWidgetControl* mControl = new(EMM) CAlfWidgetControl(aEnv); + * + * @exception Throws std::bad_alloc if there is a failure to allocate + * memory for the object under construction. + * + * @param aSize The number of bytes required for an instance of the class. + * This parameter is supplied automatically. + * @param aEnumValue An enumeration value of newarg. Always use EMM. + * @return a pointer to the zero-ed memory allocated on the heap. + * Ownership transferred to caller. + */ + OSN_IMPORT void* operator new(size_t aSize, newarg aEnumValue) + throw (std::bad_alloc); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~CAlfWidgetControl(); + + /** + * Set the owner widget of this control. + * Called by AlfWidget::setControlL(). + * + * @since S60 ?S60_version + * @param aWidget The owner widget of this control. + */ + void setOwnerWidget( AlfWidget* aWidget ); + + /** + * Returns top level layout. Returns NULL if this control does not + * + * @return Pointer to top level layout, or NULL if not available. + */ + OSN_IMPORT CAlfLayout* ContainerLayout( + const CAlfControl* /*aConnected*/) const; + + /** + * state. + */ + OSN_IMPORT uint state() const; + + /** + * sets the state. + */ + OSN_IMPORT void setState( uint aState ); + + /** + * enables State. + */ + OSN_IMPORT void enableState( uint aState ); + + /** + * disables State. + */ + OSN_IMPORT void disableState( uint aState ); + + /** + * checks State. + */ + OSN_IMPORT bool checkState( uint aState ) const; + + /** + * returns no of event handlers. + */ + OSN_IMPORT int numEventHandlers() const; + + /** + * returns the event handlers at the index. + */ + OSN_IMPORT IAlfWidgetEventHandler& eventHandler( int aIndex ); + + /** + * returns event handler index. + */ + OSN_IMPORT int eventHandlerIndex( + IAlfWidgetEventHandler& aEventHandler ) const; + + /** + * returns finds the event handler . + */ + OSN_IMPORT IAlfWidgetEventHandler* findEventHandler( + const TAlfEvent& aEvent ); + + /** + * adds an event handler. + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when user tries to add an event handler at an + * index but it fails. + */ + OSN_IMPORT void addEventHandler( + IAlfWidgetEventHandler* aEventHandler, + int aIndex = -1 ); + + /** + * removes an event handlers. + */ + OSN_IMPORT void removeAndDestroyEventHandler( + IAlfWidgetEventHandler& aEventHandler ); + + /** + * returns no of event handlers. + */ + OSN_IMPORT void removeEventHandler( + IAlfWidgetEventHandler& aEventHandler ); + + /** + * Remove and destroy an event handler from the control bases on its name. + * + * @since S60 ?S60_version + * @param aHandlerId The name/Id of the event handler to be removed + * and destroyed. + */ + OSN_IMPORT void removeAndDestroyEventHandler( const UString& aHandlerId ); + + /** + * Remove and destroy an event handler from the control bases on its name. + * + * @since S60 ?S60_version + * @param aHandlerId The name/Id of the event handler to be removed + * and destroyed. + */ + OSN_IMPORT void removeAndDestroyEventHandler( UString& aHandlerId ); + + /** + * Remove and destroy all event handlers associated with presentation + * elements. + * @since S60 ?S60_version + */ + OSN_IMPORT void removeAndDestroyPresentationEventHandlers(); + + /** + * Removes all event handlers associated with presentation elements from + * this control. + * + * @since S60 ?S60_version + */ + OSN_IMPORT void removePresentationEventHandlers(); + + /** + * Returns no of elements. + */ + OSN_IMPORT int numElements() const; + + /** + * Returns an element at the index. + */ + OSN_IMPORT IAlfElement& element( int aIndex ); + + /** + * Finds an element with specified name. + */ + OSN_IMPORT IAlfElement* findElement( const char* aName ); + + /** + * Adds an element in the end. + * @exception std::bad_alloc + * @exception osncore::AlfException Thrown with the error code + * osncore::ECommonError if the given element object has been added + * in the widget control already. + * + * @param aElement Element to be added. + * Ownership is transferred iff no exception is thrown. + */ + OSN_IMPORT void addElement( IAlfElement* aElement ); + + /** + * removes and destroys an element. + */ + OSN_IMPORT void removeAndDestroyElement( const IAlfElement& aElement ); + + /** + * removes an element but does not destroy it. + */ + OSN_IMPORT void removeElement( const IAlfElement& aElement ); + + /** + * Returns the data id of an element. + */ + OSN_IMPORT virtual uint elementDataId( + const IAlfElement& aElement, + uint aIndex, + uint aParentDataId ); + + /** + * Returns the data id of the parent element of an element. + */ + OSN_IMPORT virtual uint parentElementDataId( + const IAlfElement& aElement, + uint aDataId ); + + /** + * Returns index corresponding to a data id. + */ + OSN_IMPORT virtual uint dataIdToIndex( + const IAlfElement& aElement, + uint aDataId ); + + /** + * Returns data of an element. + */ + OSN_IMPORT IAlfVariantType* elementData( + const IAlfElement& aElement, + uint aDataId ); + + /** + * Sets the data id range of an element. + */ + OSN_IMPORT void setDataIdRange( const IAlfElement& aElement, uint aRange ); + + /** + * Returns the data id range of an element. + */ + OSN_IMPORT uint dataIdRange( const IAlfElement& aElement ); + + /** + * Updates presentation. + * @exception osncore::AlfVisualException Thrown with the error code + * osncore::ECanNotCreateVisual when during updation of presentation, + * visual trees are created and an error occurs during the creation of + * visuals. + * @since S60 ?S60_version + */ + OSN_IMPORT void updatePresentation(); + + /** + * Destroys presentation (visual trees under elements). + */ + OSN_IMPORT void destroyPresentation( int aTimeMilliseconds = 0 ); + + /** + * Destroys all visuals and elements. + */ + OSN_IMPORT void destroyVisualsAndElements( int aTimeMilliseconds = 0 ); + + /** + * Return the owner widget of this control . + */ + OSN_IMPORT AlfWidget* widget(); + + /* + * Notifies the parent control that the layout should be recalculated. + * If there is no parent, nothing is done. + */ + OSN_IMPORT void updateParentLayout(); + + /* + * @return true if the control acts as a container for other widgets. + * + */ + OSN_IMPORT bool isContainer() const; + + /* + * @return true if the control is focusable, false otherwise. + */ + OSN_IMPORT bool isFocusable() const; + + /** + * Template getter for interfaces provided by the control classes. + * The type of the queried interface is specified by the + * template parameter. + * + * @exception std::bad_alloc + * + * @since S60 ?S60_version + * @param aControl The control to get the interface for. + * + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + template + static T* makeInterface( CAlfWidgetControl* aControl ); + + /** + * Handles events sent to widget control. + * Widgets can override this. + * The default implementation tunnels key events towards the + * focussed child widget. If custom events EEventFocusNextWidget/ + * EEventFocusPreviousWidget are received the default implementation + * attempts to switch focus to the next/previous child widget. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * + * @return Result of event processing. See AlfEventStatus. + */ + OSN_IMPORT virtual AlfEventStatus handleEvent( const TAlfEvent& aEvent ); + + /** + * Processes the events sent to this control. + * The events are passed to the tunnelling phase event handlers, + * handleEvent method and the bubbling phase event handlers in + * that order till one of them consumes the event. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * + * @return Result of event processing. See AlfEventStatus. + */ + OSN_IMPORT AlfEventStatus processEvent( const TAlfEvent& aEvent ); + +// from base class IAlfModelChangeObserver + + /** + * From IAlfInterfaceBase. + * Update the control according to the changed model. + * Destroy existing visuals and cancel all animation commands. + * Create new visuals according to the data in the new model. + * + * @since S60 ?S60_version + * @param aModel The new model. + */ + OSN_IMPORT virtual void modelChanged( IAlfModel& aModel ); + + /** + * Update the presentation according to the data changes. + * + * @since S60 ?S60_version + * @param aArrayOfOperation An Array containing the operations performed + * on the model. + */ + OSN_IMPORT virtual void dataChanging( + const AlfPtrVector& aOperations ); + + /** + * Update the presentation according to the data changes. + * + * @exception osncore::AlfVisualException Thrown with the error code + * osncore::ECanNotCreateVisual when adding the visual tree through + * adding the data for it in the model but the creation of visual tree + * is failed. + * + * @since S60 ?S60_version + * @param aOperation An operation performed on the model. + */ + OSN_IMPORT virtual void dataChanging( + const AlfModelOperation& aOperation ); + + /** + * The default implementation is empty. + * Derived classes may update the state of the + * control according to the changed data. + * + * @since S60 ?S60_version + */ + OSN_IMPORT virtual void dataChanged(); + +// from base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the control classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + OSN_IMPORT virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +public: + +// New non-virtual methods + + /** + * Resets control group of this control. If the control is in a + * control group it will be removed from its currect control group + * and appended to the given control group. + * + * @param Reference to the control group to which this control is appended. + */ + void resetControlGroup(CAlfControlGroup& aControlGroup); + + /** + * Resets control group of this control and the whole hierarchy of + * controls that are connected to this control or its children with + * connections. + * + * This control and the tree of controls below it are removed from + * their previous control groups. + * + * @since S60 ?S60_version + * @param Reference to the control group to which controls are appended. + * This control group replaces control groups to which the controls + * in this control hierarchy belong before the call is made. + */ + void resetHierarchyControlGroup(CAlfControlGroup& aControlGroup); + + /** + * Attempt to acquire focus for this control. + */ + OSN_IMPORT void AcquireFocus(); + + /** + * Attempt to relinquish focus for this control. + */ + OSN_IMPORT void RelinquishFocus(); + + /** + * returns hostApi for this control. + * + * @return hostApi-instance. + */ + IAlfHostAPI& hostAPI(); + +protected: + + /** + * The protected constructor. + * + * @since S60 ?S60_version + */ + OSN_IMPORT CAlfWidgetControl(); + + + /** + * The constructor. + * + * @since S60 ?S60_version + * @param aEnv The Alfred environment. + */ + OSN_IMPORT void construct(CAlfEnv& aEnv); + + /** + * handles focusing to next control. + * Handles the container inside container cases. If next focusable + * control is not found, moves focus to upper level container, if no + * next focusable controls found in any of the upper level + * containers, loops back to the first control. + * + * @since S60 ?S60_version + * @return true, if focus was changed. + */ + OSN_IMPORT bool handleFocusNext(); + + /** + * handles focusing to previous control. + * Handles also the container inside container cases. If next focusable + * control is not found, moves focus to upper lever container, if no + * previous focusable controls found in any of the upper level + * containers, loops back to the last control. + * + * @since S60 ?S60_version + * @return true, if focus was changed. + */ + OSN_IMPORT bool handleFocusPrevious(); + + /** + * return the first focusable child control. + * First focusable is also the default control to get the focus. + * + * @since S60 ?S60_version + * @param aHostApi hostapi-instance. Use: for iterating the connected + * controls. + * @return control, which should be the first to get the focus. + */ + OSN_IMPORT virtual CAlfWidgetControl* getFirstFocusable( + IAlfContainerWidget& aContainer); + + /** + * return the last focusable child control. + * + * @since S60 ?S60_version + * @param aHostApi hostapi-instance. Use: for iterating the connected + * controls. + * @return control, which should be the last one to get the focus + */ + OSN_IMPORT virtual CAlfWidgetControl* getLastFocusable( + IAlfContainerWidget& aContainer); + + /** + * return next focusable control right after aControl + * + * @since S60 ?S60_version + * @param aHostApi hostapi-instance. Use: for iterating the connected + * controls. + * @param aControl reference control + * @return control, which should be focused right after aControl. + * If no focusable control left, should return 0. + */ + OSN_IMPORT virtual CAlfWidgetControl* getFocusableAfter( + IAlfContainerWidget& aContainer, + CAlfWidgetControl& aControl); + + /** + * return next focusable control right before aControl. + * + * @since S60 ?S60_version + * @param aHostApi hostapi-instance. Use: for iterating the connected + * controls. + * @param aControl reference control. + * @return control, which should be focused right before aControl. + * If no focusable control left, should return 0. + */ + OSN_IMPORT virtual CAlfWidgetControl* getFocusableBefore( + IAlfContainerWidget& aContainer, + CAlfWidgetControl& aControl); + + /** + * Called when the control's focus state changes. + */ + OSN_IMPORT void FocusChanged(CAlfDisplay& aDisplay, TBool aFocused); + +private: + + // from base class MAlfEventHandler + + /** + * Sends the event to processEvent method. + * Widgets are discouraged from overriding this method. + * Leaves with exception description if processEvent throws. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * + * @return ETrue, if the event was handled. + * Otherwise EFalse. + * + */ + OSN_IMPORT virtual TBool OfferEventL( const TAlfEvent& aEvent ); + + /** + * Calculate the child index inside a map. + * In the data hierarchy, map items may by children + * or containers of children. In order to calculate the + * absolute child index, all previous map items need to be + * considered. If the map is the root data, child items + * with different element names are not considered. + * + * @since S60 ?S60_version + * @param aMap The map containing the children. + * @param aMapIndex The index inside the map. + * @param aContainerIndex The index inside the container. + * @param aRoot Is the map the root data. + * + * @return The child index. + */ + uint childIndex( IAlfMap& aMap, uint aMapIndex, + uint aContainerIndex, bool aRoot ); + + /** + * returns next control, that can be focused in relation to + * the aControl. + * + * @since S60 ?S60_version + * @param aControl reference control. + * + * @return next focusable control, if aControl == 0, first focusable + * control should be returned. + */ + CAlfWidgetControl* nextFocusableControl(CAlfWidgetControl* aControl); + + /** + * returns previous control, that can be focused in relation to + * the aControl. + * + * @since S60 ?S60_version + * @param aControl reference control, + * + * @return previous focusable control, if aControl == 0, last focusable + * control should be returned. + */ + CAlfWidgetControl* previousFocusableControl(CAlfWidgetControl* aControl); + + // Private state handler methods + + void enableStateVisible(); + void disableStateVisible(); + void enableStateEnabled(); + void disableStateEnabled(); + void enableStateFocused(); + void disableStateFocused(); + void enableStateFocusable(); + void disableStateFocusable(); + + // Tools for checking state invariants + static void checkStateInvariants(uint aNewState); + void predictAndCheckStateInvariants( + uint aChangePattern, bool aEnabling) const; + + /** + * Removes presentaion elements that is associated with + * the eventhandler.This will remove the element reference from the + * element array . + * + * @since S60 ?S60_version + * @param aEventHandler A reference to event handler associated with + * presentation element. + * + * @return the pointer to element data holding the pointer to the element + * if it is found, else null + */ + ElementData* removePesentationElementData( + IAlfWidgetEventHandler& aEventHandler ); + + /** + * Constants for aPhase parameter in function ProcessEventHandlingPhase. + */ + static const int tunneling = 0; + static const int bubbling = 1; + + /** + * Goes through all the event handlers in either tunneling or + * bubbling phase. + */ + AlfEventStatus ProcessEventHandlingPhase( + int aPhase, + const TAlfEvent& aEvent ); + +private: // data + auto_ptr mWdgtControlData; + }; + +#include "alf/alfwidgetcontrol.inl" + + } // namespace Alf + +#endif // ALFWIDGETCONTROL_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcontrol.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetcontrol.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: Template interface getter for CAlfWidgetControl class. +* +*/ + + +// ----------------------------------------------------------------------------- +// Template getter for interfaces provided by the the control classes. +// The type of the queried interface is specified by the +// template parameter. +// ----------------------------------------------------------------------------- +// +template +T* CAlfWidgetControl::makeInterface( CAlfWidgetControl* aControl ) + { + if (aControl) + { + return static_cast< T* >( aControl->makeInterface( T::type() ) ); + } + return NULL; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetenvextension.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetenvextension.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2008 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: Utilities to create and access widget model extensions to AlfEnv +* +*/ + + +#ifndef ALFWIDGETENVEXTENSION_H +#define ALFWIDGETENVEXTENSION_H + +#include + +class CAlfEnv; + +namespace Alf + { + class ResourcePool; + class IAlfWidgetFactory; + class AlfThemeManagerUtil; + } +namespace Alf + { + +/** + * @class AlfWidgetEnvExtension alfwidgetenvextension.h "alf/alfwidgetenvextension.h" + * class with methods to access extensions in AlfEnv + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfWidgetEnvExtension + { +public: + + /** + * Initialize the singleton objects that are required for the widget model + * + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the resource pool extension + * can not be hooked to Alf environment. + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the factory extension can + * not be hooked to Alf environment. + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the widget factory cannot + * be created. + * + * @param aEnv Alf environment object. + */ + OSN_IMPORT static void initializeEnvironment(CAlfEnv& aEnv); + + /** + * Initialize the singleton object for the resource pool required for the + * widget model + * + * @param aEnv Alf environment object + */ + static void initializeEnvironmentForResourcePool(CAlfEnv& aEnv); + + /** + * Initializes environment with Theme Manager extension + * + * @param aEnv Alf environment object + */ + static void AlfWidgetEnvExtension::initializeEnvironmentForTheme(CAlfEnv& aEnv); + + /** + * Initialize the singleton object for the widget factory required for + * the widget model + * + * @param aEnv Alf environment object + */ + static void initializeEnvironmentForFactory(CAlfEnv& aEnv); + + /** + * Access to the application-level resource pool + * It also initializes the environment with resource pool extension, + * if it was not initialized earlier + * + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the extension can not be + * hooked to Alf environment. + * @param aEnv The Alf environment object in which to find the pool + * @return ref to the application-level resource pool + */ + OSN_IMPORT static ResourcePool& resourcePool(CAlfEnv& aEnv); + + + /** + * Access to the widget factory + * It also initializes the environment with widget factory extension, + * if it was not initialized earlier + * + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the extension can not be + * hooked to Alf environment. + * @exception osncore::AlfWidgetException Thrown with the error code + * osncore::ECommonError when the widget factory cannot + * be created. + * @param aEnv The Alf environment object in which to find the + * widget factory + * @return ref to the widget factory + */ + OSN_IMPORT static IAlfWidgetFactory& widgetFactory( CAlfEnv& aEnv); + /** + * Access to the application-level Thememanager. + * + * @param aEnv The Alf environment object in which to find the thememanager. + * @return ref to the application-level ThemeManager. + */ + OSN_IMPORT static AlfThemeManagerUtil& themeManagerUtil(CAlfEnv& aEnv); + + }; + + } +#endif // ALFWIDGETENVEXTENSION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgeteventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgeteventhandler.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,424 @@ +/* +* Copyright (c) 2007 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: Header for generic event handler for alf widgets +* +*/ + + +#ifndef ALFWIDGETEVENTHANDLER_H +#define ALFWIDGETEVENTHANDLER_H + + +#include +#include +#include +#include +#include +#include +using namespace osncore; + +#include +using namespace std; + +namespace osncore + { +class UString; + } + +using osncore::UString; + +namespace Alf + { +class CAlfWidgetControl; +class AlfWidget; +class AlfReferenceToVisual; +class IAlfAttributeSetter; +class AlfAttributeContainer; +class AlfWidgetEventHandlerImpl; +class AlfAttribute; +class AlfAttributeValueType; +class IfId; +class IAlfEventOutputSignalSubscriber; +class IAlfAppEventListener; + +// Custom event IDs defined by the event handling framework. +enum + { + EActivateState = 1000000, + EDeactivateState + }; + +enum WidgetTactileFeedbackType + { + tactileFeedbackNone, + tactileFeedbackBasic, + tactileFeedbackSensitive + }; + +/** @class AlfWidgetEventHandler alfwidgeteventhandler.h "alf/alfwidgeteventhandler.h" + * A generic event handler for alf widgets. + * One AlfWidgetEventHandler instance is meant to handle one or more event + * inputs, which result in the same event output. When any of the event inputs + * accept the given event, all the event outputs and event cancel outputs are + * executed. However, animation event outputs and cancel outputs are executed + * only in response to custom events, not pointer or key events. + * If an animation command is required in response to a key or pointer event, + * the event handler handling those should generate a custom event and then + * the event handler handling that should generate an animation command. + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +OSN_NONSHARABLE_CLASS( AlfWidgetEventHandler ) : public IAlfWidgetEventHandler + { +public: + + /** + * Constructor. + * @param IAlfWidgetEventHandler::AlfEventHandlerType type whe + * @param aEventHandlerType Event handler type. + * It can be presentaion related or logical. + * @param aEventHandlerExecutionPhase Event handler exceution phase. + * It can be tunneling phase/bubbling phase/both. + */ + OSN_IMPORT AlfWidgetEventHandler( + IAlfWidgetEventHandler::AlfEventHandlerType + aEventHandlerType = ELogicalEventHandler, + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + aEventHandlerExecutionPhase = ETunnellingPhaseEventHandler ); + + /** + * Destructor. + */ + virtual ~AlfWidgetEventHandler(); + + /** + * Adds a key event input to the event handler. + * + * @exception std::bad_alloc + * @param aEventID The key code + * @param aEventTypeFlags Event type flags. + * @param aKeyEventModifiers Bitmask of the possible modifiers of the key event. + * This event handler is triggered only if the received key event contains these modifiers. + * See enumeration KeyEventModifiers for the possible bit values. + */ + OSN_IMPORT void addKeyInput( + int aEventID, + EventTypeFlags aEventTypeFlags = keyDown, + uint aKeyEventModifiers = 0 ); + + /** + * Adds a custom event input to the event handler. + * + * @exception std::bad_alloc + * @param aEventID The event ID. + * @param aUseEventData Use the custom event data to determine the accepted events. + * @param aEventData The accepted custom event data value. Only used if + * aUseEventData is true. + */ + OSN_IMPORT void addCustomInput( int aEventID, bool aUseEventData = EFalse, + int aEventData = 0 ); + + /** + * Adds a pointer event input in the event handler. + * + * @exception std::bad_alloc + * @param aElementName The name of the element. + * @param aVisualName The name of the visual. + * @param aEvent + */ + OSN_IMPORT void addPointerInput( + const char* aElementName, const char* aVisualName, + WidgetPointerEvent aEvent = pointerEventUp ); + + /** + * Adds an event output in the event handler. + * + * @exception std::bad_alloc + * @param aEventType The event type. The only accepted types are + * TAlfEvent::ETypeCustom and TAlfEvent::ETypeKey. + * @param aEventID The event ID. + * @param aTargetWidget The name of the target widget. + * In the case of custom events, it can be an empty string, which means + * that the event is to be broadcast to all the event handlers. + * Key event outputs must always define a target widget. + * @param aDelay Delay in microseconds before sending the command. + * The default value of zero means that the command is scheduled immediately. + * Currently, key event outputs are always executed immediately. + */ + OSN_IMPORT void addOutput( + int aEventType, + int aEventID, + const char* aTargetWidget, + unsigned int aDelay = 0 ); + + /** + * Adds an animation output in the event handler. + * + * @exception std::bad_alloc + * @param aTargetVisual Reference to the animated visual. + * @param aReferenceVisual Reference to the visual with the + * reference value, or NULL if no reference value is used. + * + * @param aAttributeSetter The attribute setter for animating + * the attribute using Hitchcock commands. Ownership is transferred, + * if the method does not throw an exception. + * + * @param aAttributeContainer The attribute container holding the attribute + * value(s) used by the attribute setter. Ownership is transferred, if the method does not + * throw an exception. The container can hold new values for multiple different + * attributes, in which case all of them are applied when the animation output + * is triggered. + * + * @param aAnimationTime The duration of the animation. Note that this parameter + * is used only if the transition time parameter is not defined in the + * corresponding attribute in the attribute container. + * + * @param aDelay The delay in microseconds before starting the animation. + * Note that this parameter is used only if the delay parameter is not defined in the + * corresponding attribute in the attribute container. + */ + OSN_IMPORT void addAnimationOutput( + AlfReferenceToVisual* aTargetVisual, + AlfReferenceToVisual* aReferenceVisual, + IAlfAttributeSetter* aAttributeSetter, + AlfAttributeContainer* aAttributeContainer, + unsigned int aAnimationTime, + unsigned int aDelay ); + + /** + * Adds an event output for canceling timed custom events + * in the event handler. + * + * @exception std::bad_alloc + * @param aTargetWidget The name of the target widget. + * @param aEventID The event ID of the event to be canceled. + * @param aCancelAll Whether to cancel all the custom commands that are + * scheduled to be sent to the widget or not. If this is ETrue, + * the aEventID parameter is ignored. + */ + OSN_IMPORT void addCancelOutput( + const char* aTargetWidget, int aEventID, bool aCancelAll ); + + /** + * Adds an event output for canceling timed animation events + * in the event handler. + * + * @exception std::bad_alloc + * @param aElementName Element name. + * @param aVisualName Visual name. + * @param aOperation Identifies the operation of the command to be canceled. + * @param aCancelAll Whether to cancel all the animation commands that are + * scheduled to be sent to the widget or not. If this is ETrue, + * the aOperation parameter is ignored. + */ + OSN_IMPORT void addAnimationCancelOutput( + const char* aElementName, + const char* aVisualName, + TAlfOp aOperation, + bool aCancelAll ); + + /** + * Adds an event output for changing the value of a certain attribute + * of the widget. + * + * @exception std::bad_alloc + * @param aAttribute The attribute + * object is transferred and this function takes care of deleting it + * even if the function leaves. Thus, it should not be in the cleanup stack + * when calling this function, to avoid potential double deletion. + */ + OSN_IMPORT void addWidgetAttributeOutput( AlfAttribute& aAttribute, + const char* aWidgetId = 0 ); + + /** + * Adds an event output for changing the value of a certain attribute + * of the widget. + * + * @exception std::bad_alloc + * @param aName Name of the attribute + * @param aValue Value of the attribute + * object is transferred and this function takes care of deleting it + * even if the function leaves. Thus, it should not be in the cleanup stack + * when calling this function, to avoid potential double deletion. + */ + OSN_IMPORT void addWidgetAttributeOutput( UString& aName, + AlfAttributeValueType* aValue, const char* aWidgetId = 0 ); + + /** + * Adds an event output for changing the value of a certain attribute + * of the widget. + * + * @exception std::bad_alloc + * @param aName Name of the attribute + * @param aValue Value of the attribute + * object is transferred and this function takes care of deleting it + * even if the function leaves. Thus, it should not be in the cleanup stack + * when calling this function, to avoid potential double deletion. + */ + OSN_IMPORT void addWidgetAttributeInput( UString& aName, + AlfAttributeValueType* aValue, const char* aElementId = 0 ); + + /** + * Adds an event output for launching tactile feedback (instant feedback). + * Note that the implementation of this function is flagged + * with RD_TACTILE_FEEDBACK, i.e. if RD_TACTILE_FEEDBACK is not defined + * the method does nothing --> no output added. + * + * @exception std::bad_alloc + * @param aFeedbackType The type of the tactile feedback that should + * be used in the output. + */ + OSN_IMPORT void addTactileOutput( + WidgetTactileFeedbackType aFeedbackType ); + + /** + * Adds an event output for event passing. + * + * @param aSourceWidget + * @param aTargetWidget + * be used in the output. + */ + OSN_IMPORT void addEventPasserOutput( + const char* aSourceWidget , const char* aTargetWidget ); + + /** + * Adds an event output for event passing. + * + * @param aSourceWidget defines source widget + * @param aTargetWidget defines target widget. ie. Event is offered for the target widget + * @param aNewEventId Event is mapped to this type of event. + * @param aNewEventCustomData New event custom data + * be used in the output. + */ + OSN_IMPORT void addEventPasserOutput( + const char* aSourceWidget , const char* aTargetWidget, int aNewEventId, int aNewEventCustomData ); + /** + * Adds an event input for event passing. + * @param aEventId integer contains the specific event id. + * @param aCustomData Event specific integer data + */ + OSN_IMPORT void addEventPasserInput ( + int aEventId, int aCustomData ); + /** + * Adds a subscriber to be notified when event handler's input is received. + * + * @param aSubscriber Object containing knowledge of the subscribing class and + * its callback method. + */ + OSN_IMPORT void addWidgetEventOutputSignalSubscriber( IAlfEventOutputSignalSubscriber& aSubscriber ); + + /** + * Adds an event output for changing the state of a widget + * + * @exception Alf::AlfWidgetException value osncore::EInvalidWidget + * if aTargetWidget is NULL or empty. + * @exception Alf::AlfWidgetException value osncore::EInvalidArgument + * if aDisableStates and aEnableStates have a common bit set. + * + * @exception std::bad_alloc + * @param aName Id of the target widget instance + * @param aEnableStates mask of states to be set to true + * @param aDisableStates mask of states to be cleared + */ + OSN_IMPORT void addWidgetStateOutput( const UString& aTargetWidget, + uint aEnableStates, uint aDisableStates ); + + /** + * Adds application event output for event passing. + * + * @exception std::bad_alloc + * @param aCmd command + * @param aAppEvent subscriber + */ + OSN_IMPORT void addAppEventOutput(const UString& aCmd , IAlfAppEventListener& aAppEvent ); + +// from base class IAlfWidgetEventHandler + + /** + * @see IAlfWidgetEventHandler. + */ + virtual AlfEventStatus offerEvent( CAlfWidgetControl& aControl,const TAlfEvent& aEvent); + + + /** + * @see IAlfWidgetEventHandler. + */ + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + /** + * @see IAlfWidgetEventHandler. + */ + void setActiveStates( unsigned int aStates ); + + /** + * @see IAlfWidgetEventHandler. + */ + void setCapturing( bool aCapturing ); + + /** + * @see IAlfWidgetEventHandler. + */ + bool capturing() const; + + /** + * @see IAlfWidgetEventHandler. + * Calls to this API will overwrite previous set values. + */ + void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + /** + * @see IAlfWidgetEventHandler. + */ + AlfWidgetEventHandlerInitData* eventHandlerData(); + + /** + * Returns the type of EventHandler. + * @see IAlfWidgetEventHandler::AlfEventHandlerType + * + * @return The type of event handler. + */ + IAlfWidgetEventHandler::AlfEventHandlerType eventHandlerType(); + + /** + * Returns information about the phase in the event handling cycle in + * which the event hadler will be executed. + * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + * + * @return Event handler execution phase. + */ + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase eventExecutionPhase(); + +// from base class IAlfInterfaceBase + + /** + * @see IAlfInterfaceBase. + */ + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + +private: // data + + auto_ptr mImpl; + }; + + } // namespace Alf + +#endif // C_ALFWIDGETEVENTHANDLER_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgeteventhandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgeteventhandler.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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: Alfwidgethandler inline file. +* +*/ + + +template + T* AlfWidgetEventHandler::makeInterface( IAlfInterfaceBase* aThis ) + { + if ( aThis && aThis->type() == T::type() ) + { + return static_cast( this ); + } + return NULL; + } + +// End of File \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetevents.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/alfwidgetevents.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: Definition of the commonly used custom event ids. +* +*/ + + +#ifndef ALFWIDGETEVENTS_H +#define ALFWIDGETEVENTS_H + +namespace Alf + { +/** + * The list of commonly used custom event ids. + * The widget-specific ids should use values from ELastCommonWidgetEvent. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +enum CommonWidgetEvent + { + EEventActivateState = 0, + EEventDeactivateState = 1, + EEventWidgetInitialized = 2, + EEventSetFocus = 3, + EEventClearFocus = 4, + EEventFocusedItemTypeChanged = 5, + EEventItemSelected = 6, + EEventNavigatePrimaryNext = 7, + EEventNavigatePrimaryPrev = 8, + EEventNavigateSecondaryNext = 9, + EEventNavigateSecondaryPrev = 10, + EEventNavigateLeft = 11, + EEventNavigateRight = 12, + EEventNavigateUp = 13, + EEventNavigateDown = 14, + EEventScrollToTarget = 15, + EEventScrollPrimaryNext = 16, + EEventScrollPrimaryPrev = 17, + EEventScrollSecondaryNext = 18, + EEventScrollSecondaryPrev = 19, + EEventScrollToFirst = 20, + EEventScrollToLast = 21, + EEventScrollUp = 22, + EEventScrollDown = 23, + EEventScrollLeft = 24, + EEventScrollRight = 25, + EEventScrollPageUp = 26, + EEventScrollPageDown = 27, + EEventScrollPageLeft = 28, + EEventScrollPageRight = 29, + EEventScrollBarModelChanged = 30, + EEventFocusNextWidget = 31, + EEventFocusPreviousWidget = 32, + EEventWidgetGainedFocus = 33, + EEventWidgetLostFocus = 34, + EEventWidgetAttributeChanged = 35, + EEventWidgetPresentationDestroyed = 36, + EEventDragVertical = 37, + EEventDragHorizontal = 38, + EEventMissedPointerUp = 39, + ELastCommonWidgetEvent = 99 + }; + +/** + * OSN pointer event enumeration. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +enum WidgetPointerEvent + { + pointerEventDown = ELastCommonWidgetEvent + 1, + pointerEventUp, + pointerEventDrag + }; + +/** + * Event type flags. + */ +enum EventTypeFlags + { + custom = 0x0001, // custom event + keyDown = 0x0002, // key down event, key repeat generates this event also + keyUp = 0x0004, // key up event + + /** Flag to indicate that the custom event data + * should be used to determine the accepted events. + * Can not be used with key events. + */ + useEventData = 0x8000 + }; + +/** + * Key event modifiers. + */ +enum KeyEventModifiers + { + alt = 0x0001, + ctrl = 0x0002, + shift = 0x0004, + func = 0x0008, + capsLock = 0x0010, + numLock = 0x0020, + scrollLock = 0x0040 + }; + + } // namespace Alf + +#endif // ALFWIDGETEVENTS_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/attrproperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/attrproperty.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1040 @@ +/* +* Copyright (c) 2007 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: Contains common properties used in DUI UI Model +* +*/ + + +#ifndef DUIPROPERTY_H +#define DUIPROPERTY_H + +namespace duiuimodel + { + +// DUI XML namespace. +const char KDefaultNameSpaceUri[] = "http://www.series60.com/xml/dhuiml/1"; + +namespace nodetypes + { + static const char KImageVisual[] = "imagevisual"; + static const char KTextVisual[] = "textvisual"; + static const char KMeshVisual[] = "meshvisual"; + static const char KLineVisual[] = "linevisual"; + static const char KLayout[] = "layout"; + static const char KGridLayout[] = "gridlayout"; + static const char KFlowLayout[] = "flowlayout"; + static const char KDeckLayout[] = "decklayout"; + static const char KCurvePathLayout[] = "curvepathlayout"; + static const char KCurvePath[] = "curvepath"; + static const char KLine[] = "line"; + static const char KArc[] = "arc"; + static const char KColor[] = "color"; + static const char KViewportLayout[] = "viewportlayout"; + static const char KAttributeSetter[] = "attributesetter"; + static const char KAttributeCreator[] = "attributecreator"; + static const char KDataAttributeSetter[] = "dataattributesetter"; + static const char KAnchorLayout[] = "anchorlayout"; + static const char KAnchorLayoutInput[] ="anchorlayoutinput"; + static const char KEventHandler[] = "eventhandler"; + static const char KEventInput[] = "eventinput"; + static const char KEventOutput[] = "eventoutput"; + static const char KCondition[] = "condition"; + static const char KConditionGroup[] = "conditiongroup"; + static const char KProperty[] = "property"; + static const char KVisualConnection[] = "visualconnection"; + static const char KListFlowElement[] = "listflowelement"; + static const char KAnchor[] = "anchor"; + static const char KMetric[] = "metric"; + static const char KRect[] = "rect"; + static const char KLCTImageVisual[] = "lctimagevisual"; + static const char KLCTTextVisual[] = "lcttextvisual"; + static const char KLCTAnchorLayout[] = "lctanchorlayout"; + static const char KLCTGridLayout[] = "lctgridlayout"; + static const char KPadding[] = "padding"; + static const char KFrameBrush[] = "framebrush"; + static const char KBorderBrush[] = "borderbrush"; + static const char KDropShadowBrush[] = "dropshadowbrush"; + static const char KGradientBrush[] = "gradientbrush"; + static const char KImageBrush[] = "imagebrush"; + static const char KShadowBorderBrush[] ="shadowborderbrush"; + static const char KVisualization[] = "visualization"; + static const char KImageResource[] = "imageresource"; + static const char KResources[] = "resources"; + static const char KElement[] = "element"; + static const char KTactile[] = "tactile"; + static const char KButtonControl[] = "buttoncontrol"; + static const char KButtonWidgetControl[] = "buttonwidgetcontrol"; + static const char KListControl[] = "listcontrol"; + static const char KGridControl[] = "gridcontrol"; + static const char KGridContainerControl[] = "gridcontainercontrol"; + static const char KGridDefaultBaseElement[] = "griddefaultbaseelement"; + static const char KGridDefaultFocusElement[] = "griddefaultfocuselement"; + static const char KGridDefaultTextItemElement[] = "griddefaulttextitemelement"; + static const char KGridDefaultImageElement[] = "griddefaultimageelement"; + static const char KGridDefaultImagetextElement[] = "griddefaultimagetextitemelement"; + static const char KLayoutManager[] = "layoutmanager"; + static const char KConnection[] = "connection"; + static const char KMapToEvent[] = "maptoevent"; + static const char KAppEvents[] = "appevents"; + static const char KButtonWidget[] = "buttonwidget"; + static const char KListWidget[] = "listwidget"; + static const char KGridWidget[] = "gridwidget"; + static const char KScrollbarWidget[] = "scrollbarwidget"; + static const char KWidget[] = "widget"; + static const char KAppData[] = "appdata"; + static const char KApplication[] = "application"; + static const char KContainer[] = "container"; + static const char KView[] = "view"; + static const char KDhuiml[] = "dhuiml"; + static const char KVersion[] = "version"; + } + +namespace commonattributevalues + { + static const char KTrue[] = "true"; + static const char KFalse[] = "false"; + } + +namespace commonattributes + { + static const char KId[] = "id"; + static const char KRef[] = "ref"; + static const char KClass[] = "class"; + } + +namespace commonvisualattributes + { + // deprecated + static const char KFocusable[] = "focusable"; + static const char KDisabled[] = "disabled"; + static const char KParentVisual[] = "parentvisual"; + static const char KOpacity[] = "opacity"; + static const char KTurnAngle[] = "turnangle"; + // end deprecated + + + static const char KSetFlags[] = "setflags"; + static const char KClearFlags[] = "clearflags"; + + namespace visualflags + { + static const char KManualSize[] = "ManualSize"; + static const char KAlfVisualFlagManualPosition[] = "AlfVisualFlagManualPosition"; + static const char KAlfVisualFlagManualLayout[] = "AlfVisualFlagManualLayout"; + static const char KAlfVisualFlagLayoutUpdateNotification[] = "AlfVisualFlagLayoutUpdateNotification"; + static const char KAlfVisualFlag3DProjection[] = "AlfVisualFlag3DProjection"; + static const char KAlfVisualFlagNoDepthOcclusion[] = "AlfVisualFlagNoDepthOcclusion"; + static const char KAlfVisualFlagLocalHorizon[] = "AlfVisualFlagLocalHorizon"; + static const char KAlfVisualFlagClipping[] = "AlfVisualFlagClipping"; + static const char KAlfVisualFlagHOriginCenter[] = "AlfVisualFlagHOriginCenter"; + static const char KAlfVisualFlagHOriginRight[] = "AlfVisualFlagHOriginRight"; + static const char KAlfVisualFlagVOriginCenter[] = "AlfVisualFlagVOriginCenter"; + static const char KAlfVisualFlagVOriginBottom[] = "AlfVisualFlagVOriginBottom"; + static const char KAlfVisualChanged[] = "AlfVisualChanged"; + static const char KAlfVisualFlagNoDepthUpdate[] = "AlfVisualFlagNoDepthUpdate"; + static const char KAlfVisualFlagManualTransitionTime[] = "AlfVisualFlagManualTransitionTime"; + static const char KAlfVisualFlagDrawAfterOthers[] = "AlfVisualFlagDrawAfterOthers"; + static const char KAlfVisualFlagFreezeLayout[] = "AlfVisualFlagFreezeLayout"; + static const char KAlfVisualFlagIgnorePointer[] = "AlfVisualFlagIgnorePointer"; + static const char KAlfVisualFlagAutomaticLocaleMirroringEnabled[] = "AlfVisualFlagAutomaticLocaleMirroringEnabled"; + static const char KAlfVisualFlagLast[] = "AlfVisualFlagLast"; + } + } + +namespace commonbrushattributes + { + static const char KOwnerVisual[] = "ownervisual"; + static const char KOpacity[] = "opacity"; + static const char KSecondaryAlpha[] = "secondaryalpha"; + static const char KLayer[] = "layer"; + + namespace layertypes + { + static const char KBrushLayerBackGround[] = "brushlayerbackground"; + static const char KBrushLayerForeGround[] = "brushlayerforeground"; + } + } + +namespace borderbrushattributes + { + static const char KImage[] = "image"; + static const char KThicknessWidth[] = "thicknesswidth"; + static const char KThicknessHeight[] = "thicknessheight"; + static const char KImageOffsetX[] = "imageoffsetx"; + static const char KImageOffsetY[] = "imageoffsety"; + static const char KEdgeOffsetX[] = "edgeoffsetx"; + static const char KEdgeOffsetY[] = "edgeoffsety"; + } + +namespace dropshadowbrushattributes + { + static const char KSoftness[] = "softness"; + static const char KDepth[] = "depth"; + } + +namespace framebrushattributes + { + static const char KSkinID[] = "skinid"; + } + +namespace gradientbrushattributes + { + static const char KImage[] = "image"; + static const char KDirection[] = "direction"; + + namespace directiontypes + { + static const char KUp[] = "up"; + static const char KDown[] = "down"; + static const char KLeft[] = "left"; + static const char KRight[] = "right"; + } + } + +namespace imagebrushattributes + { + static const char KImage[] = "image"; + static const char KImageScaleMode[] = "imagescalemode"; + static const char KOffsetX[] = "offsetx"; + static const char KOffsetY[] = "offsety"; + static const char KScale[] = "scale"; + } + +namespace shadowborderbrushattributes + { + static const char KBorderWitdh[] = "borderwitdh"; + } + +namespace rect + { + static const char KTopLeftX[] = "topleftx"; + static const char KTopLeftY[] = "toplefty"; + static const char KBottomRightX[] = "bottomrightx"; + static const char KBottomRightY[] = "bottomrighty"; + } + +namespace padding + { + static const char KPaddingTop[] = "padding-top"; + static const char KPaddingRight[] = "padding-right"; + static const char KPaddingBottom[] = "padding-bottom"; + static const char KPaddingLeft[] = "padding-left"; + } + +namespace color + { + static const char KAlpha[] = "sca"; + static const char KBlue[] = "scb"; + static const char KGreen[] = "scg"; + static const char KRed[] = "scr"; + } + +namespace layoutattributes + { + static const char KParentLayout[] = "parentlayout"; + static const char KHeight[] = "height"; + static const char KWidth[] = "width"; + static const char KMaxHeight[] = "maxheight"; + static const char KMaxWidth[] = "maxwidth"; + static const char KMinHeight[] = "minheight"; + static const char KMinWidth[] = "minwidth"; + + static const char KUpdateLayoutTime[] = "updatelayouttime"; + static const char KTransitionTime[] = "transitiontime"; // will replace updatelayouttime + static const char KScrolling[] = "scrolling"; + static const char KAutomaticLocaleMirroring[] = "automirroring"; + static const char KBaseUnitX[] = "baseunitx"; + static const char KBaseUnitY[] = "baseunity"; + static const char KPositionX[] = "positionx"; + static const char KPositionY[] = "positiony"; + static const char KInnerPaddingVertical[]="innerpadding-vertical"; + static const char KInnerPaddingHoriz[]="innerpadding-horizontal"; + static const char KLayoutScrollOffsetX[]="scrolloffsetx"; + static const char KLayoutScrollOffsetY[]="scrolloffsety"; + static const char KExpansionFlag[] = "expansion flag"; + + namespace grid + { + static const char KRows[] = "rows"; + static const char KColumns[] = "columns"; + static const char KRowWeight[] = "rowweight"; + static const char KColumnWeight[] = "columnweight"; + static const char KSetLayoutModeFlag[] = "setlayoutmodeflag"; + static const char KClearLayoutModeFlag[] = "clearlayoutmodeflag"; + } + + namespace flow + { + static const char KFlowDirection[] = "flowdirection"; + static const char KLayoutMode[] = "layoutmode"; + static const char KLayoutCentering[] = "layoutcentering"; + + namespace flowdirectionvalues + { + static const char KHorizontal[] = "horizontal"; + static const char KVertical[] = "vertical"; + } + + namespace layoutmodevalues + { + static const char KCenterperpendicular[] = "centerperpendicular"; + static const char KFitperpendicular[] = "fitperpendicular"; + } + } + + namespace viewport + { + static const char KVirtualHeight[] = "virtualheight"; + static const char KVirtualWidth[] = "virtualwidth"; + static const char KViewportHeight[] = "viewportheight"; + static const char KViewportWidth[] = "viewportwidth"; + static const char KViewportPositionX[] = "viewportpositionx"; + static const char KViewportPositionY[] = "viewportpositiony"; + } + } + +namespace property + { + static const char KName[] = "name"; + static const char KValue[] = "value"; + } + +namespace textvisualattributes + { + static const char KLineWrap[] = "linewrap"; + static const char KText[] = "text"; + static const char KBackgroundType[] = "backgroundtype"; + static const char KLineSpacing[] = "linespacing"; + static const char KLineSpacingUnits[] = "linespacingunits"; + static const char KFont[] = "font"; + static const char KHorizontalAlign[] = "horizontalalign"; + static const char KVerticalAlign[] = "verticalalign"; + static const char KMaxLineCount[] = "maxlinecount"; + static const char KStyle[] = "style"; + static const char KPreconfiguredStyle[] = "preconfiguredstyle"; + static const char KShadowOpacity[] = "shadowopacity"; + static const char KTextSkinColorId[] = "textskincolorid"; + static const char KTextColorSkinIndex[] = "textcolorskinindex"; + static const char KEnableShadow[]= "enableshadow"; + static const char KTextColor[]= "textcolor"; + static const char KLocalisationText[] = "localisedtext"; //for localisation + static const char KLang[] = "localisedlanguage"; //for localisation + static const char KVarArgs[] = "varargs"; //for localisation + + namespace linewrapvalue + { + static const char KManual[] = "manual"; + static const char KTruncate[] = "truncate"; + static const char KBreak[] = "break"; + } + + namespace backgroundtypevalue + { + static const char KDark[] = "dark"; + static const char KLight[] = "light"; + } + + namespace linespacingvalue + { + static const char KPixel[] = "pixel"; + static const char KTwips[] = "twips"; + } + + namespace horizontalalignvalue + { + static const char KLeft[] = "left"; + static const char KCenter[] = "center"; + static const char KRight[] = "right"; + static const char KLocale[] = "locale"; + static const char KLocaleMirrored[] = "localemirrored"; + } + + namespace verticalalignvalue + { + static const char KTop[] = "top"; + static const char KCenter[] = "center"; + static const char KBottom[] = "bottom"; + } + + namespace preconfiguredstylevalue + { + static const char KNormal[] = "normal"; + static const char KNormalItalic[] = "normalitalic"; + static const char KMenuItem[] = "menuitem"; + static const char KSmall[] = "small"; + static const char KMenuSmall[] = "menusmall"; + static const char KMenuTitle[] = "menutitle"; + static const char KLarge[] = "large"; + static const char KSoftkey[] = "softkey"; + static const char KSupplement[] = "supplement"; + static const char KTitle[] = "title"; + } + } + +namespace lctvisualattributes + { + static const char KLCT[] = "lct"; + static const char KLCTNoSize[] = "lctnosize"; + static const char KVariety[] = "variety"; + static const char KAdditionalIcon[] = "additionalicon"; + static const char KAdditionalIconCount[] = "additionaliconcount"; + } + +namespace linevisualattributes + { + static const char KImagePath[] = "imagepath"; + static const char KThickness[] = "thickness"; + static const char KShadowThickness[] = "shadowthickness"; + static const char KStartPos[] = "startposition"; + static const char KEndPos[] = "endposition"; + static const char KColor[] = "color"; + static const char KAlphaMappingFunction[] = "alphamappingfunction"; + static const char KWidthMappingFunction[] = "widthmappingfunction"; + } + +namespace tactileattributes + { + static const char KEventInput[] = "eventinput"; + static const char KFeedbackType[] = "feedbacktype"; + + namespace eventinputvalues + { + static const char KStylusDown[] = "stylusdown"; + static const char KStylusUp[] = "stylysup"; + } + + namespace feedbacktypevalues + { + static const char KBasic[] = "basic"; + static const char KSensitive[] = "sensitive"; + } + } + +namespace mappingfunctions + { + static const char KConst[] = "constantmappingfunction"; + static const char KLinear[] = "linearmappingfunction"; + static const char KSine[] = "sinemappingfunction"; + static const char KCosine[] = "cosinemappingfunction"; + } + + +namespace imagevisualattributes + { + static const char KImageScaleMode[] = "imagescalemode"; + static const char KImageColorMode[] = "imagecolormode"; + static const char KSecondaryAlpha[] = "secondaryalpha"; + static const char KDropShadow[] = "dropshadow"; + static const char KImagePath[] = "imagepath"; + static const char KSecondaryImagePath[] = "secondaryimagepath"; + static const char KScale[] = "scale"; + static const char KOffset[] = "offset"; + static const char KStretchMode[] = "stretchmode"; + static const char KOffsetX[] = "offsetx"; + static const char KOffsetY[] = "offsety"; + static const char KSkinImagePath[] = "skinimagepath"; + static const char KSecondarySkinImagePath[] = "skinsecondaryimage"; + static const char KImageResourceRef[] = "imageresourceref"; + static const char KSecondaryImageResourceRef[] = "secondaryimageresourceref"; + static const char KImageWidth[] = "imagewidth"; + static const char KImageHeight[] = "imageheight"; + static const char KColor[] = "color"; + static const char KSkinFrameImage[] = "skinframeimage"; + static const char KAnimatedSkinImage[] = "animationimage"; + static const char KFrameOuterRectTLX[] = "frameouterrecttlx"; + static const char KFrameOuterRectTLY[] = "frameouterrecttly"; + static const char KFrameOuterRectBRX[] = "frameouterrectbrx"; + static const char KFrameOuterRectBRY[] = "frameouterrectbry"; + static const char KFrameInnerRectTLX[] = "frameinnerrecttlx"; + static const char KFrameInnerRectTLY[] = "frameinnerrecttly"; + static const char KFrameInnerRectBRX[] = "frameinnerrectbrx"; + static const char KFrameInnerRectBRY[] = "frameinnerrectbry"; + static const char KLctFrameInnerrectId[] = "lctframeinnerrectid"; + + namespace imagescalemodevalue + { + static const char KNormal[] = "normal"; + static const char KFitWidth[] = "fitwidth"; + static const char KFitHeight[] = "fitheight"; + static const char KCover[] = "cover"; + static const char KFit[] = "fit"; + static const char KFitInside[] = "fitinside"; + } + + namespace imagecolormodevalue + { + static const char KColorModulate[] = "colormodulate"; + static const char KColorDimmed[] = "colordimmed"; + } + + namespace stretchmodevalue + { + static const char KNone[] = "none"; + static const char KHorizontal[] = "horizontal"; + static const char KVertical[] = "vertical"; + static const char KFull[] = "full"; + } + + } + +namespace meshvisualattributes + { + static const char KMeshType[] = "meshtype"; + static const char KImagePath[] = "imagepath"; + static const char KSecondaryImagePath[] = "secondaryimagepath"; + static const char KSpecularImagePath[] = "specularimagepath"; + static const char KSecondaryAlpha[] = "secondaryalpha"; + static const char KYawAngle[] = "yawangle"; + static const char KPitchAngle[] = "pitchangle"; + static const char KScale[] = "scale"; + + namespace meshtypevalue + { + static const char KProcedural[] = "procedural"; + static const char KM3g[] = "m3g"; + } + } + +namespace attributesetter + { + static const char KName[] = "name"; + static const char KTargetValue[] = "targetvalue"; + static const char KSourceValue[] = "sourcevalue"; + static const char KInterpolationStyle[] = "interpolationstyle"; + static const char KTime[] = "time"; + static const char KTimeToTarget[] = "timetotarget"; + static const char KMappingFunctionId[] = "mappingfunctionid"; + static const char KType[] = "type"; + static const char KDataField[] = "datafield"; + + namespace interpolationstylevalues + { + static const char KStyleSystemDefault[] = "stylesystemdefault"; + static const char KStyleNone[] = "stylenone"; + static const char KStyleLinear[] = "stylelinear"; + static const char KSineWave[] = "sinewave"; + static const char KDecelerate[] = "decelerate"; + static const char KStyleAccelerate[] = "styleaccelerate"; + static const char KStyleAdaptive[] = "styleadaptive"; + static const char KStyleImpulse[] = "styleimpulse"; + static const char KStyleLast[] = "stylelast"; + } + + namespace categoryvalues + { + static const char KData[] = "data"; + } + + namespace typevalues + { + static const char KStatic[] = "static"; + static const char KDynamic[] = "dynamic"; + } + } + +namespace curvepathattributes + { + static const char KEnableLoop[] = "enableloop"; + static const char KOrigin[] = "origin"; + static const char KOffsetX[] = "offsetx"; + static const char KOffsetY[] = "offsety"; + static const char KLine[] = "line"; + static const char KArc[] = "arc"; + + namespace line + { + static const char KStartX[] = "startx"; + static const char KStartY[] = "starty"; + static const char KEndX[] = "endx"; + static const char KEndY[] = "endy"; + static const char KLength[] = "length"; + } + + namespace arc + { + static const char KOriginX[] = "originx"; + static const char KOriginY[] = "originy"; + static const char KHorizontalRadius[] = "horizontalradius"; + static const char KVerticalRadius[] = "verticalradius"; + static const char KStartAngle[] = "startangle"; + static const char KEndAngle[] = "endangle"; + static const char KLength[] = "length"; + } + } + +namespace anchorlayoutinput + { + static const char KChildOrdinal[] = "childordinal"; + static const char KAttachmentOrdinal[] = "attachmentordinal"; + } + +namespace eventhandler + { + static const char KPriority[] = "priority"; + static const char KType[] = "type"; + static const char KState[] = "state"; + static const char KCapture[] = "capture"; + static const char KOwner[] = "owner"; + } + +namespace eventinput + { + static const char KName[] = "name"; + static const char KElementName[] = "elementname"; + + namespace namevalue + { + static const char KKeyEvent[] = "keyevent"; + static const char KStylus[] = "stylus"; + static const char KCustomEvent[] = "customevent"; + static const char KEventPasserInput[] = "eventpasserinput"; + static const char KPropertyInput[] = "attributeinput"; + + namespace keyeventvalue + { + static const char KScanCode[] = "scancode"; + static const char KKeyCode[] = "keycode"; + static const char KModifier[] = "modifier"; + static const char KType[] = "type"; + } + + namespace keyeventtype + { + static const char KKeyUp[] = "keyup"; + static const char KKeyDown[] = "keydown"; + } + + namespace stylusvalue + { + static const char KElementName[] = "elementname"; + static const char KVisualName[] = "visualname"; + } + + namespace customeventvalue + { + static const char KEventId[] = "eventid"; + static const char KUserData[] = "userdata"; + } + + namespace propertyinput + { + static const char KPropertyName[] = "propertyname"; + } + } + } + +namespace eventoutput + { + static const char KName[] = "name"; + + namespace namevalue + { + static const char KCustomEvent[] = "customevent"; + static const char KCancelEvent[] = "cancelevent"; + static const char KAnimationCancel[] = "animationcancel"; + static const char KAnimation[] = "animation"; + static const char KPropertyOutput[] = "attributeoutput"; + static const char KTactile[] = "tactile"; + static const char KEventPasserOutput[] = "eventpasseroutput"; + static const char KAppEvent[] = "appevent"; + + namespace customevent + { + static const char KEventId[] = "eventid"; + static const char KEventType[] = "eventtype"; + static const char KWidgetName[] = "widgetname"; + static const char KDelay[] = "delay"; + } + + namespace cancelevent + { + static const char KEventId[] = "eventid"; + static const char KWidgetName[] = "widgetname"; + static const char KCancelAll[] = "cancelall"; + } + + namespace animationcancel + { + static const char KElementName[] = "elementname"; + static const char KVisualName[] = "visualname"; + static const char KOperationType[] = "operationtype"; + static const char KCancelAll[] = "cancelall"; + } + + namespace animation + { + static const char KAnimationTime[] = "animationtime"; + static const char KDelay[] = "delay"; + } + + namespace propertyoutput + { + static const char KTargetWidget[] = "targetwidget"; + } + + namespace tactile + { + static const char KFeedbackType[] = "feedbacktype"; + } + + namespace eventpasseroutput + { + static const char KSourceWidgetId[] = "sourcewidget"; + static const char KTargetWidgetId[] = "targetwidget"; + static const char KMapsTo[] = "mapsto"; + static const char KMapToEventCustomData[] = "customdata"; + } + } + } + +namespace operationname + { + static const char KNone[] = "none"; + static const char KHide[] = "hide"; + static const char KShow[] = "show"; + static const char KEnableInput[] = "enableinput"; + static const char KDisableInput[] = "disableinput"; + static const char KRemoveAndDestroyAll[] = "removeanddestroyall"; + static const char KModifyFlags[] = "modifyflags"; + static const char KSetPrimaryImage[] = "setprimaryimage"; + static const char KSetSecondaryImage[] = "setsecondaryimage"; + static const char KSetText[] = "settext"; + static const char KEnableTransformation[] = "enabletransformation"; + static const char KDisableTransformation[] = "disabletransformation"; + static const char KSet[] = "set"; + static const char KSetWithSpeed[] = "setwithspeed"; + static const char KSetStyle[] = "setstyle"; + static const char KLoadIdentity[] = "loadidentity"; + static const char KTranslate[] = "translate"; + static const char KScale[] = "scale"; + static const char KRotate[] = "rotate"; + static const char KReplaceStep[] = "replacestep"; + } + +namespace keyeventmodifier + { + static const char KAlt[] = "alt"; + static const char KCtrl[] = "ctrl"; + static const char KShift[] = "shift"; + static const char KFunc[] = "func"; + static const char KCapsLock[] = "capslock"; + static const char KNumLock[] = "numlock"; + static const char KScrollLock[] = "scrolllock"; + } + +namespace visualconnection + { + static const char KTargetWidget[] = "targetwidget"; + static const char KTargetElement[] = "targetelement"; + static const char KTargetVisual[] = "targetvisual"; + static const char KSourceWidget[] = "sourcewidget"; + static const char KSourceElement[] = "sourceelement"; + static const char KSourceVisual[] = "sourcevisual"; + } + + +namespace listcontrolattributes + { + static const char KFocusloop[] = "focusloop"; + static const char KPagescroll[] = "pagescroll"; + static const char KExpandItemDelay[] = "expanditemdelay"; + static const char KMarkable[] = "markable"; + static const char KTactile[] = "tactile"; + static const char KScrollbarMode[] = "scrollbarmode"; + + namespace markablevalue + { + static const char KNone[] = "none"; + static const char KSingle[] = "single"; + static const char KMulti[] = "multi"; + } + + namespace tactilevalue + { + static const char KEnabled[] = "enabled"; + static const char KDisabled[] = "disabled"; + } + + namespace scrollbarmodevalue + { + static const char KHide[] = "hide"; + static const char KShow[] = "show"; + static const char KAuto[] = "auto"; + } + } + +namespace listflowelement + { + static const char KParentElement[] = "parentelement"; + static const char KDefaultParentLayout[] = "defaultparentlayout"; + static const char KScrollingTime[] = "scrollingtime"; + static const char KPageScrollingTime[] = "pagescrollingtime"; + static const char KInsertingTime[] = "insertingtime"; + static const char KRemovingTime[] = "removingtime"; + static const char KChangingTime[] = "changingtime"; + static const char KFadeInTime[] = "fadeintime"; + static const char KFadeInDelay[] = "fadeindelay"; + static const char KFadeOutDelay[] = "fadeoutdelay"; + static const char KFadeOutTime[] = "fadeouttime"; + static const char KPartialsOpacity[] = "partialsopacity"; + static const char KItemHeight[] = "itemheight"; + static const char KItemWidth[] = "itemwidth"; + static const char KHorizontalAlign[] = "horizontalalign"; + static const char KScrollOffsetY[] = "scrolloffsety"; + static const char KVerticalOffset[] = "verticaloffset"; + static const char KFocusInFront[] = "focusinfront"; + } + +namespace gridcontrolattributes + { + static const char KTactile[] = "tactile"; + + namespace tactile + { + static const char KTactileOn[] = "on"; + static const char KTactileOff[] = "off"; + } + } + +namespace griddefaultbaseelement + { + static const char KLooping[] = "looping"; + static const char KFadingEffect[] = "fadingeffect"; + static const char KDefaultAnimationTime[] = "defaultanimationtime"; + static const char KSingleRow[] = "singlerow"; + static const char KSingleTapSelect[] = "singletapselect"; + static const char KFocussedIndex[] = "focussedindex"; + static const char KHorizScrollbarMode[] = "horizontalscrollbarmode"; + static const char KVertScrollbarMode[] = "verticalscrollbarmode"; + static const char KCellWidth[] = "cellwidth"; + static const char KCellHeight[] = "cellheight"; + static const char KMaxColumns[] = "maxcolumns"; + + namespace looping + { + static const char KLoopingOn[] = "on"; + static const char KLoopingOff[] = "off"; + } + + namespace singletapselect + { + static const char KSingleTapSelectOn[] = "on"; + static const char KSingleTapSelectOff[] = "off"; + } + + namespace fading + { + static const char KFadingOn[] = "on"; + static const char KFadingOff[] = "off"; + } + + namespace scrollbarmodevalue + { + static const char KHide[] = "hide"; + static const char KShow[] = "show"; + static const char KAuto[] = "auto"; + } + } + +namespace griddefaultfocuselement + { + static const char KImagePath[] = "imagepath"; + static const char KSkinImagePath[] = "skinimagepath"; + static const char KSkinFrameImage[] = "skinframeimage"; + } + +namespace griddefaultitemelement + { + static const char KState[] = "state"; + static const char KSkinEnabled[] = "skinenabled"; + + namespace itemstate + { + static const char KEnabled[] = "enabled"; + static const char KDisabled[] = "disabled"; + } + } + +namespace gridpinningbaseelement + { + static const char KOrientation[] = "orientation"; + static const char KFocussedIndex[] = "focussedindex"; + static const char KPinnedPosition[] = "pinnedposition"; + static const char KPinnedItemSize[] = "pinneditemsize"; + static const char KDefaultAnimationTime[] = "defaultanimationtime"; + static const char KCellWidth[] = "cellwidth"; + static const char KCellHeight[] = "cellheight"; + static const char KArrow[] = "arrow"; + + namespace orientation + { + static const char KHorizontal[] = "horizontal"; + static const char KVertical[] = "vertical"; + } + namespace arrow + { + static const char KEnableArrow[] = "enable"; + static const char KDisableArrow[] = "disable"; + } + } + +namespace scrollbarcontrolattributes + { + static const char KTactile[] = "tactile"; + + namespace tactile + { + static const char KTactileOn[] = "on"; + static const char KTactileOff[] = "off"; + } + } + +namespace scrollbardefaultbaseelement + { + static const char KEnableArrows[] = "enablearrows"; + static const char KAlignment[] = "alignment"; + static const char KOrientation[] = "orientation"; + + // Thumb specific Attributes + static const char KThumbWidth[] = "thumbwidth"; + static const char KThumbOpacity[] = "thumbopacity"; + static const char KThumbMinimumSize[] = "thumbminimumsize"; + static const char KThumbAnimationTime[] = "thumbanimationtime"; + + // image attributes + static const char KTrackStartImage[] = "trackstartimage"; + static const char KTrackMiddleImage[] = "trackmiddleimage"; + static const char KTrackEndImage[] = "trackendimage"; + static const char KThumbStartImage[] = "thumbstartimage"; + static const char KThumbMiddleImage[] = "thumbmiddleimage"; + static const char KThumbEndImage[] = "thumbendimage"; + static const char KTrackStartImagePressed[] = "trackstartimagepressed"; + static const char KTrackMiddleImagePressed[] = "trackmiddleimagepressed"; + static const char KTrackEndImagePressed[] = "trackendimagepressed"; + static const char KThumbStartImagePressed[] = "thumbstartimagepressed"; + static const char KThumbMiddleImagePressed[] = "thumbmiddleimagepressed"; + static const char KThumbEndImagePressed[] = "thumbendimagepressed"; + static const char KStartArrowImage[] = "startarrowimage"; + static const char KEndArrowImage[] = "endarrowimage"; + + namespace alignment + { + static const char KLeft[] = "left"; + static const char KRight[] = "right"; + static const char KTop[] = "top"; + static const char KBottom[] = "bottom"; + } + + namespace orientation + { + static const char KHorizontal[] = "horizontal"; + static const char KVertical[] = "vertical"; + } + } + +namespace anchor + { + static const char KAnchorType[] = "anchortype"; + static const char KAttachmentOrigin[] = "attachmentorigin"; + + namespace anchortypevalue + { + static const char KAnchorTypeNone[] = "anchortypenone"; + static const char KAnchorTypeWidth[] = "anchortypewidth"; + static const char KAnchorTypeLeft[] = "anchortypeleft"; + static const char KAnchorTypeHCenter[] = "anchortypehcenter"; + static const char KAnchorTypeRight[] = "anchortyperight"; + static const char KAnchorTypeHeight[] = "anchortypeheight"; + static const char KAnchorTypeTop[] = "anchortypetop"; + static const char KAnchorTypeVCenter[] = "anchortypevcenter"; + static const char KAnchorTypeBottom[] = "anchortypebottom"; + static const char KAnchorTypeSize[] = "anchortypesize"; + static const char KAnchorTypeTopLeft[] = "anchortypetopleft"; + static const char KAnchorTypeTopCenter[] = "anchortypetopcenter"; + static const char KAnchorTypeTopRight[] = "anchortypetopright"; + static const char KAnchorTypeCenterLeft[] = "anchortypecenterleft"; + static const char KAnchorTypeCenter[] = "anchortypecenter"; + static const char KAnchorTypeCenterRight[] = "anchortypecenterright"; + static const char KAnchorTypeBottomLeft[] = "anchortypebottomleft"; + static const char KAnchorTypeBottomCenter[] = "anchortypebottomcenter"; + static const char KAnchorTypeBottomRight[] = "anchortypebottomright"; + } + + namespace attachmentoriginvalue + { + static const char KAnchorAttachmentOriginNone[] = "anchorattachmentoriginnone"; + static const char KAnchorAttachmentOriginLeft[] = "anchorattachmentoriginleft"; + static const char KAnchorAttachmentOriginHCenter[] = "anchorattachmentoriginhcenter"; + static const char KAnchorAttachmentOriginRight[] = "anchorattachmentoriginright"; + static const char KAnchorAttachmentOriginTop[] = "anchorattachmentorigintop"; + static const char KAnchorAttachmentOriginVCenter[] = "anchorattachmentoriginvcenter"; + static const char KAnchorAttachmentOriginBottom[] = "anchorattachmentoriginbottom"; + static const char KAnchorAttachmentOriginTopLeft[] = "anchorattachmentorigintopleft"; + static const char KAnchorAttachmentOriginTopCenter[] = "anchorattachmentorigintopcenter"; + static const char KAnchorAttachmentOriginTopRight[] = "anchorattachmentorigintopright"; + static const char KAnchorAttachmentOriginCenterLeft[] = "anchorattachmentorigincenterleft"; + static const char KAnchorAttachmentOriginCenter[] = "anchorattachmentorigincenter"; + static const char KAnchorAttachmentOriginCenterRight[] = "anchorattachmentorigincenterright"; + static const char KAnchorAttachmentOriginBottomLeft[] = "anchorattachmentoriginbottomleft"; + static const char KAnchorAttachmentOriginBottomCenter[] = "anchorattachmentoriginbottomcenter"; + static const char KAnchorAttachmentOriginBottomRight[] = "anchorattachmentoriginbottomright"; + } + } + +namespace metric + { + static const char KMagnitude[] = "magnitude"; + static const char KTextStyleId[] = "textstyleid"; + } + +namespace imageresource + { + static const char KLogicalName[] = "logicalname"; + static const char KResourceName[] = "resourcename"; + static const char KResourceType[] = "resourcetype"; + + namespace resourcetypevalue + { + static const char KTheme[] = "theme"; + static const char KFile[] = "file"; + } + } + +namespace controlattributes + { + static const char KType[] = "type"; + static const char KScrollType[] = "scrolltype"; + static const char KItemType[] = "itemtype"; + static const char KFocusLoop[] = "focusloop"; + static const char KPageScroll[] = "pagescroll"; + static const char KSelectionType[] = "selectiontype"; + static const char KNumModes[] = "nummodes"; + static const char KEnable[] = "enable"; + static const char KFocus[] = "focus"; + static const char KMarkable[] = "markable"; + } + +namespace layoutmanager + { + static const char KType[] = "type"; + static const char KId[] = "id"; + + namespace lctanchorlayout + { + static const char KWidgetAnchor[] = "widgetanchor"; + } + } + + } // namespace duiuimodel +#endif // DUIPROPERTY_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfappeventlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfappeventlistener.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007,2008 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: Provides system state information +* +*/ + + +#ifndef IALFAPPEVENTLISTENER_H +#define IALFAPPEVENTLISTENER_H + +class TAlfEvent; + +namespace osncore + { + class UString; + } + +using namespace osncore; + +namespace Alf +{ +/** + * @class IAlfAppEvent + * + * @discussion Provides function to handle application events. + * + */ +class IAlfAppEventListener + { +public: + /** + * @function handleApplicationEvent + * + * Function will be called when application event triggers. + * Application has to register itself to listen events by + * using duiengine's subscribeAppEvent function + * + * example: + * + * + * + * + * + * + * + * + * + * + * + * + * Register your application to listen application events via IDuiEngineConstruction: + * duiEngineConstructionInterface->subscribeAppEvents(*this); + * + * aCmd is the value you have set on property's value attribute, in this case + * "itemclicked" + * + * @param aCmd command which is specified to eventoutput + * @param aEvent contains event specific data + * @return void + */ + virtual void handleApplicationEvent(const UString& aCmd, const TAlfEvent& aEvent) = 0; + }; +} + + +#endif + +// End of File \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfbranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfbranch.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2004 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: Defines a branch data type for the data hierarchy +* +*/ + + + +#ifndef I_ALFBRANCH_H +#define I_ALFBRANCH_H + + +// INCLUDES +#include + +namespace osncore + { +class UString; + } + +using osncore::UString; + +namespace Alf + { +class IAlfMap; +class IAlfSortFunction; + +/** + * An interface for Container data type. + * + * @lib hitchcockwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfBranch : public IAlfVariantType + { +public: + + /** + * The data for this branch + * + * @return the data for this branch as a Map Interface pointer + * @since S60 ?S60_version + */ + virtual IAlfMap* data() = 0; + + /** + * Set the data for this branch. + * @param aData The new data for this branch. + * @since S60 ?S60_version + */ + virtual void setData( IAlfMap* aData ) = 0; + + /** + * The data for a child at a given index + * @param aIndex- index of the child at which the data needs to be fetched + * @return the data for its children as a Map Interface pointer + * @since S60 ?S60_version + */ + virtual IAlfVariantType* childData(int aIndex) = 0; + + /** + * APi to get the childName + * @param aIndex- index of the child at which the data needs to be fetched + * @return the name for the child at the given index + * @since S60 ?S60_version + */ + virtual const UString& childName(int aIndex) = 0; + + /** + * The data for all children. + * @return the data for its children as a Map Interface pointer + * @since S60 ?S60_version + */ + virtual IAlfMap* childData() = 0; + + /** + * Set the data for children of this branch. + * @param aChildData The new data for the children. + * @since S60 ?S60_version + */ + virtual void setChildData( IAlfMap* aChildData ) = 0; + + /** + * Get the number of children in this branch + * @return The number of children + * @since S60 ?S60_version + */ + virtual uint childrenCount() = 0; + + /** + * Destructor + * @since S60 ?S60_version + */ + virtual ~IAlfBranch() {}; + + /** + * Sorts the branch using user defined sort function. + * + * @param aSortFunction - sort function. + * @since S60 ?S60_version + */ + virtual void sort( const IAlfSortFunction& aSortFunction ) = 0; + + /** + * Function to Clone the Branch + * @since S60 ?S60_version + * @return The clone + */ + virtual IAlfBranch* clone() = 0; + + }; + + } // namespace Alf + +#endif // I_ALFBRANCH_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfcontainer.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + +#ifndef I_ALFCONTAINER_H +#define I_ALFCONTAINER_H + + +// INCLUDES +#include + +namespace Alf + { + +// FORWARD DECLARATIONS +class IAlfSortFunction; + +/** + * An interface for Container data type. + * @lib hitchcockwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfContainer : public IAlfVariantType + { +public: + + /** + * Adds a variantData item into the container + * @param aData variant data to be added into the container + * @return void. + * @since S60 ?S60_version + */ + virtual void addItem(IAlfVariantType* aData)=0; + + /** + * Adds a variantData item into the container + * @param aIndex index where the data is added + * @param aData variant data to be added into the container + * @return void. + * @since S60 ?S60_version + */ + virtual void addItem(uint aIndex, IAlfVariantType* aData)=0; + + /** + * Gets the Number of items in the container + * + * @return number of items in the container + * @since S60 ?S60_version + */ + virtual int count() = 0; + + /** + * Gets the Item at a given index in the container + * @param aIndex - index at which the element is required + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + virtual IAlfVariantType* item(uint aIndex) = 0; + + /** + * Clones the entire container + * + * @return the cloned container + * @since S60 ?S60_version + */ + virtual IAlfContainer* clone() = 0; + + + /** + * Removes an item from given index in the container + * @param aIndex - index at which the element is to be removed + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + virtual void removeItem(uint aIndex) = 0; + + /** + * Clear the Container + * + * @return void + * @since S60 ?S60_version + */ + virtual void clear() = 0; + + /** + * Replace an item from given index in the container + * @param aIndex - index at which the element is to be replaced + * @param aNewData - new Data to be replaced + * @return void + * @since S60 ?S60_version + */ + virtual void replaceItem(uint aIndex, IAlfVariantType* aNewData ) = 0; + + /** + * sorts the container using user defined sort function. + * + * @param aSortFunction - sort function. + * @since S60 ?S60_version + */ + virtual void sort( const IAlfSortFunction& aSortFunction ) = 0; + + /** + * Destructor + * + * @since S60 ?S60_version + */ + virtual ~IAlfContainer(){} + }; + + + } // namespace Alf + +#endif // I_ALFCONTAINER_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,373 @@ +/* +* Copyright (c) 2007 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: The interface and the basic implementation for presentation elements. +* +*/ + + +#ifndef I_ALFELEMENT_H +#define I_ALFELEMENT_H + +#include +#include +#include + +class CAlfVisual; +class CAlfLayout; + +using namespace osncore; + +namespace duiuimodel + { +class DuiNode; + } +using namespace duiuimodel; + +namespace Alf + { +//FORWARD DECLARATION +class IAlfVariantType; +class IAlfBranch; +class IAlfWidgetControl; +class AlfCustomInitDataBase; +class IAlfVisualTemplate; + +namespace alfelement + { +static const IfId ident= + { + 0,"alfelement" + }; + } + +/** + * The interface for presentation elements. + * The presentation of a widget can be divided into parts by using + * elements. Each element is responsible for populating and maintaining + * a specific part of the presentation. The element creates and updates + * visual trees according to the data provided by the control. Elements + * may also implement presentation logic, such as visual lifetime and + * resource management, scrolling, and animations. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfElement : public IAlfInterfaceBase + { +public: + static inline const IfId& type() + { + return alfelement::ident; + } + /** + * Get the name of the element. + * + * @since S60 ?S60_version + * @return The name of the element. + */ + virtual const char* name() const = 0; + + /** + * Create a new visual tree to the child element of this element. + * Some elements, e.g., CAlfRecyclingGridElement and CAlfRecyclingCurvePathElement + * implement visual lifetime management to control the creation of the + * visual trees in the child elements. This method can be implemented to + * control, if the visual tree should be created or not. + * + * @since S60 ?S60_version + * @param aElement The child element. + * @param aChildData The data for the new visual tree. + * @param aData The parent branch of the added data. Used to determine the + * visual trees that have outdated data IDs. + * + * @param aIndex The index of the new data . + */ + virtual void createChildVisualTree( IAlfElement* aElement, + IAlfVariantType& aChildData, + IAlfBranch& aData, + int aIndex, uint aDataID ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aData + * @param aParentData + * @param aIndex + * @param aParentDataID + * @param aParentLayout + * @param aLayoutIndex + * @return + */ + virtual CAlfVisual* createVisualTree( IAlfVariantType& aData, + IAlfBranch& aParentData, + int aIndex, uint aParentDataID, + CAlfLayout* aParentLayout, + int aLayoutIndex ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aData + * @param aDataID + * @param aParentLayout + * @param aLayoutIndex + * @return + */ + virtual CAlfVisual* createVisualTree( IAlfVariantType& aData, + uint aDataID, + CAlfLayout* aParentLayout, + int aLayoutIndex ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aElement + * @param aData + * @param aIndex + * @param aDataID + * @return void + */ + virtual void removeChildVisualTree( IAlfElement* aElement, + IAlfBranch& aData, + int aIndex, uint aDataID ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aParentData + * @param aIndex + * @param aParentDataID + * @return void + */ + virtual void removeVisualTree( IAlfBranch& aParentData, int aIndex, + uint aParentDataID ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aData + * @param aDataID + * @return void + */ + virtual void removeVisualTree( IAlfVariantType& aData, uint aDataID ) = 0; + + /** + * Create or update a visual tree according to the given data. A data id is assigned + * to the created visual tree. If a visual tree with the given data id already + * exists, the visuals are just updated. The caller is responsible for providing + * the parent layout for the visual tree. The default parent layout may or may not + * be used. + * + * @since S60 ?S60_version + * @param aData The data for the visuals. + * @param aOldData the old data for the visuals. The data, that is replaced. + * @param aDataID The data id for the visual tree. + * @return The created or updated visual tree. + */ + virtual void updateVisualTree( IAlfVariantType& aNewData, + IAlfVariantType& aOldData, + uint aDataID ) = 0; + + /** + * Replace an existing visual tree with a new one. A data id is used + * to find the visual tree to be replaced. A new data id is assigned + * to the visual tree, and the visuals are updated according to the + * given data. The method is used for recycling visual trees for + * a large number of presentation instances (@see CAlfRecyclingGridElement). + * The structure of the new visual tree should match the structure + * of the replaced visual tree. Otherwise, the visuals structure + * needs to be modified by creating and destroying visuals. The visual + * tree remains in the same layout as it was before. + * + * @since S60 ?S60_version + * @param aData The data for the new visuals. + * @param aDataID The data id for the new visual tree. + * @param aOldDataID The data id of the visual tree to be replaced. + */ + virtual void replaceVisualTree( IAlfVariantType& aData, + uint aDataID, uint aOldDataID ) = 0; + + /** + * + * + * @since S60 ?S60_version + * @param aParentBranch + * @param aStartIndex + * @param aOffset + * @param aOldParentDataId + * @param aParentDataID + * @return void + */ + virtual void updateDataIDs( IAlfBranch& aParentBranch, int aStartIndex, + int aOffset, uint aOldParentDataId, + uint aParentDataID ) = 0; + + /** + * Get the default parent layout for the visual trees created by this element. + * The default parent layout is used for all root level elements (@see RootElement()). + * + * @since S60 ?S60_version + * @param aParentDataID The data id associated with the parent element instance. + * @return The default layout for the visual trees created by this element, or NULL + * if the default layout does not exist. + */ + virtual CAlfLayout* defaultParentLayout(uint aParentDataID) = 0; + + /** + * Find a visual according to the name of the visual and the data id + * used to create the visual tree. + * + * @param aName The name of the visual. + * @param aDataID The data id associated with the visual tree. + * @return The default layout for the visual trees created by this element. + */ + virtual CAlfVisual* findVisual(const char* aName, uint aDataID) = 0; + + /** + * Get the data id of a visual tree created by this element. + * + * @param aVisual The root of the visual tree. + * @return The data id associated with the visual tree. + */ + virtual uint dataID(const CAlfVisual& aVisual) const = 0; + + /** + * Get the parent element of this element. Some elements may have + * child elements (@see CAlfRecyclingGridElement). In this case, + * the parent element is responsible for populating the child elements. + * Elements with no parent element are called root elements and + * populated directly by the control. + * + * @since S60 ?S60_version + * @return The parent element, or NULL if this is a root element. + */ + virtual const IAlfElement* parentElement() const = 0 ; + + /** + * Set the parent element for this element. + * + * @since S60 ?S60_version + * @param aParent The parent element of this element. + */ + virtual void setParentElement(IAlfElement& aParent) = 0; + + /** + * removes and destroys all the visuals + * + * @since S60 ?S60_version + * @param aTimeMilliseconds the animation time for remove. + */ + virtual void removeAndDestroyVisuals( int aTimeMilliseconds ) = 0; + + /** + * Checks if referred visual is part of this element. + * + * @since S60 ?S60_version + * @param aVisual reference to visual under inspection. + */ + virtual bool contains(CAlfVisual& aVisual) const = 0; + + /** + * Sets the visual template for the element. This element + * will acquire ownership of the visual template hierarchy + * under the given visual template. + * Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * @param aTemplate Root of the visual template hierarchy to be set + * into the widget element. + */ + virtual void setVisualTemplate(IAlfVisualTemplate& aTemplate) throw() = 0; + + /** + * Returns the root visual template of the visual template hierarchy + * owned by this element. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfVisualTemplate* getVisualTemplate() const throw() = 0; + + /** + * Destroyes the visual template object assigned to this element and the whole + * visual template hierarchy under it. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + */ + virtual void destroyVisualTemplate() throw() = 0; + + /** + * Removes the visual template from this element. Returns pointer to the removed visual + * template object. The ownership of the visual template object is transferred to the + * caller. Call to this method cannot throw an exception. + * + * @since S60 ?S60_version + * + * @return The visual template object that was owned by this element. NULL if no visual + * template hierarchy was owned by this element. + */ + virtual IAlfVisualTemplate* removeVisualTemplate() throw() = 0; + + /** + * Destructor + */ + virtual ~IAlfElement(){} + }; + + +/** + * Placeholder for information required to instantiate an element + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfElementInitData + { + /** + * Owner control for the element. + */ + IAlfWidgetControl* mControl; + /** + * Element instance ID.This uniquely identifies every element instance + * and is its name. Also see AlfElement::name(). + */ + char* mElementId; + + /** + * Pointer to node in declaration containing information for the element. + */ + DuiNode* mNode; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + + } // namespace Alf +#endif // I_ALFELEMENT_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfflowlayoutpolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfflowlayoutpolicy.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007 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: flow layout policy. +* +*/ + + +#ifndef I_ALFFLOWLAYOUTPOLICY +#define I_ALFFLOWLAYOUTPOLICY + +#include +#include + +namespace Alf + { + +namespace ialfflowlayoutpolicy + { + static const IfId Ident = + { + 0, "flowlayoutpolicy" + }; + } + +/** + * interface for flow layout policy. The policy-interface can be queried + * from the layoutmanager using the makeInterface- call. + * @see IAlfLayoutManager + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfFlowLayoutPolicy : public IAlfInterfaceBase + { +public: + + /** Flow directions. */ + enum flowDirection + { + /** + * Flow horizontally. System wide layout mirroring is considered + * to determine whether visuals are layed from left to right + * or from right to left. + */ + EFlowHorizontal, + + /** Flow vertically. */ + EFlowVertical + }; + + /** Mode flags that specify how the flow is laid out. */ + enum flowModeFlags + { + /** Center the children perpendicular to the flow direction. + For example, if the flow direction is horizontal (left->right) + this flag will center the children vertically along the flow. */ + EFlowModeCenterPerpendicular = 0x1, + + /** Fit the children perpendicular to the flow direction. + For example, if the flow direction is horizontal, the children + will be vertically resized to fit the layout's rectangle. */ + EFlowModeFitPerpendicular = 0x2 + }; +public: + + static inline const IfId& type() + { + return ialfflowlayoutpolicy::Ident; + } + + virtual inline ~IAlfFlowLayoutPolicy() {} + + /** + * Sets the direction of the flow. + * + * @param aDirection Flow direction. + */ + virtual void setFlowDirection(enum flowDirection aDirection) = 0; + + /** + * returns the flow direction + * + * @param aDirection Flow direction. + */ + virtual enum flowDirection flowDirection() const = 0; + + /** + * Sets the mode of the flow. The mode flags determine how the flow layout + * behaves. + * + * @param aMode Mode flags (OR'd together). + * + * @see IAlfFlowLayoutPolicy::flowModeFlags + */ + virtual void setMode(int aMode) = 0; + + /** + * Returns the mode flags of the flow. + * + * @see IAlfFlowLayoutPolicy::flowModeFlags + * + * @return Returns the current mode flags. + */ + virtual int mode() const = 0; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0; + }; + + } // namespace Alf + +#endif // I_ALFFLOWLAYOUTPOLICY diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfgridlayoutpolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfgridlayoutpolicy.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2008 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: interface for layout policy +* +*/ + + +#ifndef I_ALFGRIDLAYOUTMANAGER +#define I_ALFGRIDLAYOUTMANAGER + +#include +#include + +class CAlfLayout; +class CAlfControl; + +namespace Alf + { + +class CAlfWidgetControl; + +namespace ialfgridlayoutpolicy + { + static const IfId Ident = + { + 0, "gridlayoutpolicy" + }; + } + +using Alf::CAlfWidgetControl; + + + +/** + * The interface for grid layout policy + * + * Provides grid specific layout APIs + * + * @code + * // Create layout manager interface. + * IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control); + * + * // See if layout policy is supported in the given layout manager. + * IAlfGridLayoutPolicy* layoutPolicy = IAlfInterfaceBase::makeInterface(layoutManager); + * + * if(layoutPreferences != 0) + * { + * int rows = layoutPolicy->dimensionCount(EAlfGridDimensionRow); + * } + * @endcode + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfGridLayoutPolicy : public IAlfInterfaceBase + { +public: + + static inline const IfId& type() + { + return ialfgridlayoutpolicy::Ident; + } + + virtual inline ~IAlfGridLayoutPolicy() {} + +public: + /* Each dimension corresponds to a different axis for the grid blocks */ + enum gridLayoutDimension + { + EGridDimensionColumn = 0, + EGridDimensionRow + }; + +public: + + /** + * Sets the number and weights of blocks in this grid layout in the direction of the specified + * dimension. Each block's weight will be set to equal the supplied value, the result + * of which is that all blocks will be equally spaced, whatever the units. + * + * @see appendWeight; for more information on how weights are used to calculate layout positions. + * + * @note This API could be useful if then subsequent calls to @c replaceWeight are made to + * change specific values, depending on how many of the values are different. + * @note Calling this with aCount set to 0 will clear all of the existing weights in the direction + * of the specified dimension. + * @note this is the same as using metrics with unit type EAlfUnitWeight. + * + * @param aDim the dimension along which to fill + * @param aCount The number of lines of blocks to fill + * @param aWeight the weights to be used for all blocks + * @throw AlfVisualException + */ + virtual void fillWeights(gridLayoutDimension aDim, int aCount, const TAlfMetric& aWeight) = 0; + + /** + * Add a new line of blocks to this grid layout at the last position in the direction of the + * specified dimension. It will have the supplied weight. Weights can be any metric value, + * hence different units can be used for each block. In particular, EAlfUnitWeight can be used + * to represent weight values in aribtrary proportional units. + * + * In the case of proportional weights, the effect of this will be to cause the other blocks to + * resize according to the new total weight. + * + * @note If non-relative coordinates are specified (e.g., real pixels), the combined blocks might not + * fill the entire layout area. However, weights will always stretch to fill all available space + * after the fixed units have been determined. Therefore, depending on circumstances it may + * be better to use EAlfUnitWeight + * @note For example [2 weights, 1 weight, 2 weights] in a layout of 100 pixels would result + * in [40 pixels, 20 pixels, 40 pixels]. + * @note For example [10 pixels, 1 weight, 15 pixels] in a layout of 100 pixels would result + * in [10 pixels, 75 pixels, 15 pixels]. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that block + * @throw AlfVisualException + */ + virtual void appendWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight) = 0; + + /** + * Add a new line of blocks to this grid layout at the specified position in the direciton of + * the specified dimension. It will have the supplied weight. In the case of proportional + * weights, the effect of this will be to cause the other blocks to resize according to the new + * total weight. It will also mean that many child visuals will now occupy different blocks within + * the grid according to how the blocks wrap. + * + * @note will leave if the specified position is greater than the number of objects currently in the array, + * so check first by calling @c preferredDimensionCount + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that block + * @param aPos the index of the block + * @throw AlfVisualException + */ + virtual void insertWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos) = 0; + + /** + * Sets the weight of a specific line of blocks in this grid layout, in the direction of the supplied dimension. + * In the case of proportional weights, the effect of this will be to cause the + * other blocks to resize according to the new total weight. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that cell + * @param aPos the index of the cell + * @throw AlfVisualException + */ + virtual void replaceWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos) = 0; + + /** + * Remove a line of blocks from this grid layout at the specified position in the + * specified dimension. In the case of proportional weights, the effect of this will + * be to cause the other blocks to resize according to the new total weight. It will also mean + * that many child visuals will now occupy different blocks within the grid according to how + * the blocks wrap. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aPos the index of the cell + * @throw AlfVisualException + */ + virtual void removeWeight(gridLayoutDimension aDim, int aPos) = 0; + + /** + * Returns the weight of a specific line of blocks in this grid layout, in the + * specified dimension. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aPos the index of the cell + * @return the weight being used for the cell in the specified dimension, will be 0 magnitude if not set + * @throw AlfVisualException + */ + virtual TAlfMetric weight(gridLayoutDimension aDim, int aPos) const = 0; + + /** + * Return the number of lines of blocks in this grid, along the specified dimension + * + * @param aDim the dimension along which to count + * @return The number of lines of blocks in this grid. + */ + virtual int count(gridLayoutDimension aDim) const = 0; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0; + }; + + } // namespace Alf + +#endif // I_ALFGRIDLAYOUTMANAGER diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfinterfacebase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfinterfacebase.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 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: The base class for interfaces provided by widget classes. +* +*/ + + +#ifndef I_ALFINTERFACEBASE_H +#define I_ALFINTERFACEBASE_H + + + +namespace Alf + { + +struct IfId; +/** + * The base class for interfaces provided by + * widget classes, including CAlfWidget, CAlfModel, + * CAlfWidgetControl, MAlfWidgetEventHandler, + * MAlfElement and derived classes. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfInterfaceBase + { +public: + /** + * Default virtual destructor. + */ + virtual ~IAlfInterfaceBase() {} + + /** + * Interface getter with casting. + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + template + static T* makeInterface(IAlfInterfaceBase* aBase) + { + return (aBase? static_cast(aBase->makeInterface(T::type())): 0); + } + + + /** + * Interface getter. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0; + + + }; + + } + +#endif // I_ALFINTERFACEBASE_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialflayoutmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialflayoutmanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2007 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: interface for layout managers +* +*/ + + +#ifndef I_ALFLAYOUTMANAGER +#define I_ALFLAYOUTMANAGER + +#include +#include + +class CAlfLayout; +class CAlfControl; + +namespace duiuimodel + { +class DuiNode; + } +using namespace duiuimodel; + +namespace Alf + { + +class CAlfWidgetControl; +class AlfCustomInitDataBase; + +namespace ialflayoutmanager + { + static const IfId Ident = + { + 0, "ialflayoutmanager" + }; + } + +/** + * The interface for layout managers + * + * Layout manager handles the layouting of child widgets in the container widget. + * It uses IAlfLayoutPreferences-interface (@see IAlfLayoutPreferences) + * of child widgets as a guide for laying out the widgets. The layoutmanager + * is set to the IAlfHostApi- interface (@see IAlfHostApi::setBaseLayout) + * createLayout-method should be the first call after creating the layoutmanager. + * + * Layout manager may also provide information about the layout preferences of its + * children. If this is supported the layout manager will combine the layout preferences + * of its children taking into consideration the technique used to lay out the children + * using the layout manager. This will provide information about the whole display area + * occupied by the layout manager. For instance vertical flow layout manager will provide + * preferred size area of its children by summing their heights and providing the maximum + * width among the children. + * + * @code + * // Create layout manager interface. + * IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control); + * + * // See if layout preferences is supported in the given layout manager. + * IAlfLayoutPreferences* layoutPreferences = IAlfInterfaceBase::makeInterface(layoutManager); + * + * if(layoutPreferences != 0) + * { + * TAlfXYMetric preferredSize; + * // This will report the preferred size of the layout by combining together preferred sizes of its children. + * bool result = layoutPreferences->getPreferredSize(preferredSize); + * } + * @endcode + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfLayoutManager : public IAlfInterfaceBase + { +public: + + static inline const IfId& type() + { + return ialflayoutmanager::Ident; + } + + virtual inline ~IAlfLayoutManager() {} + + /** + * Creates the layout used by this layoutmanager. + * + * @param aOwner owner-control of the the created layout. + * @param aParentLayout parent for the created layout + * @param aLayoutIndex index, where created visual should be placed in the parent layout. + * @throw AlfVisualException(EInvalidArrayIndex), if aLayoutIndex is out of bounds + * AlfVisualException(ECanNotCreateVisual), if the layout creation failed. + */ + virtual void createLayout(CAlfWidgetControl& aOwner, + CAlfLayout* aParentLayout, int aLayoutIndex) = 0; + + /** + * Returns the layout used by this layoutmanager. + * + * @return layout used by this layoutmanager. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual CAlfLayout& getLayout()const = 0; + + /** + * Notifies the layout manager, that the child control's layout + * must be updated + * + * @param aControl control, which size has changed. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void updateChildLayout(CAlfWidgetControl* aControl) = 0; + + /** + * Notifies the layout manager, that all the child control's layouts + * must be updated. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void updateChildrenLayout() = 0; + + /** + * Notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which has been removed from the layout. + * @throw AlfVisualException(EInvalidVisual), if layout is not created. + */ + virtual void childRemoved(CAlfWidgetControl* aControl) = 0; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0; + }; + +/** + * Placeholder for information required to instantiate an layoutmanager + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfLayoutManagerInitData + { + /** + * Event handler instance ID.This uniquely identifies every event handler instance. + */ + char* mLayoutManagerId; + + /** + * Pointer to node in declaration containing information for the widget. + */ + DuiNode* mNode; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + + } // namespace Alf + +#endif // I_ALFLAYOUTMANAGER diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialflayoutpreferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialflayoutpreferences.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2007 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: The interface for inquiring the layout preferences of a laid-out object +* +*/ + + +#ifndef I_ALFLAYOUTPERENCES_H +#define I_ALFLAYOUTPERENCES_H + +#include +#include +#include +#include + +using namespace osncore; + +namespace Alf + { + +class IAlfLayoutManager; + +namespace alflayoutpreferences + { + static const IfId Ident= + { + 0,"alflayoutpreferences" + }; + } + +/** + * The interface for finding the layout preferences for an Alf widget model + * presentation object. + * + * This interface is called by layout managers (implementors of @c IAlfLayoutManager) + * in order to find out information about their contained presentation objects. + * + * It is implemented by presentation objects in order to report to the layout manager + * what sizes objects prefer. + * + * The layout manager is responsible for finding out layout preferences for all the + * AlfElement instances in the next level down of containment - the "child" elements. + * It calls @c makeInterface on these elements. + * The layout manager uses its knowledge about how these child elements relate to + * each other geometrically to come up with a decision on how many child elements + * can be shown, where they are to be positioned, and how big they should be. + * @see IAlfLayoutManager + * + * @c AlfElements that represent contained sets of visuals - those that take up + * space within the visual containment - should implement @c IAlfLayoutPreferences, + * or defer its implementation to another presentation object which is capable + * of reporting layout preferences. + * + * The following units are allowed to be used in the returned parameter values: + * EAlfUnitPixel - pixels + * EAlfUnitDisplaySize - units relative to the display + * EAlfS60Unit - S60 layout specification units + * + * Other units do not make sense, since the metric is being passed + * to a different layout context. Furthermore, the reason for this API + * is for the implementing object to state its own, internal, preferences + * without recourse to its containment. This implies the use of the more + * absolute units. + * + * The units used for the returned @c TAlfXYMetric objects are chosen independently + * by the implementations of each API. They do not have to be return the same units. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfLayoutPreferences : public IAlfInterfaceBase + { +public: + static inline const IfId& type() + { + return alflayoutpreferences::Ident; + } + + /** + * Return the minimum desirable size of a presentation object. + * + * Minimum size should mean the size at which the visual would start to become + * unreadable in the case of text, or too difficult to see with sufficient + * clarity in the case of graphics. + * + * false is to be returned if the implementing presentation object does + * not care how small it is made. + * + * @param aMinSize The minimum size that the object would like to be laid out to + * @return false iff the object queried does not care about a minimum size + */ + virtual bool getMinimumSize( TAlfXYMetric& aMinSize ) const = 0; + + /** + * Return the maximum size desired by a presentation object. + * + * There may often be no preference as to maximum size. The implementation + * should then return false. + * + * @param aMaxSize The maximum size that the object would like to be laid out to + * @return false iff the object queried does not care about a maximum size + */ + virtual bool getMaximumSize( TAlfXYMetric& aMaxSize ) const = 0; + + /** + * Return the preferred size for a presentation object. + * + * The preferred size is the optimum size of the object in the absence + * of external factors. + * + * The value returned should greater than or equal in size to a value + * returned by getMinimumSize() + * + * The value returned should less than or equal in size to a value + * returned by getMaximumSize() + * + * @param aPreferredSize The size that the object would like to be laid out to + * @return false iff the object queried does not have a preferred size + */ + virtual bool getPreferredSize( TAlfXYMetric& aPreferredSize ) const = 0; + + /** + * Set the preferred size into a presentation object. + * + * The preferred size is being dictated by external code in this case. + * This new value should over-ride any internal preferred size. + * + * Calling this API has several side-effects. Subsequent calls to + * getPreferredSize should return @c true and return the new preferred + * size. + * + * Subsequent calls to getMinimumSize must return either @c false, or return + * @c true with a value less than or equal to the preferred size. + * + * Subsequent calls to getMaximumSize must return either @c false, or return + * @c true with a value greater than or equal to the preferred size. + * + * @param aPreferredSize The new preferred size for the laid-out object + */ + virtual void setPreferredSize( const TAlfXYMetric& aPreferredSize ) = 0; + + }; + + } // namespace Alf +#endif // I_ALFLAYOUTPERENCES_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmap.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + +#ifndef I_ALFMAP_H +#define I_ALFMAP_H + + +// INCLUDES +#include +#include + +namespace osncore + { +class UString; + } + +using osncore::UString; + +namespace Alf + { +/** + * An interface for Container data type. + * + * @lib hitchcockwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfMap : public IAlfVariantType + { +public: + + + /** + * Gets the Number of items in the container + * + * @return number of items in the container + * @since S60 ?S60_version + */ + virtual int count() const = 0; + + /** + * Gets the Item at a given index in the container + * @param aIndex - index at which the element is required + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + virtual IAlfVariantType* item(uint aIndex) = 0; + + /** + * Gets the Name at a given index in the container + * @param aIndex - index at which the name of the element in the map is required + * @return item name as a TDesC8 + * @since S60 ?S60_version + */ + virtual const UString& name(uint aIndex) const = 0; + + /** + * Clones the entire container + * + * @return the cloned container + * @since S60 ?S60_version + */ + virtual IAlfMap* clone() = 0; + + /** + * Removes an item from given index in the container + * @param aIndex - index at which the element is to be removed + * @return item as a MlfVariantType + * @since S60 ?S60_version + */ + virtual void removeItem(uint aIndex) = 0; + + /** + * Clear the Container + * + * @return void + * @since S60 ?S60_version + */ + virtual void clear() = 0; + + /** + * Replace an item from given index in the container + * @param aIndex - index at which the element is to be replaced + * @param aNewData - new Data to be replaced + * @return void + * @since S60 ?S60_version + */ + virtual void replaceItem(uint aIndex, IAlfVariantType* aNewData ) = 0; + + /** + * Adds a variantData item into the container + * @param aData - varaint Data Item to be added into the container + * @param @Name - Name associated with this Variant Data Item. + * @return void + * @since S60 ?S60_version + */ + virtual void addItem(IAlfVariantType* aData, const UString& aName)=0; + + /** + * Adds a variantData item into the container + * @param aIndex index where the data is added + * @param aData - variant Data Item to be added into the container + * @param @Name - Name associated with this Variant Data Item. + * @return void + * @since S60 ?S60_version + */ + virtual void addItem(uint aIndex, IAlfVariantType* aData, const UString& aName)=0; + + /** + * Gets the item by the given name. + * @param aName The name associated with requested item. + * @return The value corresponding to the name of the item. + * @since S60 ?S60_version + */ + virtual IAlfVariantType* item(const UString& aName) = 0; + + /** + * Gets the index of the item by the given name. + * @param aName The name associated with requested item. + * @return The index corresponding to the name of the item, or -1 if not found. + * @since S60 ?S60_version + */ + virtual int itemIndex(const UString& aName) = 0; + + /** + * Removes the Item associated with a name + * @param aName - Name associated with this Variant Data Item that is required to be removed in the map + * @return void + * @since S60 ?S60_version + */ + virtual void removeItem(const UString& aName) = 0; + + /** + * Replaces the Item associated with a name in the container with a new variant data type + * @param aName - Name associated with this Variant Data Item that is required to be replaced in the map + * @aNewData - New Data to be set + * @return void + * @since S60 ?S60_version + */ + virtual void replaceItem(const UString& aName,IAlfVariantType* aNewData) = 0; + + /** + * Destructor + * + * @since S60 ?S60_version + */ + virtual ~IAlfMap(){} + }; + + } // namespace Alf + +#endif // I_ALFMAP_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + + +#ifndef I_ALFMODEL_H +#define I_ALFMODEL_H + + +//INCLUDES +#include +#include + +namespace osncore + { +template class AlfPtrVector; + } +using namespace osncore; + +namespace Alf + { + +/* Forward declarations*/ +class IAlfModelChangeObserver; +class IAlfVariantType; +class AlfModelOperation; +class AlfCustomInitDataBase; + + +namespace alfmodel + { +static const IfId ident= + { + 0,"alfmodel" + }; + } + +/** + * An interface of the component model. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ + +class IAlfModel: public IAlfInterfaceBase + { +public: + static inline const IfId& type() + { + return alfmodel::ident; + } + + /** + * Virtual destructor. + * + * @since S60 ?S60_version + */ + virtual ~IAlfModel() {} + + /** + * Add a new observer to be notified of any changes in the model. + * + * @exception std::bad_alloc + * + * @param aObserver The model change observer to be added. + * @return void + * @since S60 ?S60_version + */ + virtual void addModelChangeObserver( + IAlfModelChangeObserver& aObserver ) = 0; + + + /** + * Remove an observer which is added to get notifications. + * + * @param aObserver The model change observer to be removed. + * @return void + * @since S60 ?S60_version + */ + virtual void removeModelChangeObserver( + IAlfModelChangeObserver& aObserver )=0; + + /** + * Api to change the model completely at one short. From IAlfModel + * + * @param aData The new data. + * @since S60 ?S60_version + */ + virtual void setData( IAlfVariantType* aData ) = 0; + + /** + * Change a given of data fields in the model . All model change + * observers are notified about the change. + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + * @param aData - The new data to be set + * @since S60 ?S60_version + */ + virtual void updateData( + int aNumContainerIndices,int* aContainerIndices, + IAlfVariantType* aData ) = 0; + + /** + * Add a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + * @param aData The new data. + * @since S60 ?S60_version + */ + virtual void addData( + int aNumContainerIndices,int* aContainerIndices, + IAlfVariantType* aData ) = 0; + + /** + * Remove a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy. The ownership is transferred. + * @since S60 ?S60_version + */ + virtual void removeData( + int aNumContainerIndices, + int* aContainerIndices ) = 0; + + /** + * Api for executing batch operations + * + * @param aOperationsArray - An RPOinterArray containing the list of + * operations to be executed in batch. + * @since S60 ?S60_version + */ + virtual void executeOperations( + AlfPtrVector& aOperationsArray) = 0; + + /** + * Api for executing one operation at a Time + * + * @param aOperation - An Operation to be executed on the model. + * @since S60 ?S60_version + */ + virtual void executeOperation(AlfModelOperation* aOperation) = 0; + + /** + * Clears the Model. + * @return void + * @since S60 ?S60_version + */ + virtual void clearModel() = 0; + /** + * Get the root data object of this model. + * + * @return The root data object. + * @since S60 ?S60_version + */ + virtual IAlfVariantType* data() const = 0; + + }; + +/** + * Placeholder for information required to instantiate a model + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfModelInitData + { + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + } // namespace Alf + +#endif // I_ALFMODEL_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodelbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodelbase.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + + +#ifndef I_ALFMODELBASE_H +#define I_ALFMODELBASE_H + +namespace osncore + { +class UString; + } + +using osncore::UString; + +namespace Alf + { +// CLASS DECLARATIONS + +/** + * Base class for setting custom data to a variant type. + * Derive from this class if you want to store custom data in + * a variant type. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfModelBase + { +public: + virtual ~IAlfModelBase() {} + virtual const UString& Type() = 0; + }; + + }// namespace Alf + +#endif // I_ALFMODEL_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodelchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodelchangeobserver.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + +#ifndef I_ALFMODELCHANGEOBSERVER_H +#define I_ALFMODELCHANGEOBSERVER_H + +//INCLUDES + +namespace osncore + { +template class AlfPtrVector; + } +using namespace osncore; + +namespace Alf + { + +/* Forward declarations*/ +class IAlfModel; +class AlfModelOperation; + +/** +* An interface for observing the changes in the model. +* @lib hitchcockwidgetmodel.lib +* @since S60 ?S60_version +* @status Draft +*/ +class IAlfModelChangeObserver + { +public: + /** Virtual destructor.*/ + virtual ~IAlfModelChangeObserver() {} + + /** + * Notify the observer that the model has changed. + * + * @param aModel The new model. + * @since S60 ?S60_version + */ + virtual void modelChanged( IAlfModel& aModel ) = 0; + + /** + * Notify the observers that a number of change operations + * are about to be performed on the model. + * + * @param aArrayOfOperation An Array containing the operations performed on the model. + * @since S60 ?S60_version + */ + virtual void dataChanging( const AlfPtrVector& aArrayOfOperation ) = 0; + + /** + * Notify the observers that a change operation + * is about to be performed on the model. + * + * @param aOperation An operation performed on the model. + * @since S60 ?S60_version + */ + virtual void dataChanging( const AlfModelOperation& aOperation ) = 0; + + /** + * Notify the observers that the data of the model has been changed. + * This is called automatically after any DataChangingL() call. + * + * @since S60 ?S60_version + */ + virtual void dataChanged() = 0; + }; + + + } // namespace Alf + +#endif // I_ALFMODELCHANGEOBSERVER_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfnavigation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfnavigation.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2007 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: Navigation interface for list-like widgets. +* +*/ + + + +#ifndef I_ALFNAVIGATION_H +#define I_ALFNAVIGATION_H + +#include + +namespace Alf + { + +namespace alfnavigation + { +static const IfId ident = + { + 0, "alfnavigation" + }; + } + +/** +* An interface that defines functionality for navigation in a +* one-dimensional array of items. In addition to the normal +* one-dimansional behavior, a common use case is to have +* a two-dimensional layout and navigation model for the items. +* Therefore, both one- and two-dimensional navigation models are +* supported by the interface. +* +* Since the logical behavior is decoupled from the presentation, +* the navigation is controlled in terms of logical dimensions, +* namely the primary and the secondary dimensions. The primary +* dimension is the dimension in which the navigation space +* expands when new items are inserted. In a one-dimensional layout, +* only the primary dimension is needed. The secondary dimension +* is used with two-dimensional layouts and navigation models. +* The size of the navigation space in the secondary dimension +* should be a constant. +* +* The navigation interface consists of navigation parameters, +* scrolling parameters, and orientation parameters. The navigation +* parameters are used to control the focused item in the logical +* navigation events. The scrolling parameters are used to send +* scrolling events according to the focused item. The orientation +* parameters are used to convert directional navigation events +* to the logical navigation events. In addition, the usage of +* default navigation key events, i.e., arrow keys, can be enabled +* or disabled. +* +* @lib alfwidgetmodel.lib +* @since S60 ?S60_version +* @status Draft +*/ +class IAlfNavigation : public IAlfInterfaceBase + { +public: + /** + * Getter for the type identifier of this interface. + * + * @since S60 ?S60_version + * @return A descriptor to identify the type of this interface. + */ + static inline const IfId& type() + { + return alfnavigation::ident; + } + + /** + * Getter for the index of the currently focused item. + * + * @since S60 ?S60_version + * @return An index of the currently focused item. + */ + virtual int focusedIndex() const = 0; + + /** + * Setter for the index of the currently focused item. + * If the given index is outside the range of items, + * the index is set to the first or the last index. + * + * @since S60 ?S60_version + * @param aIndex The new index of the focused item. + */ + virtual void setFocusedIndex( int aIndex ) = 0; + + /** + * Getter for the size of the page in primary dimension. + * The page size is used for EEventNavigatePrimaryPageUp and + * EEventNavigatePrimaryPageDown events, as well as for scrolling + * in primary dimension. + * + * @since S60 ?S60_version + * @return The page size in primary dimension. + */ + virtual int primaryPageSize() const = 0; + + /** + * Getter for the size of the page in secondary dimension. + * The page size is used for EEventNavigateSecondaryPageUp and + * EEventNavigateSecondaryPageDown events, as well as for scrolling + * in secondary dimension. + * + * @since S60 ?S60_version + * @return The page size in secondary dimension. + */ + virtual int secondaryPageSize() const = 0; + + /** + * Getter for the size of the navigation space in secondary dimension. + * One step in the primary dimension changes the index of the focused + * item by the secondary size. The size is also used for scrolling + * in secondary dimension. The secondary size of a one-dimensional + * list should be one. + * + * @since S60 ?S60_version + * @return The size in secondary dimension. + */ + virtual int secondarySize() const = 0; + + /** + * Getter for looping in primary dimension. + * + * @since S60 ?S60_version + * @return true if the looping is enabled, + * false otherwise. + */ + virtual bool primaryLooping() const = 0; + + /** + * Getter for looping in secondary dimension. + * + * @since S60 ?S60_version + * @return true if the looping is enabled, + * false otherwise. + */ + virtual bool secondaryLooping() const = 0; + + /** + * Set the navigation parameters for one-dimensional navigation. + * The secondary size and the secondary page size are set to one, + * to indicate that navigation and scrolling in secondary direction + * is disabled. Also the secondary looping is disabled. + * + * @since S60 ?S60_version + * @param aPrimaryPageSize The page size in primary dimension. + * @param aPrimaryLooping Enable or disable looping. + */ + virtual void setNavigationParams( int aPrimaryPageSize, + bool aPrimaryLooping ) = 0; + + /** + * Set the navigation parameters for two-dimensional navigation. + * The parameters determine the behavior of all navigation events. + * Navigation and scrolling are supported in both dimensions. + * If the secondary page size is equal to the size of the whole + * navigation space, the scrolling in secondary dimension is disabled. + * + * @since S60 ?S60_version + * @param aPrimaryPageSize The page size in primary dimension. + * @param aPrimaryLooping Enable or disable looping. + */ + virtual void setNavigationParams( int aPrimaryPageSize, + int aSecondarySize, + int aSecondaryPageSize, + bool aPrimaryLooping, + bool aSecondaryLooping ) = 0; + + /** + * Getter for scrolling distance in primary dimension. + * The scrolling distance is the minimum number of items before + * the first or the last visible item. For example, the scrolling + * distance of one defines that the focus should never get to the + * first or the last visible item, except in the beginning or the + * end of the list. + * + * @since S60 ?S60_version + * @return The scrolling distance in primary dimension. + */ + virtual int primaryScrollingDist() const = 0; + + /** + * Getter for scrolling distance in secondary dimension. + * + * @since S60 ?S60_version + * @return The scrolling distance in secondary dimension. + */ + virtual int secondaryScrollingDist() const = 0; + + /** + * Set the scrolling distances for the list control. + * The scrolling distances are used to determine when + * to start scrolling. The scrolling distance of zero + * indicates that the scrolling should start if the focus + * is moved outside of the visible items. Similarly, + * the scrolling distance of one indicates that the + * scrolling should start when the first or the last + * visible item is focused. + * + * @param aPrimaryScrollingDist The minimum number of items before the first + * or the last visible item in primary dimension. + * @param aSecondaryScrollingDist The minimum number of items before the first + * or the last visible item in secondary dimension. + * @since S60 ?S60_version + */ + virtual void setScrollingParams( int aPrimaryScrollingDist, + int aSecondaryScrollingDist ) = 0; + + /** + * Determine if the primary dimension on the screen is vertical. + * This is used to convert directional navigation events to the + * logical navigation events. + * + * @since S60 ?S60_version + * @return true if the primary dimension is vertical, + * false if the primary dimension is horizontal. + */ + virtual bool verticalPrimary() const = 0; + + /** + * Determine if the indices in the navigation space + * increase from left to right. This is used to determine + * the direction of the horizontal navigation events. + * + * @since S60 ?S60_version + * @return true if the indices increase from left to right, + * false if the indices increase from right to left. + */ + virtual bool leftToRight() const = 0; + + /** + * Determine if the indices in the navigation space + * increase from up to down. This is used to determine + * the direction of the vertical navigation events. + * + * @since S60 ?S60_version + * @return true if the indices increase from up to down, + * false if the indices increase from down to up. + */ + virtual bool upToDown() const = 0; + + /** + * Set the orientation parameters. + * The orientation parameters are used to convert directional + * navigation events to logical navigation events. + * + * @since S60 ?S60_version + * @param aVerticalPrimary Specify the orientation of the primary dimension. + * @param aLeftToRight Specify the increasing order of horizontal indices. + * @param aUpToDown Specify the increasing order of vertical indices. + */ + virtual void setOrientationParams( bool aVerticalPrimary, + bool aLeftToRight, bool aUpToDown ) = 0; + + /** + * Determine if the default key events are used for navigation. + * + * @since S60 ?S60_version + * @return true if the default key events are used, + * false otherwise. + */ + virtual bool defaultKeysEnabled() const = 0; + + /** + * Enable or disable the default key events. + * + * @since S60 ?S60_version + * @param aEnable The usage of the default key events. + */ + virtual void enableDefaultKeys( bool aEnable ) = 0; + }; + + } // namespace Alf + +#endif // I_ALFNAVIGATION_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfsortfunction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfsortfunction.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2004 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: callback interface for sort. +* +*/ + + +#ifndef I_ALFSORTFUNCTION +#define I_ALFSORTFUNCTION + +// CLASS DECLARATIONS +namespace Alf + { + +class IAlfMap; + +/** + * callback- interface for sort. + * + * @since S60 ?S60_version + * @status Draft + */ +class IAlfSortFunction + { +public: + /** + * compares two leafs + * + * @param aFirst first parameter for comparison + * @param aSecond second parameter for comparison + * @return < 0, if aFirst is less than aSecond, > 0 if aFirst is more than aSecond, + 0, if aFirst equals aSecond. + * @since S60 ?S60_version + */ + virtual int compareLeafs( const IAlfMap* aFirst, const IAlfMap* aSecond ) const = 0; + + }; + + } +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfvarianttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfvarianttype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2004 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: This interface defines a generic data type +* +*/ + + + +#ifndef I_ALFVARIANTTYPE_H +#define I_ALFVARIANTTYPE_H + + +// INCLUDES + +#include +#include + +namespace osncore + { +class UString; + } + +using namespace osncore; + +namespace Alf + { + +// FORWARD DECLARATIONS +class IAlfContainer; +class IAlfMap; +class IAlfBranch; +class IAlfModelBase; + +//INTERFACE DECLARATIONS + +/** + * An interface for variant data type. + * Application-specific data source classes may implement + * this interface. Alternatively, a wrapper class may + * be implemented to convert data fields from application source + * to some IAlfVariantType implementation (e.g., CAlfVariantType). + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfVariantType + { +public: + /** Type enumeration. */ + enum Type{EBool, EInt, EUint, EReal, EString, EContainer, EMap, EBranch,ECustomData}; + + /** Virtual destructor. */ + virtual ~IAlfVariantType() {} + + /** + * Set the Data the variantData + * + * @param aValue The new value. + * @since S60 ?S60_version + */ + virtual void set(IAlfVariantType& aValue) = 0; + + /** + * Get the data type. + * + * @return The data type. + * @since S60 ?S60_version + */ + virtual Type type() const = 0; + + /** + * Get the data value as an bool . + * + * @exception osncore:AlfDataException Thrown if type() is not EBool. + * @return bool data value. + * @since S60 ?S60_version + */ + virtual bool boolean() const = 0; + + /** + * Get the data value as an integer. + * + * @exception osncore:AlfDataException Thrown if type() is not EInt. + * @return Integer data value. + * @since S60 ?S60_version + */ + virtual int integer() const = 0; + + /** + * Get the data value as an unsigned integer. + * + * @exception osncore:AlfDataException Thrown if type() is not EUInt. + * @return Unsigned integer data value. + * @since S60 ?S60_version + */ + virtual uint uinteger() const = 0; + + /** + * Get the data value as a real number. + * + * @exception osncore:AlfDataException Thrown if type() is not EReal. + * @return Real data value. + * @since S60 ?S60_version + */ + virtual double real() const = 0; + + /** + * Get the data value as a descriptor. + * + * @exception osncore:AlfDataException Thrown if type() is not EString. + * @return string value. + * @since S60 ?S60_version + */ + virtual const UString& string() const = 0; + + /** + * Get the data value as a container interface. + * + * @exception osncore:AlfDataException Thrown if type() is not EContainer. + * @return Container interface. + * @since S60 ?S60_version + */ + virtual IAlfContainer* container() = 0; + + /** + * Get the data value as a map interface. + * + * @exception osncore:AlfDataException Thrown if type() is not EMap. + * @return Map interface. + * @since S60 ?S60_version + */ + virtual IAlfMap* map() = 0; + + /** + * Get the data value as a Branch interface. + * + * @exception osncore:AlfDataException Thrown if type() is not EBranch. + * @return Branch interface. + * @since S60 ?S60_version + */ + virtual IAlfBranch* branch() = 0; + + /** + * Get the data value as a User Defined Data Pointer. + * + * @exception osncore:AlfDataException Thrown if type() is not ECustomData. + * @return CAlfModelBase interface. + * @since S60 ?S60_version + */ + virtual IAlfModelBase* customData() = 0; + + }; + + } // namespace Alf + +#endif // I_ALFVARIANTTYPE_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2007 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: The base class for all widgets. +* +*/ + + +#ifndef I_ALFWIDGET_H +#define I_ALFWIDGET_H + + +#include +#include +#include + +namespace duiuimodel + { +class DuiNode; + } + +using namespace duiuimodel; + +class CAlfEnv; + +namespace Alf + { + +class CAlfWidgetControl; +class IAlfModel; +class IAlfWidgetFactory; +class IAlfContainerWidget; +class AlfCustomInitDataBase; + + +namespace alfwidget + { +static const IfId ident= + { + 0,"alfwidget" + }; + } +/** + * An interface for all widgets. + * Widgets consist of a model and a control. + * The model is owned by the widget, but all + * controls are owned by Alfred environment. + * The widget can be queried for interfaces provided + * by derived widget classes, the control or the model. + * Widgets can be constructed using the widget factory. + * Widgets are owned and accessed using the Alfred + * environment. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfWidget : public IAlfInterfaceBase + { +public: + static inline const IfId& type() + { + return alfwidget::ident; + } + + /** Virtual destructor. */ + virtual ~IAlfWidget() {} + + /** + * Getter for the control. The ownership is not passed. + * + * @since S60 ?S60_version + * @return The control of this widget, or NULL if the control is not specified. + */ + virtual CAlfWidgetControl* control() const = 0; + + /** + * Getter for the parent container. The ownership is not passed. + * + * @return the parent container or 0 if the widget is the root-widget. + */ + virtual IAlfContainerWidget* parent() const = 0; + + /** + * Sets a new widget control. After this call has been succesfully executed, the control is + * owned by this widget. When a new widget control is set to a widget the previously set widget + * control is removed. + * + * Through the aDeletePreviousControl - parameter user can specify whether the previously set + * control is destroyed when new control is set. Otherwise the previous control is left on the + * ownership of the caller. The caller has to manually delete the control or reset it to another + * widget or control group. + * + * If the control passed through this method exists in a control group it is appended to the + * control group of the view where this widget is contained in and removed from its previous + * control group. + * + * Widget should always have a valid control. An osncore::AlfException is thrown with error code + * osncore::EInvalidArgument if a control that is already used in another widget is attempted to + * be used with this widget. You have to replace the control in the source widget first + * before you can reuse that control in the target widget. See two code snippets below for details: + * + * @code + * // This will throw an osncore::AlfException with error code osncore::EInvalidArgument. + * targetWidget.setControl(sourceWidget.control()); + * @endcode + * + * @code + * CAlfWidgetControl* control = sourceWidget.control(); + * sourceWidget.setControl(newControl, false); + * // This is ok, since control is not set in sourceWidget anymore. + * targetWidget.setControl(control); + * @endcode + * + * @see IAlfViewWidget + * + * @param aControl The new widget control to be used with this widget. + * @param aDeletePreviousControl If set to true will destroy the previously set control from UI Accelerator Toolkit Environment. + * + * @exception osncore::AlfException If the given control is already set to another widget an osncore::AlfException + * is thrown with error code osncore::EInvalidArgument. + */ + virtual void setControl( CAlfWidgetControl* aControl, bool aDeletePreviousControl = true ) = 0; + + /** + * Getter for the model. The ownership is not passed. + * + * @since S60 ?S60_version + * @return The model of this widget, or NULL if the model is not specified. + */ + virtual IAlfModel* model() = 0; + + /** + * Setter for the model. Ownership is passed and the old model is released. + * + * @since S60 ?S60_version + * @param aModel The model for this widget. + * @param aTakeOwnership Whether takes ownership of model or not + * return void + */ + virtual void setModel( IAlfModel* aModel,bool aTakeOwnership = true) = 0; + + /** + * Get the name of the widget instance. + * + * @since S60 ?S60_version + * @return Widget name + */ + virtual const char* widgetName() const = 0; + + /** + * Sets/Releases the Focus from child widget of container. + * Does not set the actual focused status in roster. + * + * @since S60 ?S60_version + * @param aFocus boolean value for focused status + * return void + */ + virtual void setChildFocus(bool aFocus) = 0; + + /** + * Sets the presentation for the widget using presentation XML file. + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + virtual void setPresentation(const char* aFilePath) = 0; + }; + +/** + * Placeholder for information required to instantiate a widget + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfWidgetInitData + { + /** + * Owner environment for the widget + */ + CAlfEnv* mEnv; + + /** + * Container widget pointer that is going to contain the created widget. + */ + IAlfContainerWidget* mContainerWidget; + + /** + * Widget instance ID.This uniquely identifies every widget instance + * and is its name. Also see AlfWidget::Widgetname(). + */ + char* mWidgetId; + + /** + * Pointer to node in declaration containing information for the widget. + */ + DuiNode* mNode; + + /** + * XML file name containing the declaration for the presention of the widget. + */ + const char* mFilePath; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + + } // namespace Alf + +#endif // I_ALFWIDGET_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgetcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgetcontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,506 @@ +/* +* Copyright (c) 2007 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: The base class for all widgets. +* +*/ + + +#ifndef I_ALFWIDGETCONTROL_H +#define I_ALFWIDGETCONTROL_H + +#include +#include +#include + +//FORWARD DECLARATION +class TAlfEvent; +class CAlfDisplay; + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { +//FORWARD DECLARATIONS +class IAlfWidgetEventHandler; +class IAlfElement; +class AlfWidget; +class IAlfVariantType; +class AlfCustomInitDataBase; + + +namespace alfwidgetcontrol + { +static const IfId ident= + { + 0,"alfwidgetcontrol" + }; + } + +/** + * The interface for widget controls. + * Widget controls are derived from Alfred controls. This is + * the primary interface to access the widget control functionality. + * Alfred control interface can be queried, but direct access should not + * be needed. Widget controls are responsible for the widget logic, i.e., + * storing and controlling the state of the widget. This usually includes + * input event handling, updating the presentation, and communication with + * the model, the application, and other controls. Event handlers can be + * used to implement parts of the widget logic. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfWidgetControl : public IAlfInterfaceBase + { +public: + + /** + * Defines the bitflags used with the state interfaces. + */ + + // Visible is set if the widget control is currently intended to be visible + static const uint Visible = 0x0001; + + // Enabled is set if the widget control is to be responsive to user input + // Note: Presentation may render this control in some way to indicate that + // it is disabled + static const uint Enabled = 0x0002; + + // Focused is set if the control is to be currently attracting key events + static const uint Focused = 0x0004; + + // Focusable is set iff the widget control is to allow focus to be put + // on it + static const uint Focusable = 0x0008; + +public: + static inline const IfId& type() + { + return alfwidgetcontrol::ident; + } + /** + * Virtual destructor. + * + * @since S60 ?S60_version + */ + virtual ~IAlfWidgetControl() {} + + /** + * Get the state of the control. + * The state is a combination of binary state flags. + * + * The individual aspects of the state can be queried by testing + * for the bits in the return value. + * + * @since S60 ?S60_version + * @return The bit-pattern encoding the state + */ + virtual uint state() const = 0; + + /** + * Sets the widget control's state. + * + * The entire state of the widget is set to the passed-in value. + * + * The new state must conform to the following invariants: + * + * If IAlfWidgetControl::Focus is set, then IAlfWidgetControl::Focusable must also be set + * If IAlfWidgetControl::Focusable is set, then IAlfWidgetControl::Enabled must also be set + * + * If these invariants are violated, then this method will throw AlfException::EInvalidArgument + * + * @since S60 ?S60_version + * @param aState The new state of the control. + */ + virtual void setState( uint aState ) = 0; + + /** + * Enable given states. + * + * This method modifies a state by enabling bits. No bits are disabled. + * This is equal to SetState( State() | aState ). + * + * The resulting state is tested for the invariants documented with setState() + * and throws the same exceptions. + * + * @since S60 ?S60_version + * @param aState The states to be enabled. + */ + virtual void enableState( uint aState ) = 0; + + /** + * Disable given states. + * + * This method modifies a state by clearing bits. No bits are set. + * This is equal to SetState( State() & ( 0xFFFFFFFF ^ aState ) ). + * + * The resulting state is tested for the invariants documented with setState() + * and throws the same exceptions. + * + * @since S60 ?S60_version + * @param aState The states to be disabled. + */ + virtual void disableState( uint aState ) = 0; + + /** + * Checks the current state of the widget control for a single aspect. + * This is equal to enabled = State() & aState + * + * The parameter passed in should usually be a single bit state aspect + * e.g. IAlfWidgetControl::Focusable + * If a pattern with more than one bit set is passed in, the result + * is not easily usable. + * + * @since S60 ?S60_version + * @param aState a state bit pattern to test + * @return true if and only one of the passed-in bits is set in the state + */ + virtual bool checkState( uint aState ) const = 0; + + /** + * Get the number of event handlers in the control. + * + * @since S60 ?S60_version + * @return The number of event handlers. + */ + virtual int numEventHandlers() const = 0; + + /** + * Get an event handler by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the event handler to get. + * + * @return The event handler at the given index. + */ + virtual IAlfWidgetEventHandler& eventHandler( int aIndex ) = 0; + + /** + * Get the index of the given event handler. + * The index specifies the order in which + * the event handlers are processed. + * + * @since S60 ?S60_version + * @param aEventHandler The event handler. + * + * @return The index of the event handler, or -1 if the event handler + * does not exist. + */ + virtual int eventHandlerIndex( + IAlfWidgetEventHandler& aEventHandler ) const = 0; + + + /** + * Find an event handler responsible for the given event. + * + * @since S60 ?S60_version + * @param aEvent The event. + * + * @return The first event handler to handle the given event, or NULL + * if not found. + */ + virtual IAlfWidgetEventHandler* findEventHandler( + const TAlfEvent& aEvent ) = 0; + + /** + * Add a new event handler. + * The control takes the ownership of the event handler. + * + * @since S60 ?S60_version + * @param aEventHandler The event handler to be added. + * @param aIndex The index of the new event handler, + * or -1 to append the event handler after the existing + * event handlers. + */ + virtual void addEventHandler( + IAlfWidgetEventHandler* aEventHandler, + int aIndex = -1 ) = 0; + + /** + * Remove and destroy an event handler. + * + * @since S60 ?S60_version + * @param aEventHandler The event handler to be removed and destroyed. + */ + virtual void removeAndDestroyEventHandler( + IAlfWidgetEventHandler& aEventHandler ) = 0; + + /** + * Remove and destroy an event handler from the control bases on its name. + * + * @since S60 ?S60_version + * @param aHandlerId The name/Id of the event handler to be removed + * and destroyed. + */ + virtual void removeAndDestroyEventHandler( const UString& aHandlerId ) = 0; + + + /** + * Remove and destroy an event handler. + * + * @since S60 ?S60_version + * @param aEventHandler The event handler to be removed and destroyed. + */ + virtual void removeEventHandler( + IAlfWidgetEventHandler& aEventHandler ) = 0; + + + /** + * Remove and destroy all event handlers associated with presentation. + * + * @since S60 ?S60_version + */ + virtual void removeAndDestroyPresentationEventHandlers() = 0; + + /** + * Removes all event handlers associated with presentation from + * this control. + * + * @since S60 ?S60_version + */ + virtual void removePresentationEventHandlers() = 0; + + /** + * Get the number of elements in the control. + * + * @since S60 ?S60_version + * @return The number of elements. + */ + virtual int numElements() const = 0; + + /** + * Get an element by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the element to get. + * + * @return The element at the given index. + */ + virtual IAlfElement& element( int aIndex ) = 0; + + /** + * Find an element by name. + * + * @since S60 ?S60_version + * @param aName The name of the element to find. + * + * @return The found element, or NULL if not found. + */ + virtual IAlfElement* findElement( const char* aName ) = 0; + + /** + * Add a new element. + * The control takes the ownership of the element. + * + * @since S60 ?S60_version + * @param aElement The element to be added. + */ + virtual void addElement( IAlfElement* aElement ) = 0; + + /** + * Remove and destroy an element. All visuals created by the + * element are destroyed. + * + * @since S60 ?S60_version + * @param aElement The element to be removed and destroyed. + */ + virtual void removeAndDestroyElement( const IAlfElement& aElement ) = 0; + + /** + * Remove an element. + * + * @since S60 ?S60_version + * @param aElement The element to be removed. + */ + virtual void removeElement( const IAlfElement& aElement ) = 0; + + /** + * Get an id for mapping data to a visual tree created by an element. + * The data id is required to be unique withing the scope of the element. + * The parent data id and data id ranges specified by SetDataIdRange can + * be used to calculate data ids in hierarchical element structures. + * In the default implementation, the data id is calculated as follows: + * \f[ + * data id = aParentDataId * DataIdRange( aElement ) + aIndex + * \f] + * + * @since S60 ?S60_version + * @param aElement The element to associate the data id with. + * @param aIndex The index of the data field. + * @param aParentDataId The parent data id in the data hierarchy. + * @return A unique data id for mapping data to a visual tree. + */ + virtual uint elementDataId( + const IAlfElement& aElement, + uint aIndex, + uint aParentDataId ) = 0; + + /** + * Get the parent data id from the given data id. + * In the default implementation, the parent data id is calculated + * as follows: + * \f[ + * parent data id = aDataId / DataIdRange( aElement ) + * \f] + * The implementation should match the functionality of ElementDataId(). + * + * @since S60 ?S60_version + * @param aElement The element associated with the given data id. + * @param aDataId The data id. + * @return The parent data id. + */ + virtual uint parentElementDataId( + const IAlfElement& aElement, + uint aDataId ) = 0; + + /** + * Get the index of the given child data id in the parent data container. + * In the default implementation, the parent data id is calculated + * as follows: + * \f[ + * index = aDataId % DataIdRange( aElement ) + * \f] + * The implementation should match the functionality of ElementDataId(). + * + * @since S60 ?S60_version + * @param aElement The element associated with the given data id. + * @param aDataId The data id. + * @return The parent data id. + */ + virtual uint dataIdToIndex( + const IAlfElement& aElement, + uint aDataId ) = 0; + + /** + * Get data for a visual tree created by the given element. + * + * @since S60 ?S60_version + * @param aElement The element containing the visual tree. + * @param aDataId The data id of the visual tree. + * @return Data for the visual tree. + */ + virtual IAlfVariantType* elementData( + const IAlfElement& aElement, + uint aDataId ) = 0; + + /** + * Set the range of data ids for an element. + * The range is used for data mapping in ElementDataId() and ElementData(). + * The default range for all elements is 0xFFFFFFFF. The ranges need to be + * adjusted for child elements in hierarchical element structures. + * Otherwise,the data ids will overflow and not remain unique. + * @see ElementDataId(). + * + * @since S60 ?S60_version + * @param aElement The element. + * @param aRange The range of data ids. + */ + virtual void setDataIdRange( + const IAlfElement& aElement, + uint aRange ) = 0; + + /** + * Get the range of data ids for the given element. + * The range is used for data mapping in ElementDataId() and ElementData(). + * @see SetDataIdRange(). + * + * @since S60 ?S60_version + * @param aElement The element. + * @return The range of data ids for the element. + */ + virtual uint dataIdRange( const IAlfElement& aElement ) = 0; + + /** + * Create or update the presentation for the widget. + * + * @since S60 ?S60_version + */ + virtual void updatePresentation() = 0; + + /** + * Remove visuals from all elements. The visuals are destroyed + * after the given delay. This allows executing an animation + * sequence before the actual destruction of visuals. + * + * @since S60 ?S60_version + * @param aTimeMilliseconds The remaining time to destruction of + * all visuals. + */ + virtual void destroyPresentation( int aTimeMilliseconds ) = 0; + + /** + * Remove visuals from all elements and destroy all elements. + * The visuals and elements are destroyed after the given delay. + * This allows executing an animation sequence before the actual + * destruction of visuals. + * + * @since S60 ?S60_version + * @param aTimeMilliseconds The remaining time to destruction of + * all visuals. + */ + virtual void destroyVisualsAndElements( int aTimeMilliseconds = 0 ) = 0; + + /** + * Get the owner widget of this control. + * + * @since S60 ?S60_version + * @return The owner widget, or NULL if this control does not belong to + * any widget. + */ + virtual AlfWidget* widget() = 0; + + /** + * Handles events sent to widget control. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * @return Result of event processing. See AlfEventStatus. + */ + virtual AlfEventStatus handleEvent( const TAlfEvent& aEvent ) = 0; + + }; + +/** + * Placeholder for information required to instantiate a widgetcontrol + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfWidgetControlInitData + { + + /** + * Display pointer + */ + CAlfDisplay* mDisplay; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + } // namespace Alf + +#endif // I_ALFWIDGETCONTROL_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgetcontroldescriptor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgetcontroldescriptor.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2007 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: An interface used by design tools to get a description of the control. +* +*/ + + +#ifndef I_ALFWIDGETCONTROLDESCRIPTOR_H +#define I_ALFWIDGETCONTROLDESCRIPTOR_H + +#include + +#include + +namespace Alf + { + +/** + * An interface used by design tools to get a description of the control. + * The description may include a generic description of the control, and + * descriptions of the event handlers and elements used by the control. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfWidgetControlDescription : public IAlfInterfaceBase + { +public: + /** + * Get the description of the control. + * + * @since S60 ?S60_version + * @return The description of the control. + */ + virtual const TDesC8& controlDescription() const = 0; + + /** + * Get the number of required elements in the control. + * + * @since S60 ?S60_version + * @return The number of required elements. + */ + virtual int numRequiredElements() const = 0; + + /** + * Get the name of a required element by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the element. + * @return The name of the element at the given index. + */ + virtual const TDesC8& elementName(int aIndex) const = 0; + + /** + * Get the description of a required element by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the element. + * @return The description of the element at the given index. + */ + virtual const TDesC8& elementDescription(int aIndex) const = 0; + + /** + * Get the number of required event handlers in the control. + * + * @since S60 ?S60_version + * @return The number of required event handlers. + */ + virtual int numRequiredEventHandlers() const = 0; + + /** + * Get the event id of a required event handler by index. + * The event id may be a custaom event id or a key event id. + * + * @since S60 ?S60_version + * @param aIndex The index of the event handler. + * @return The name of the event handler at the given index. + */ + virtual uint eventHandlerId(int aIndex) const = 0; + + /** + * Determine the type of a required event handler by index. + * The event type may be a custom event or a key event. + * + * @note Pointer event handlers cannot be identified without + * an associated custom event id. Therefore, pointer event handlers + * are visible as custom event handlers. + * + * @since S60 ?S60_version + * @param aIndex The index of the event handler. + * @return ETrue if the event handler is a key event handler. + * EFalse if the event handler is a custom event handler. + */ + virtual bool keyEventHandler(int aIndex) const = 0; + + /** + * Get the name of a required event handler by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the event handler. + * @return The name of the event handler at the given index. + */ + virtual const TDesC8& eventHandlerName(int aIndex) const = 0; + + /** + * Get the description of a required event handler by index. + * + * @since S60 ?S60_version + * @param aIndex The index of the event handler. + * @return The description of the event handler at the given index. + */ + virtual const TDesC8& eventHandlerDescription(int aIndex) const = 0; + + }; + + } // namespace Alf + +#endif // I_ALFWIDGETCONTROLDESCRIPTOR_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgeteventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfwidgeteventhandler.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2007 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: Widget control event handler interface. +* +*/ + + +#ifndef I_ALFWIDGETEVENTHANDLER_H +#define I_ALFWIDGETEVENTHANDLER_H + +#include +#include + + +class TAlfEvent; + +namespace duiuimodel + { +class DuiNode; + } +using namespace duiuimodel; + +namespace Alf + { +//FORWARD DECLARATIONS +class CAlfWidgetControl; +class AlfCustomInitDataBase; +struct AlfWidgetEventHandlerInitData; + + +namespace alfwidgeteventhandler + { +static const IfId ident = + { + 0, "alfwidgeteventhandler" + }; + } + +/** + * The interface for event handlers used by + * widget controls. The event handlers are + * used for handling any Alfred events, including + * key events, pointer events and custom events. + * Interfaces provided by the event handlers can + * be accessed using IAlfInterfaceBase::MakeInterface(). + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfWidgetEventHandler : public IAlfInterfaceBase + { +public: + enum AlfEventHandlerType + { + /** + * Presentation related event handlers. These will be deleted when the + * presentation is destroyed. + * @see: IAlfWigetControl::destroyPresentation + * @see: IAlfWiget::setPresentation + */ + EPresentationEventHandler, + /** + * Logical event handlers. These event handlers are not presentation related and + * will not be destroyed during the destruction of the presentation. + */ + ELogicalEventHandler, + }; + + /** + * Phase in which event handlers are executed. + */ + enum AlfEventHandlerExecutionPhase + { + /** + * Tunneling event handlers are executed only in the tunnelling phase of the + * event handling cycle. Tunnelling event handlers are executed before + * IAlfWidgetControl::HandleEvent is executed. + * @see IAlfWidgetControl::HandleEvent + */ + ETunnellingPhaseEventHandler, + + /** + * Bubbling event handlers are executed only in the bubbling phase of the + * event handling cycle. Bubbling event handlers are executed after + * IAlfWidgetControl::HandleEvent is executed. + * @see IAlfWidgetControl::HandleEvent + */ + EBubblingPhaseEventHandler, + + /** + * These event handlers are executed both in the tunneling and bubbling phase + * of the event handling cycle i.e both before and after IAlfWidgetControl::HandleEvent + * is executed. + * @see IAlfWidgetControl::HandleEvent + */ + ETunnellingAndBubblingPhaseEventHandler, + }; + + static inline const IfId& type() + { + return alfwidgeteventhandler::ident; + } + + virtual inline ~IAlfWidgetEventHandler() {} + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. Pointer event handlers cannot be + * identified directly, since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * + * @since S60 ?S60_version + * @param aEvent The event. + * @return ETrue if the event can be processed. Otherwise EFalse. + */ + virtual bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const = 0; + + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return Result of event processing. See AlfEventStatus. + */ + virtual AlfEventStatus offerEvent( CAlfWidgetControl& aControl,const TAlfEvent& aEvent) = 0; + + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . The high 16 bits are + * available for states defined by the client code. + */ + virtual void setActiveStates( unsigned int aStates ) = 0; + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ) = 0; + + /** + * Returns AlfWidgetEventHandlerInitData. + * + * @return A pointer to AlfWidgetEventHandlerInitData structure which contains + * for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() = 0; + + /** + * Returns the type of EventHandler. + * @see IAlfWidgetEventHandler::AlfEventHandlerType + * + * @return The type of event handler. + */ + virtual AlfEventHandlerType eventHandlerType() = 0; + + /** + * Returns information about the phase in the event handling cycle in + * which the event hadler will be executed. + * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + * + * @return Event handler execution phase. + */ + virtual AlfEventHandlerExecutionPhase eventExecutionPhase() = 0; + }; + +/** + * Placeholder for information required to instantiate an event handler + * via the widget factory mechanism. + * A pointer to this structure is casted to a void pointer and sent to the + * factory plugin. + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +struct AlfWidgetEventHandlerInitData + { + /** + * Event handler instance ID.This uniquely identifies every event handler instance. + */ + char* mWidgetEventHandlerId; + + /** + * Pointer to node in declaration containing information for the widget. + */ + DuiNode* mNode; + + /** + * Pointer to custom data passed via factory mechanism + * Not Owned. + */ + AlfCustomInitDataBase* mCustomData; + }; + + } // namespace Alf + +#endif // I_ALFWIDGETEVENTHANDLER_H + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/alf_widgetutils_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/alf_widgetutils_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +alf widgetutils api +Alf WidgetUtils API +c++ +alfwidgetutils + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget factory API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// To be removed once migration to the new internal export dir has been done + +../inc/alf/alffactorypluginloader.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alffactorypluginloader.h) +../inc/alf/alftypes.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alftypes.h) +../inc/alf/ialffactoryplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/ialffactoryplugin.h) +../inc/alf/alfwidgetfactoryloader.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetfactoryloader.h) +../inc/alf/alfexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfexception.h) +../inc/alf/alfattributeexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfattributeexception.h) +../inc/alf/alfvisualexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfvisualexception.h) +../inc/alf/alfelementexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfelementexception.h) +../inc/alf/alfwidgetexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfwidgetexception.h) +../inc/alf/alfdataexception.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfdataexception.h) +../inc/alf/alfexceptions.h MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfexceptions.h) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfattributeexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfattributeexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 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: attribute exception +* +*/ + + + + +#ifndef ALFATTRIBUTEEXCEPTION_H_ +#define ALFATTRIBUTEEXCEPTION_H_ + +#include + +using namespace std; + +namespace osncore + { + + +/** + * UI library attribute exception class. + * + * @lib core.lib + * @since S60 ?S60_version + */ +class AlfAttributeException : public AlfException + { +public: + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfAttributeException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfAttributeException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfAttributeException() throw(); + + /** + * Returns the description of the exception. + * @return The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + }; + + } + +#endif //ALFATTRIBUTEEXCEPTION_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfdataexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfdataexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007 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: data exception +* +*/ + + + + +#ifndef ALFDATAEXCEPTION_H_ +#define ALFDATAEXCEPTION_H_ + +#include + + +namespace osncore + { + + +/** + * @class AlfDataException alfdataexception.h "alf/alfdataexception.h" + * Exception class used with invalid data exceptions. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfDataException : public AlfException + { +public: + + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfDataException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfDataException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfDataException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + }; + + } + +#endif //ALFDATAEXCEPTION_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfelementexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfelementexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 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: element exception +* +*/ + + + + +#ifndef ALFELEMENTEXCEPTION_H_ +#define ALFELEMENTEXCEPTION_H_ + +#include + + +namespace osncore + { + +/** + * @class AlfElementException alfelementexception.h "alf/alfelementexception.h" + * Element exception class. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfElementException : public AlfException + { +public: + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfElementException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfElementException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfElementException() throw(); + + /** + * Returns the description of the exception. + * @return The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + }; + + } + +#endif //ALFELEMENTEXCEPTION_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2007 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: bad alloc eception interface +* +*/ + + + + +#ifndef ALFEXCEPTION_H_ +#define ALFEXCEPTION_H_ + +#include +#include + +using namespace std; + +namespace osncore + { + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +#ifdef ALF_DEBUG_EXCEPTIONS +/** +* Use this macro for throwing exceptions in the widgetmodel code. +* +* @param p1 Exception class +* @param p2 Error code +* @param p3 Debug information string +*/ +#define ALF_THROW(p1,p2,p3) \ +{p1 p4= p1(p2,p3, __FILE__ ":" TOSTRING(__LINE__)); throw (p4);} +#else +#define ALF_THROW(p1,p2,p3) {p1 p4= p1(p2); throw(p4);} +#endif // ALF_DEBUG_EXCEPTIONS + + +/** +* Error codes for Alf Widget Model. These error codes are sent within +* AlfException class and they are common across all widgets. Widget specific +* exceptions are defined together with widget specific exception classes. +* For more information on widget specific errors see widget specific exception +* classes (like CAlfButtonException). +*/ +enum AlfWidgetModelException + { + ECommonError, + + /** Passed attribute had no meaning in the object + where it was passed to. */ + EInvalidAttribute, + + /* Passed attribute was valid, but the value for the + attribute was invalid. */ + EInvalidAttributeValue, + + /** Not enought information provided to affect the specified attribute. */ + EIncompleteAttributeValues, + + /** Passed visual was invalid */ + EInvalidVisual, + + /** Creation of visual failed */ + ECanNotCreateVisual, + + /** Passed visual value was invalid */ + EInvalidVisualValue, + + /** Passed Element was invalid */ + EInvalidElement, + + /** Invalid data type in Alf::IAlfVariantType */ + EInvalidVariantDataType, + + /** Array Index out of bounds */ + EInvalidArrayIndex, + + /** A non-applicable operation was performed on a + Alf::IAlfContainer object. */ + EInvalidContainerOperation, + + /** A non-applicable operation was performed on a + Alf::IAlfMap object. */ + EInvalidMapOperation, + + /** A non-applicable operation was performed on a + Alf::IAlfBranch object. */ + EInvalidBranchOperation, + + /** An invalid operation was perfomed on a + Alf::IAlfModel object. */ + EInvalidModelOperation, + + /** Passed Widget was invalid */ + EInvalidWidget, + + /** + * An invalid instance ID was supplied to the factory while creating a + * widget. Also used if an attempt is used to create a widget with same + * instance ID as an existing widget. + */ + EInvalidWidgetInstanceId, + + /** + * No display was found from the UI Accelerator Toolkit environment in + * which the widget should have been constructed. + * See Alf::IAlfWidgetFactory::createWidget() for more information. + */ + EDisplayNotFound, + + /** + * EInvalidArgument error code can be used when a user passes an + * argument which is invalid. For example, user tries to set alignment + * of vertical scrollbar as top or bottom (vertical scrollbar can be left or + * right aligned only). + */ + EInvalidArgument, + + /** + * Error code used when an operation would result in an invalid object + * hierarchy. There are multiple object hierarchies maintained in widget + * model that this error code can relate to. Widget objects are stored in a + * hierarchy under a view widget + * (see Alf::IAlfContainerWidget and Alf::IAlfWidget for more information). + * Widget presentation can be constructed from a hierarchy of visual + * templates (see Alf::IAlfVisualTemplate). + */ + EInvalidHierarchy + }; + +/** + * @class AlfException alfexception.h "alf/alfexception.h" + * Base exception class. + * + * Exceptions specify an error code, which can be one of the error codes + * defined in osncore::AlfWidgetModelException. Concrete widgets derive their + * own exception classes from this base class. If the exception is thrown from + * a concrete widget, the error code can also be one of the widget specific + * error codes. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfException : public exception + { +public: + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + */ + OSN_IMPORT AlfException( int aErrorCode, const char* aInfo ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfException() throw(); + + /** + * Returns the description of the exception. + * @return The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + + /** + * Returns the error code of the exception. + * @return The error code of the exception. + */ + OSN_IMPORT virtual int errorCode() const throw(); + + /** + * Returns additional information defined in the exception. + * This can be e.g. the name of the class, which has thrown the exception. + * + * @return Additional information defined in the exception. + */ + OSN_IMPORT virtual const char* info() const throw(); + + /** + * Returns a string with the filename and the line number of the source code, + * which has thrown the exception. If the information does not exist, + * an empty string is returned. + * + * @return A string with the filename and the line number of the source code, + * which has thrown the exception. + */ + OSN_IMPORT const char* fileAndLine() const throw(); + +private: // data + + int mErrorCode; + const char* mInfo; + const char* mFileAndLine; + }; + + } + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfexceptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfexceptions.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 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: includes all exception classes +* +*/ + + + + +#ifndef ALFEXCEPTIONS_H_ +#define ALFEXCEPTIONS_H_ + +#include +#include +#include +#include +#include + +#endif //ALFEXCEPTIONS_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alffactorypluginloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alffactorypluginloader.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2007 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: Factory plugin loader +* +*/ + + + +#ifndef ALFFACTORYPLUGINLOADER_H +#define ALFFACTORYPLUGINLOADER_H + +#include +#include + +using namespace std; + +namespace Alf + { +class IAlfFactoryPlugin; +class AlfFactoryPluginLoaderImpl; + +/** + * @class AlfFactoryPluginLoader alffactorypluginloader.h "alf/alffactorypluginloader.h" + * + * Factory plugin loader loads factory plugins. Loader will resolve factory + * plugin based on given string and load factory which can create requested + * product. Loader owns factory plugins. Factory products and their + * derivatives must be destroyed before destroying a loader object. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfFactoryPluginLoader + { +public: // Constructors and destructor + + /** + * Constructor. + * + * @exception std::bad_alloc Thrown if out of memory during the + * construction. + */ + OSN_IMPORT AlfFactoryPluginLoader(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfFactoryPluginLoader(); + +public: + + /** + * Load a factory plugin. + * + * @param aFactoryProduct Factory plugin is loaded based on a given string + * @since S60 5.0 + * @return Pointer to IAlfFactoryPlugin or NULL. Ownership is not + * transferred to caller. + */ + OSN_IMPORT IAlfFactoryPlugin* loadFactoryPlugin(const char* aFactoryProduct); + +private: + /** + * Copy Constructor + */ + AlfFactoryPluginLoader(const AlfFactoryPluginLoader&); + + /** + * Assignment Operator + */ + AlfFactoryPluginLoader& operator=(const AlfFactoryPluginLoader&); + +private: // Data + auto_ptr mImpl; + }; + + } // namespace Alf + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alftypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alftypes.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 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: Type declarations +* +*/ + + + +#ifndef ALFTYPES_H +#define ALFTYPES_H + +namespace Alf + { +struct IfId + { + unsigned int mIfId; + const char* mImplementationId; + }; + + +/** + * Specfies the result of event processing when an event that + * is offered to an event handler. + */ +enum AlfEventStatus + { + /** + * The event handler did not handle the event. + */ + EEventNotHandled = 0, + /** + * The event handler handled the event but does not + * desire to block the event flow to other interested + * entities. + */ + EEventHandled, + /** + * The event handler consumed the event and wishes to + * terminate event flow to other interested enetities. + * In other words, the event handler acted as a "filter" + * for the event. + */ + EEventConsumed, + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfvisualexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfvisualexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007 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: visual exception +* +*/ + + + + +#ifndef ALFVISUALEXCEPTION_H_ +#define ALFVISUALEXCEPTION_H_ + +#include + +namespace osncore + { + +/** + * @class AlfVisualException alfvisualexception.h "alf/alfvisualexception.h" + * Visual exception class. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfVisualException : public AlfException + { +public: + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfVisualException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfVisualException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfVisualException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + }; + } + +#endif //ALFVISUALEXCEPTION_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfwidgetexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfwidgetexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 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: widget exception +* +*/ + + + + +#ifndef ALFWIDGETEXCEPTION_H_ +#define ALFWIDGETEXCEPTION_H_ + +#include + +using namespace std; + +namespace osncore + { + +/** + * @class AlfWidgetException alfwidgetexception.h "alf/alfwidgetexception.h" + * Widget exception class. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfWidgetException : public AlfException + { +public: + /** + * Constructor. + * @param aErrorCode Error code + */ + OSN_IMPORT AlfWidgetException( const int aErrorCode ) throw(); + + /** + * Constructor. + * @param aErrorCode Error code + * @param aInfo Optional additional information or NULL + * @param aFileAndLine Optional file and line information or NULL + */ + OSN_IMPORT AlfWidgetException( + int aErrorCode, const char* aInfo, const char* aFileAndLine ) throw(); + + /** + * Class Destructor. + */ + OSN_IMPORT virtual ~AlfWidgetException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + OSN_IMPORT virtual const char* what() const throw(); + }; + + } + +#endif //ALFWIDGETEXCEPTION_H_ + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/alfwidgetfactoryloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/alfwidgetfactoryloader.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2007 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: Loads widget factory plugin +* +*/ + + + +#ifndef I_ALFWIDGETFACTORYLOADER_H +#define I_ALFWIDGETFACTORYLOADER_H + +#include +#include + +using namespace std; + +class CAlfEnv; + +namespace Alf + { +class IAlfWidgetFactory; +class AlfWidgetFactoryLoaderImpl; + +/** + * @class AlfWidgetFactoryLoader alfwidgetfactoryloader.h "alf/alfwidgetfactoryloader.h" + * + * Factory plugin loader loads factory plugins. Loader will resolve factory + * plugin based on given string and load factory which can create requested + * product. Loader owns factory plugins. Factory products and their + * derivatives must be destroyed before destroying a loader object. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfWidgetFactoryLoader + { +public: // Constructors and destructor + + /** + * Constructor. + * + * @exception std::bad_alloc Thrown if out of memory during the construction. + */ + OSN_IMPORT AlfWidgetFactoryLoader(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~AlfWidgetFactoryLoader(); + +public: + + /** + * Loads a widget factory. + * + * @param aEnv Alfred Environment + * @return Pointer to IAlfWidgetFactory or 0. + * Ownership is not transferred to caller. + */ + OSN_IMPORT IAlfWidgetFactory* loadWidgetFactory(CAlfEnv& aEnv); + +private: + + /** + * Copy Constructor + */ + AlfWidgetFactoryLoader( const AlfWidgetFactoryLoader& ); + + /** + * Assignment Operator + */ + AlfWidgetFactoryLoader& operator=( const AlfWidgetFactoryLoader& ); + +private: // Data + auto_ptr mImpl; + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alf_widgetutils_api/inc/alf/ialffactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alf_widgetutils_api/inc/alf/ialffactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 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: factory plugin interface. +* +*/ + + + +#ifndef I_ALFFACTORYPLUGIN_H +#define I_ALFFACTORYPLUGIN_H + + +#include +#include + +namespace Alf + { + +namespace alffactoryplugin + { +static const IfId ident= + { + 0,"alffactoryplugin" + }; + } + +/** + * @class IAlfFactoryPlugin ialffactoryplugin.h "alf/ialffactoryplugin.h" + * Base class for factory plugins. + * + * @lib alfwidgetutils.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfFactoryPlugin : public IAlfInterfaceBase + { +public: + static const IfId& type() + { + return alffactoryplugin::ident; + } +public: + /** + * Create factory product. + * @param aProduct Product to create. + * @param aInitData Initialization data for product. + * @return Instance or 0. + */ + virtual IAlfInterfaceBase* createProduct( + const char* aProduct, void* aInitData ) = 0; + + /** + * Count available products. + * + * @return Product count. + */ + virtual int productCount() const = 0; + + /** + * Fetch product info by index. + * + * @param aIndex List index. + * @return String describing product. + */ + virtual const char* productInfo( int aIndex ) const = 0; + + /** + * Destructor. + */ + virtual ~IAlfFactoryPlugin() {}; + }; + } + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/alfexport.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/alfexport.hrh Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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: Defines export macros for internal APIs in uiaccelerator. +* +*/ + + +#ifndef ALFEXPORT_HRH +#define ALFEXPORT_HRH + +#include + +// Use this macro for exporting currently internal headers in uiaccelerator +#define ALF_INTERNAL_EXPORT(header) ../inc/##header |../../##header + +#endif //ALFEXPORT_HRH \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/gesturehelper_api/gesturehelper_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/gesturehelper_api/gesturehelper_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +gesturehelper api +API for gesture helper +c++ +gesturehelper + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/gesturehelper_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/gesturehelper_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008 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: Build information +* +*/ + +#include +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/gesturecontrol.h MW_LAYER_PLATFORM_EXPORT_PATH(gesturecontrol.h) +../inc/gesturehelper.h MW_LAYER_PLATFORM_EXPORT_PATH(gesturehelper.h) +../inc/gestureobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(gestureobserver.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/gesturehelper_api/inc/gesturecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/gesturehelper_api/inc/gesturecontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007 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: Gesture control +* +*/ + +#ifndef _GESTURECONTROL_H_ +#define _GESTURECONTROL_H_ + +#include + +class CAlfEnv; +class CAlfDisplay; + +namespace GestureHelper +{ + +class CGestureHelper; +class MGestureObserver; + +/** + * Gesture control provides pointer event forwarding to gesture helper. + * + * Gesture control can be created as + * - Stand-alone: This functionality is usable by clients that want to + * capture pointer events from anywhere in the screen. For example, a view + * that wants to know if user tapped anywhere on the screen could use this. + * - Derived: client can use the forward-pointer-events-to-gesture-helper + * functionality by deriving from CGestureControl. Client has to create at + * least one visual that captures pointer events. This base class will + * receive the events and forward them to CGestureHelper. + * + * The client can keep other widgets on top of this control, to allow them + * priority of capturing the pointer events. + */ +class CGestureControl : public CAlfControl + { +public: + /** + * Creates a stand-alone gesture control. + * Creates a full screen visual that captures pointer events. Converts + * pointer events to gestures and calls back on aObserver. + * @param aFreeControlGroupId control group id that client does not use + */ + IMPORT_C static CGestureControl* NewLC( MGestureObserver& aObserver, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ); + + /** Destructor */ + IMPORT_C ~CGestureControl(); + + // From CAlfControl + IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent ); + + /** @see CGestureHelper::SetHoldingEnabled */ + IMPORT_C void SetHoldingEnabled( TBool aEnabled ); + /** @see CGestureHelper::IsHoldingEnabled */ + IMPORT_C TBool IsHoldingEnabled() const; + /** @see CGestureHelper::SetDoubleTapEnabled */ + IMPORT_C void SetDoubleTapEnabled( TBool aEnabled ); + /** @see CGestureHelper::IsDoubleTapEnabled */ + IMPORT_C TBool IsDoubleTapEnabled() const; + +protected: + /** Constructor */ + IMPORT_C CGestureControl(); + + /** + * Deriving class is expected to create a visual to receive pointer events. + * This base class does not create a visual (unless creates via NewLC, i.e., + * in that case this class is not derived from) + * @param aFreeControlGroupId control group id that client does not use + */ + IMPORT_C void ConstructL( MGestureObserver& aObserver, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ); + +private: + /// Helper that provides gestures + CGestureHelper* iHelper; + }; + +} // namespace GestureHelper + +#endif // _GESTURECONTROL_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/gesturehelper_api/inc/gesturehelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/gesturehelper_api/inc/gesturehelper.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2007 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: Gesture helper interface +* +*/ + +#ifndef _GESTUREHELPER_H_ +#define _GESTUREHELPER_H_ + +#include +#include + +class CAlfEnv; +class CAlfDisplay; +class TAlfEvent; +struct TPointerEvent; + +namespace GestureHelper +{ + +class CGestureHelperImpl; + +/** + * Gesture helper provides functionality to convert a stream of pointer events + * into a logical gesture, and to assist clients in calculation of gesture + * speed and distance. + * + * Interfaces + * - CGestureHelper is a parser of pointer events. Recognises gestures from + * a sequence of pointer events, and converts them to gesture commands. + * For documentation of callbacks, see @ref MGestureObserver. + * - MGestureObserver allows clients to get notified of gestures + * - MGestureEvent represents the gesture (event) + */ +NONSHARABLE_CLASS( CGestureHelper ) : public CBase + { +public: + /** + * The helper is expected to be a member variable, hence NewLC is not provided + */ + IMPORT_C static CGestureHelper* NewL( MGestureObserver& aObserver ); + + /** Destructor */ + IMPORT_C ~CGestureHelper(); + + /** + * Specify whether the helper will send hold events. By default, holding is enabled. + * "Hold" means user has held stylus/finger on the same position for a longer duration. + * + * Clients that require holding to be treated with no special meaning should disable + * holding to simplify their event handling. + * For example, assume the client uses swipe left/right to control navigation, and + * holding is enabled. If user holds, the client gets hold left/right + * event, and no swipe event. If user now drags left or right while still pressing + * stylus down, the client will not get a swipe event (since it already received a hold + * event). Upon release event, the client no reliable way of knowing whether the + * user swiped left/right or cancelled the swipe. This problem is removed if the + * client simply disables holding. In the above scenario while holding disabled, + * the client would get only swipe events (and released event). + * (Swipe can be cancelled by dragging towards, but not beyond, the starting position.) + */ + IMPORT_C void SetHoldingEnabled( TBool aEnabled ); + + /** + * @return whether sending hold events is currently enabled + * ("Hold" means user has held stylus/finger on the same position for a longer duration.) + */ + IMPORT_C TBool IsHoldingEnabled() const; + + /** + * Enables/disables double tap support. Double tap is disabled by default. + * When double tap is disabled, gesture helper emits tap events immediately when + * user lifts stylus/finger. + * When double tap is enabled, tap events are emitted after the double tap timeout passes. + * The timeout is the maximum time within which the second tap will be treated + * as a double tap. That is, there is a delay (sluggishness) before client receives + * the tap event when double tap is enabled. + * tap + timeout => tap event emitted after timeout + * tap + tap before timeout => double tap event emitted immediately after the second tap + * tap + swipe => tap + swipe events + * (tap + timeout + tap + timeout => two tap events) + */ + IMPORT_C void SetDoubleTapEnabled( TBool aEnabled ); + + /** + * @return whether double tap is currently enabled. See SetDoubleTapEnabled + */ + IMPORT_C TBool IsDoubleTapEnabled() const; + + /** + * Initialise pointer capture for Alfred + * This means that helper will receive drag events and pointer events that + * go outside the original visual area + */ + IMPORT_C void InitAlfredPointerCaptureL( CAlfEnv& aEnv, CAlfDisplay& aDisplay, + TInt aFreeControlGroupId ); + + /** + * Give a pointer event to the helper, to form a part of a gesture + * For AVKON-based client, this interface is the only option. + * Alfred-based client should use OfferEventL, as it allows gesture events to + * provider the visual on which the pointer event started. + * @param aEvent pointer event + * @return whether event was consumed or not + * EFalse the event is not a pointer events and if pointer up/drag + * event received without pointer down event + * ETrue in all the other cases of pointer event + */ + IMPORT_C TBool HandlePointerEventL( const TPointerEvent& aEvent ); + + /** + * Offer an Alf event. See HandlePointerEventL. + * @return whether event was consumed or not + * EFalse the event is not a pointer events and if pointer up/drag + * event received without pointer down event + * ETrue in all the other cases of pointer event + */ + IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent ); + + /** + * Cancel ongoing recognision. Purges all pointer events given earlier, and + * starts afresh. It is not necessary to call Cancel before deleting the object. + */ + IMPORT_C void Cancel(); + + /** + * Adds a new observer to gesture helper events. Replaces any earlier observer. + * This is to allow sharing of gesture helper between different controls. + * The control which is currently shown (control that is on top of the roster) + * will add as an observer and the earlier control which is now not in focus will + * automatically be removed as an observer. + * + * This API should be used only when the gesture helper is shared between more + * than one control. Gesture helper can be shared only among the controls within the same roster. + * Only required for alf based applications, not required for CCoeControl. + * + */ + IMPORT_C void AddObserver(MGestureObserver* aObserver); + +private: + /// interface implementation + CGestureHelperImpl* iImpl; + }; + +} // namespace GestureHelper + +#endif // _GESTUREHELPER_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/gesturehelper_api/inc/gestureobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/gesturehelper_api/inc/gestureobserver.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,244 @@ +/* +* Copyright (c) 2008-2008 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: Gesture helper interface +* +*/ + +#ifndef _GESTUREOBSERVER_H_ +#define _GESTUREOBSERVER_H_ + +#include + +class CAlfControl; +class CAlfVisual; + +namespace GestureHelper +{ + +/// flag that indicates gesture code is a holding code +/// clients should use MGestureEvent::IsHolding +const TInt EFlagHold = 0x10000000; + +enum TGestureCode + { + // states + EGestureStart = 0x00000001, // gesture just started (user pressed stylus down) + EGestureDrag = 0x00000002, // user moved stylus (may be holding or not holding) + EGestureReleased = 0x00000003, // user lifted stylus while user was holding + // gestures + EGestureUnknown = 0x00000005, // gesture was not recognised + // these codes are sent when user lifts stylus (if holding not started) + EGestureTap = 0x00000006, + EGestureDoubleTap = 0x00000007, // only if double tap is enabled + // (via CGestureHelper::SetDoubleTapEnabled or + // CGestureControl::SetDoubleTapEnabled) + EGestureSwipeLeft = 0x00000008, + EGestureSwipeRight = 0x00000009, + EGestureSwipeUp = 0x0000000A, + EGestureSwipeDown = 0x0000000B, + + // gestures related to advanced pointer events. These codes are sent if the platform supports advanced pointer events. + // states + EGestureMultiTouchStart = 0x0000000C, // multitouch gesture just started (user touched 2nd finger down) + EGestureMultiTouchReleased = 0x0000000D, // user released 2nd touch point while still holding the first touch point + // gestures + EGesturePinch = 0x0000000E, // This event is sent when the pinch is recognised for + // the first time or when the pinch distance is changing. + + // these codes are sent when user initiates holding by keeping stylus in + // same place for a longer duration + EGestureHoldLeft = EGestureSwipeLeft | EFlagHold, + EGestureHoldRight = EGestureSwipeRight | EFlagHold, + EGestureHoldUp = EGestureSwipeUp | EFlagHold, + EGestureHoldDown = EGestureSwipeDown | EFlagHold + }; + +/** + * Point of float accuracy + */ +NONSHARABLE_STRUCT( TRealPoint ) + { + inline TRealPoint(); + inline TRealPoint( const TRealPoint& aPoint ); + inline TRealPoint( TReal aX, TReal aY ); + inline TBool operator==( const TRealPoint& aPoint ) const; + + TReal32 iX; + TReal32 iY; + }; + +/** + * a gesture event + */ +class MGestureEvent + { +public: + /** X and Y axes, or both */ + enum TAxis + { + EAxisBoth, + EAxisHorizontal, + EAxisVertical + }; + +public: + /** + * @param aRelevantAxis indicates whether only x, y or both coordinates + * should be considered when determining the code. For example, + * if client specifies EAxisVertical as relevant axis, a swipe + * to left and slightly up would result in an "swipe up" code, + * and not "swipe left" code. If client specifies EAxisHorizontal + * or EAxisBoth, "swipe left" code is returned. + * @return gesture code + */ + virtual TGestureCode Code( TAxis aRelevantAxis ) const = 0; + + /** + * @return ETrue if user has activated holding + * (by keeping stylus in the same position for longer time) + * EFalse if holding has not been activated + */ + virtual TBool IsHolding() const = 0; + + /** + * @return position where gesture started, i.e., where stulys + * was pressed down + */ + virtual TPoint StartPos() const = 0; + + /** + * @return current position of the stylus + */ + virtual TPoint CurrentPos() const = 0; + + /** + * @return speed of a swipe. unit is pixels per second. + */ + virtual TRealPoint Speed() const = 0; + + /** + * Abstracts the algorithm to calculate speed during swipe and hold. This + * algorithm (currently) assumes that max speed is achieved at the edges of an + * area. + * @param aEdges represents the coordinates of the rectange on which speed is + * calculated. Speed will reach maximum if stylus is on the edge + * or beyond the rect. In practise, the value should match the + * area of the layout that contains the scrollable visuals. + * For example, if the control area is the whole screen, the + * rect should be the screen rect. + * @returns the speed as a percentage between -100% and 100% + */ + virtual TRealPoint SpeedPercent( const TRect& aEdges ) const = 0; + + /** + * @return Length of gesture from starting position + * (start pos - current pos) + */ + virtual TPoint Distance() const = 0; + + /** + * @return visual on which the gesture started + * NULL if not known (e.g., AVKON-based client + */ + virtual CAlfVisual* Visual() const = 0; + + /** + * Pinch distance + * + * Used only for pinch. Returns 0 for other gestures. + * + * @return The ratio of pinch end distance to pinch start distance * 100 + * PinchPercent above 100 for zooming out and below hundred for zooming in + */ + virtual TInt PinchPercent() const = 0; + + /** + * Centre point of the two touch points + * + * Used only for pinch. Returns TPoint(0,0) for other gestures. + * + * @return the centre point calculated using teh two touch down points + * This point will remian the same for one multitouch gesture start to end. + * This doesnt vary as the two points move away or closer. + */ + virtual TPoint PinchCentrePoint() const = 0; + + }; + +/** + * Observer that will be notified when user makes gestures + */ +class MGestureObserver + { +public: + /** + * Handle the gesture event + * @param aEvent event describing the gesture + */ + virtual void HandleGestureL( const MGestureEvent& aEvent ) = 0; + }; + +/** + * static class for finding a visual from a visual tree + */ +class HitTest + { +public: + /** + * @return the leaf-most visual is under aPos, or NULL if not found + */ + IMPORT_C static CAlfVisual* VisualByCoordinates( const CAlfControl& aControl, + const TPoint& aPos ); + }; + +// ---------------------------------------------------------------------------- +// Default constructor for real point +// ---------------------------------------------------------------------------- +// +inline TRealPoint::TRealPoint() + : iX( 0 ), iY( 0 ) + { + } + +// ---------------------------------------------------------------------------- +// Copy constructor for real point +// ---------------------------------------------------------------------------- +// +inline TRealPoint::TRealPoint( const TRealPoint& aPoint ) + : iX( aPoint.iX ), iY( aPoint.iY ) + { + } + +// ---------------------------------------------------------------------------- +// Copy constructor for real point +// ---------------------------------------------------------------------------- +// +inline TRealPoint::TRealPoint( TReal aX, TReal aY ) + : iX( aX ), iY( aY ) + { + } + +// ---------------------------------------------------------------------------- +// Default constructor for real point +// ---------------------------------------------------------------------------- +// +inline TBool TRealPoint::operator==( const TRealPoint& aPoint ) const + { + return iX == aPoint.iX && iY == aPoint.iY; + } + + +} // namespace GestureHelper + +#endif // _GESTUREOBSERVER_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/group/Doxyfile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/group/Doxyfile.txt Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1304 @@ +# Doxyfile 1.5.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "UI Accelerator DeclarativeUi uimodel" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = panic=@exception \ + leave=@exception \ + "internalTechnology=@par Internal technology" \ + "internalComponent=@par Internal component" \ + "internalAll=@par Internal all" \ + "publishedPartner=@par Published-partner" \ + "publishedAll=@par Published-all" \ + "prototype=@par Prototype" \ + "interim=@par Interim" \ + "released=@par Released" \ + "removed=@par Removed" \ + "test=@par Test" \ + "realtime=@par Realtime" \ + "status=@par Status:\n"\ + "attributes=@par Attributes: \n"\ + "interfaces=@par Interfaces: \n"\ + "lib=@par Library: \n"\ + "events=@par Events: \n"\ + "beginAPI=@name Exported API\n @{" \ + endAPI=@} + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../../inc/uimodel_iterator_api/inc/uimodel \ +INPUT = ../../inc/uimodel_node_api/inc/uimodel + + + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.c \ + *.cc \ + *.cpp \ + *.h \ + *.inl \ + *.hh \ + *.hrh \ + *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = TAlf \ + SAlf \ + CAlf \ + RAlf \ + MAlf \ + IAlf \ + Alf + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = doxygen + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = "NONSHARABLE_CLASS(name)=class name" \ + "OSN_NONSHARABLE_CLASS(name)=class name" \ + "_LIT(name,string)=const static TLitC name={sizeof(L##string)/2-1,L##string}" + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen will always +# show the root nodes and its direct children regardless of this setting. + +DOT_GRAPH_MAX_NODES = 50 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/group/Doxyfile_osn.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/group/Doxyfile_osn.txt Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1298 @@ +# Doxyfile 1.5.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "UI Accelerator Toolkit Operating System Neutrality Layer" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../osn_apidoc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = panic=@exception \ + leave=@exception \ + "internalTechnology=@par Internal technology" \ + "internalComponent=@par Internal component" \ + "internalAll=@par Internal all" \ + "publishedPartner=@par Published-partner" \ + "publishedAll=@par Published-all" \ + "prototype=@par Prototype" \ + "interim=@par Interim" \ + "released=@par Released" \ + "removed=@par Removed" \ + "test=@par Test" \ + "realtime=@par Realtime" \ + "beginAPI=@name Exported API\n @{" \ + endAPI=@} + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../osn_container_api/inc/osn \ + ../osn_exception_api/inc/osn \ + ../osn_global_api/inc/osn \ + ../osn_smartpointer_api/inc/osn \ + ../osn_string_api/inc/osn + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.c \ + *.cc \ + *.cpp \ + *.h \ + *.inl \ + *.hh \ + *.hrh \ + *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = TAlf \ + SAlf \ + CAlf \ + RAlf \ + MAlf \ + Alf + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = "NONSHARABLE_CLASS(name)=class name" \ + "_LIT(name,string)=const static TLitC name={sizeof(L##string)/2-1,L##string}" + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen will always +# show the root nodes and its direct children regardless of this setting. + +DOT_GRAPH_MAX_NODES = 50 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 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: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../alf_widgetfactory_api/group/bld.inf" +#include "../alf_widgetutils_api/group/bld.inf" +#include "../alf_widgetmodel_api/group/bld.inf" +#include "../osn_container_api/group/bld.inf" +#include "../osn_global_api/group/bld.inf" +#include "../osn_string_api/group/bld.inf" + +//resource pool +#include "../alf_resourcepool_api/group/bld.inf" + +// widget APIs +#include "../alf_containerwidget_api/group/bld.inf" +#include "../alf_viewwidget_api/group/bld.inf" +#include "../alf_scrollbarwidget_api/group/bld.inf" + +#include "../alf_customlayoutmanagers_api/group/bld.inf" + +// gesture helper Api's +#include "../gesturehelper_api/group/bld.inf" + +// MUL headers +#include "../mul_coverflowwidget_api/group/bld.inf" +#include "../mul_datamodel_api/group/bld.inf" +#include "../mul_sliderwidget_api/group/bld.inf" +#include "../mul_widget_api/group/bld.inf" + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_coverflowwidget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_coverflowwidget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: coverflow widget API +* +*/ + +#include +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../inc/mul/imulcoverflowwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulcoverflowwidget.h) + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_coverflowwidget_api/inc/mul/imulcoverflowwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_coverflowwidget_api/inc/mul/imulcoverflowwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2007 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: The interface class for all Multimedia UI Library Cover Flow Widgets. + * +*/ + +#ifndef I_MULCOVERFLOWWIDGET_H +#define I_MULCOVERFLOWWIDGET_H + +#include +#include +#include +#include +#include + +//Gesture Helper namespace +namespace GestureHelper + { + class CGestureHelper; + } + +namespace Alf + { + namespace mulcoverflowwidget + { + static const IfId Ident= + { + 0, "mulcoverflowwidget" + }; + } + + /** + * An interface for Multimedia coverflow Widget. + * Widgets consist of control and visualization elements. + * + * Interface paradigm would be used in a restrictive way. + * Controls are owned by Alfred environment. + * Widgets can be constructed using the widget factory. + * Widgets are owned and accessed using the Alfred + * environment. + * + * @lib mulcoverflowwidget.lib + */ + class IMulCoverFlowWidget : public IMulMultiItemWidget + { + public: + + /** + * Getter for the type identifier of this interface. + * + * @return A descriptor to identify the type of this interface. + **/ + static inline const IfId& Type() + { + return mulcoverflowwidget::Ident; + } + + /** + * Setting color as background of the coverflow. + * The API should be used in the case when the background type doesn't + * comes along with any extra data. This API should be used when the + * background has to set to Black, White or any other color + * + * @param aColor RGB color + * + * Examples: + * @code + * Set background of the coverflow as red color. + * + * mCoverFlowWidget->SetBackground( KRgbRed ); + * @endcode + **/ + virtual void SetBackground( const TRgb& aColor ) = 0; + + /** + * Setting Skin id as background of the coverflow. + * The API should be used in the case when the background of + * Coverflow should come from skin data. + * + * @param aItemID Skin ID. + * + * Examples: + * @code + * Set background of the coverflow as a texture. + * + * mCoverFlowWidget->SetBackground( KAknsIIDQsnBgScreenIdle ); + * + * @endcode + **/ + virtual void SetBackground(const TAknsItemID& aItemID ) = 0; + + /** + * Setting UIOnOff mode in template4 of the coverflow. + * The API should be in template 4 to hide or show counter as per UI ON/OFF mode. + * + * @param aUIOn true if UIOn mode and counter to be displayed, else false for UIOff. + * @param aTransition transition time to show or hide counter. + + * Examples: + * @code + * Set UiOnOff mode in coverflow widget. + * + * mCoverFlowWidget->SetUIOnOFF( true, 100 ); + * + * @endcode + **/ + virtual void SetUIMode(bool aUIOn = false, int aTransition = 0 ) = 0; + + /** + * Rotate the highlight image + * The API is supported in template 4(fullscreen templet) to rotate the highlight image as per the + * direction specified in the param. + * This will rotate the image 90 degree on left or right side. + * + * @param aDirection, Direction of the rotation (ERotateLeft/ERotateRight). + * @param aImageSize, The actual size of the current highlighted image. + * @param aTransition transition time to rotate the image. + + * Examples: + * @code + * Rotate the highlight image of the coverflow widget. + * + * mCoverFlowWidget->RotateImage( IMulWidget::ERotateLeft,TSize(500,400),100 ); + * + * @endcode + **/ + virtual void RotateImage(TMulRotation aDirection ,TSize aImageSize,int aAnimationTime) = 0; + + /** + * Returns the gesture helper used in coverflow. + * This API is required for sharing the gesture helper between the widget and application. + * The ownership of the gesture helper lies with the widget. + * + * @return CGestureHelper Instance of gesture helper created by the widget. + + * Examples: + * @code + * Query the gesture helper and use it in application + * + * CGestureHelper* gestureInstance = mCoverFlowWidget->Gesturehelper(); + * gestureInstance->addObserver(*this); + * + * @endcode + **/ + virtual GestureHelper::CGestureHelper* Gesturehelper() = 0; + + + /** + * Virtual destructor. + **/ + virtual ~IMulCoverFlowWidget() + { + } + }; + + } // namespace Alf + +#endif // I_MULCOVERFLOWWIDGET_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_coverflowwidget_api/mul_coverflowwidget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_coverflowwidget_api/mul_coverflowwidget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +mul coverflowwidget api +API for MulCoverFlowWidget +c++ +mulcoverflowwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: data model API +* +*/ + + + +#include +PRJ_PLATFORMS + +ARMV5 WINSCW +PRJ_EXPORTS + +../inc/mul/imulmodelbase.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulmodelbase.h) +../inc/mul/imulmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulmodel.h) +../inc/mul/imulmodelprovider.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulmodelprovider.h) +../inc/mul/imulvarianttype.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulvarianttype.h) +../inc/mul/mulvisualitem.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulvisualitem.h) +../inc/mul/mulvarianttype.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulvarianttype.h) +../inc/mul/muldatapath.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/muldatapath.h) +../inc/mul/mulutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulutility.h) +../inc/mul/mulkeyboardutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulkeyboardutility.h) +../inc/mul/mulmodelutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulmodelutility.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2007-2008 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: Interface for model +* +*/ + + +#ifndef I_MULMODEL_H +#define I_MULMODEL_H + +//Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + +namespace mulmodel + { + static const IfId Ident= + { + 0, "mulmodel" + }; + + static const char* const KBaseElementName = "base" ; + static const char* const KItemElementName = "item" ; + } + +// Forward Declarations +class MulVisualItem; +class MulDataPath; +class IMulModelProvider; + +/*! @class IMulModel +* +* @brief An interface for the data model. +* +* Client that creates the model own the model. +* Client can use this interface to update data model. +* +*/ +class IMulModel : public IMulModelBase, public IAlfModel + { + +public: + + /** + * Getter for the type identifier of this interface. + * + * @return A descriptor to identify the type of this interface. + */ + static inline const IfId& type() + { + return mulmodel::Ident; + } + + /** + * Virtual destructor. + */ + virtual ~IMulModel() {} + + /** + * Informs the data model that new items have been added to client's + * internal model. Data model is expected to sync its indices as a + * result. + * Note: This API will never give an exception. + * + * @param aIndex Position where items were inserted. + * @param aCount Number of items inserted. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + */ + virtual void Insert( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ) = 0 ; + + /** + * Informs the data model that items have been removed from the client's. + * internal data model. Data model is expected to sync its indices as a + * result. + * Note: This API will never give an exception. + * + * @param aIndex Position from where items have to be removed. + * @param aCount Number of items to be removed.\ + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + */ + virtual void Remove( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * Informs the data model that an item has been updated in the client's + * internal model. Data model will use to input to determine whether + * a visualization change is required. If yes, the model will request the + * provider for updated data. + * Note: This API will never give an exception. + * + * @param aIndex Position from where items have to be updated. + * @param aCount Number of items to be updated. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + */ + virtual void Update( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * A refresh data request. Informs that the data model has to be + * repopulated with mentioned number of items. So the data model + * will remove all the existing data and issue request to the + * provider for new data. + * Note: This API will never give an exception. + * + * @param aCount Number of items to be repopulated. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + */ + virtual void Refresh( int aCount, const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * Provide data for the specified item. This is a unified API for + * adding & updating data. + * + * @param aIndex Position of item to be updated. + * @param aVisualItem Collection of attributes. Ownership is transfered. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + * @throw Invalid Argument, in case index is out of bound or visual + * item is NULL. + * @throw Logic Error, in case item could not be updated. + */ + virtual void SetData( int aIndex, std::auto_ptr aVisualItem, + const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * Get the data for item at the specified index. + * + * @param aIndex Position of item in the data model. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + * @return A constant reference to the data at the given index. + * @throw Invalid Argument, in case index is out of bound. + */ + virtual const MulVisualItem* Data( int aIndex, + const MulDataPath& aPath = MulDataPath() ) const = 0; + + /** + * Get the count of items in the model. + * + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + * @return Count of items in the model. + */ + virtual int Count( const MulDataPath& aPath = MulDataPath() ) const = 0; + + /** + * Set the data provider for the model. + * Note: This API will be removed in future. + * Clients would be able to specify the provider to the model at + * the time of the construction. + * + * @param aDataProvider Handle to the data provider. + * @throw Logic Error, in case same accessor object is passed again. + */ + virtual void SetDataProvider( const IMulModelProvider& aDataProvider ) = 0; + + /** + * Set the default logical template id for widget elements. + * Logical templates map to visualization of the element(s). + * + * @param aTemplateId Logical template id for the widget elements. + */ + virtual void SetTemplate( mulwidget::TLogicalTemplate aDefaultTemplate ) = 0; + + /** + * Set the logical template id for a specific widget element. + * Logical templates map to visualization of the element. + * + * @param aItemIndex Unique id of item of which template needs to be applied. + * @param aTemplateId Logical template id for the widget element. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + * @throw Invalid Argument, in case index is out of bound. + */ + virtual void SetTemplate( int aItemIndex, mulwidget::TLogicalTemplate aDefaultTemplate , + const MulDataPath& aPath = MulDataPath() )=0; + + /** + * Set the data window/cache size of the Data model. + * This API can be used to over-ride the data window size of the data model + * already set by the widget. This can be used by clients to set the buffer + * size different from what the widget has specified. + * + * @param aSize Size of buffer. + * @throw Invalid Argument, incase the buffer size is negative. + */ + virtual void SetDataWindow( int aSize ) = 0; + + /** + * Get the buffer size defined for the data model. + * + * @return Size of data window. + */ + virtual int DataWindow( ) const = 0; + + /** + * Set highlighted item in the model. + * + * @param aItemIndex Index of item. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + * + * Examples: + * @code + * Set index of the item to be highlighted. + * + * mListWidget->SetHighlight(highlight); + * @endcode + */ + virtual void SetHighlight( int aItemIndex, const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * Get the index of the current highlighted item from the model. + * + * @return Highlighted item index. + * + * Examples: + * @code + * Get index of the highlighted item. + * + * int highlight = mListWidget->Highlight(); + * @endcode + */ + virtual int Highlight() = 0; + + /** + * Get the index of the current highlighted item along with the path + * of the root item in the data hierarchy. + * + * @param aPath Path of parent item in the data hierarchy. Out parameter. + * @return Highlighted item index. + * + * Examples: + * @code + * Get index of the highlighted item. + * + * int highlight = mListWidget->Highlight(); + * @endcode + */ + virtual int Highlight( MulDataPath& aPath ) = 0; + + /** + * Function for setting the item(s) Marked or Unmarked. For mark and + * unmark operations, indices of items should be provided. + * + * @param aType Type of marking operation to be performed. + * @param aItemsIndex Indices of the items to be changed + * @throw Invalid Argument, if type is specified as mark-all and unmark-all. + * + * Examples: + * @code + * Mark the selected item + * + * mListWidget->SetMarkedIndices( MulWidgetDef::EMulMark, itemIndex ); + * @endcode + */ + virtual void SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType , + const std::vector& aItemsIndex, + const MulDataPath& aPath = MulDataPath() ) = 0; + + /** + * Function for setting the item(s) Marked or Unmarked. + * For mark all and unmark all operations use this overloaded version. + * + * @param aType Type of marking operation to be performed. + * @throw Invalid Argument, if type is specified as mark and unmark. + * + * Examples: + * @code + * Mark all items + * + * mListWidget->SetSelection( MulWidgetDef::EMulMarkAll ); + * @endcode + */ + virtual void SetMarkedIndices( + MulWidgetDef::TMulWidgetMarkingType aType = MulWidgetDef::EMulMarkAll + ) = 0; + + /** + * Gets the indices of the currently marked items. + * + * @return Array of maked indices. This would return an empty container if no items are marked. + * + * Examples: + * @code + * Get the array of all marked items + * + * std::vector markedItems = mListWidget->MarkIndices(); + * @endcode + */ + virtual const std::vector& MarkedIndices( const MulDataPath& aPath = MulDataPath() ) = 0; + + }; + + } // namespace Alf + +#endif // I_MULMODEL_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelaccessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelaccessor.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2007-2008 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: Interface for model accessor + * +*/ + + +#ifndef I_MULMODELACCESSOR_H +#define I_MULMODELACCESSOR_H + +//Includes +#include +#include +#include + +#include + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + + /* Forward declarations*/ + class MulVisualItem; + class IMulModelObserver; + + /** + * An interface for accessing data model. Widgets use this interface to interact with Model. + * Data model implements this interface. + * @lib + */ + class IMulModelAccessor : public IAlfModel + { + public: + + /** + * The function to set a particular item as highlighted. + * + * @param aIndex Index of the item to be highlighted. + * @throws Invalid_argument Throws this exception if index is not a valid index. + */ + virtual void SetHighlight( int aItemIndex ) = 0; + + /** + * Scroll Window to mention item index + * it will check that data window needs to be updated or not + * and if required it update data window + * + * @aItemIndex item index + * @throws invaid_argument exception + */ + virtual void ScrollWindow( int aItemIndex ) = 0; + + /** + * Function to get the highlighted item index. + * + * @return Index of the highlighted index. + */ + virtual int Highlight() = 0; + + /** + * Function to get the count of items currently present in the model. + * This includes hidden items. + * + * @return Count of items existing in the model. + */ + virtual int CurrentItemCount() = 0; + + /** + * Set visible data window for model. + * + * @param aVisibleWindow No of visuals that widget can display at a time on screen. + */ + virtual void SetVisibleWindow( int aWindowSize, int aPageTopIndex = -1 ) = 0; + + /** + * Returns relative index from absolute index. + * + * @param aAbsoluteIndex Abosulte index + * @return Returns relative index from absolute index. + */ + virtual int RelativeIndex( int aAbsoluteIndex ) const = 0; + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + virtual int TopWindowOffset() const= 0; + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + virtual int BottomWindowOffset() const = 0; + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + virtual int TopOffset() const= 0; + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + virtual int BottomOffset() const = 0; + + /** + * Return rear buffer top offset + * + * @return Current window top offset + */ + virtual int RearTopOffset() const = 0; + + /** + * Return rear buffer bottom offset + * + * @return Current window top offset + */ + virtual int RearBottomOffset() const = 0; + + /** + * Check weather item at specified index is marked or not. + * + * @param aIndex Absolute index of item + * @return true if seleccted else otherwise + */ + virtual bool IsItemMarked( int aIndex ) = 0; + + /** + * Function for setting the item Marked or Unmarked. For mark and + * unmark operations, index of item should be provided. + * + * @param aType Type of marking operation to be performed. + * @param aItemsIndex Indices of the items to be changed + * @throw Invalid Argument, if type is specified as mark-all and unmark-all. + */ + virtual void SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ) = 0; + + /** + * Returns the visual item at the specified absolute index + * + * @param aIndex Absolute index of item + */ + virtual const MulVisualItem& Item( int aAbsoluteIndex ) = 0; + + /** + * Returns Absolute index from relative index + * + * @param aRelativeIndex Relative index + * @return Absolute index + */ + virtual int AbsoluteIndex( int aRelativeIndex ) = 0; + + /** + * Return whather currently looping is on or not + * + * @return true if looping is on false otherwise + */ + virtual bool IsLoopingOn() = 0; + + /** + * Add model state change observer. + * + * @param aObserver Observer- ownserhip is not transferred + */ + virtual void AddModelObserver( IMulModelObserver* aObserver ) = 0; + + /** + * Eemove model state change observer. + * + * @param aObserver Observer- ownserhip is not transferred + */ + virtual void RemoveModelObserver( IMulModelObserver* aObserver )= 0; + + /** + * Return default template + * + * @return Default template + */ + virtual mulwidget::TLogicalTemplate Template( ) = 0; + + }; + + + } // namespace Alf + +#endif // I_MULMODELACCESSOR_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelbase.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007-2008 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: Interface for model base +* +*/ + + +#ifndef I_MULMODELBASE_H +#define I_MULMODELBASE_H + +//Includes + +namespace Alf + { + // Forward Declaration + class IMulModelAccessor; + + + /*! @class IMulModelBase + * @brief An interface for common data model's base class. + * + * Client can query Accessor() interface from this class + * and can set Accessor to Multi-item Widgets. + * + * Note: There has been a change in the way multi-item widget accesses + * the data model (for other widgets continue to set the model to the widget in the same way). + * The widget gets a restrictive access to the data model via IMulModelAccessor + * interface. The new way of assigning model to the widget is shown in the + * example given below. The client applications can't access the IMulModelAccessor + * interface anymore as its not export from now on. + * + */ + class IMulModelBase + { + public: + + /** + * Return pointer of accessor interface. + * This pointer is required to call SetModel Api IMulWidget. + * Ownership of Accessor is not transferred. + * + * @return IMulModelAccessor Accessor interface. + * Examples: + * @code + * Create the data model using widget factory and assign it to a widget. + * + * mWidgetModel = widgetFactory.createModel (KLoadNameModel); + * + * Set the default visualization for the list items. If the visualization is not + * specified there will be a panic when the model is assigned to the widget. + * + * mWidgetModel->SetTemplate( UString ( mulwidget::KTemplate6)); + * + * Setting the data model to the widget. + * + * AddItems(10); + * mListWidget->SetModel( mWidgetModel); + * @endcode + */ + virtual IMulModelAccessor* Accessor() = 0 ; + + }; //End of class + + } // namespace Alf + +#endif // I_MULMODELBASE_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulmodelprovider.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 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: Interface for requesting data from the provider +* +*/ + + +#ifndef I_MULMODELPROVIDER_H +#define I_MULMODELPROVIDER_H + +namespace Alf + { + +// Forward Declarations +class MulVisualItem; +class MulDataPath; + +/*! @class IMulModelProvider + * @brief An interface for requesting the data provider for data. + * + * Application should implement this interface inorder to become a data provider. + * Data model uses this interface to ask the application for data. + * + */ +class IMulModelProvider + { +public: + + /** + * Request the data provider for updating data in the model. + * + * @param aIndex Index at which the item request has been initiated. + * @param aCount Number of items requested. + * @param aPath Path of parent item in the data hierarchy. + */ + virtual void ProvideData( int aIndex, int aCount, MulDataPath aPath ) = 0; + + }; + + +} // namespace Alf + +#endif // I_MULMODELPROVIDER_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulsingleitemmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulsingleitemmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007-2008 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: Interface for single item model + * +*/ + + +#ifndef IMULSINGLEITEMMODEL_H_ +#define IMULSINGLEITEMMODEL_H_ + +// Includes +#include + +namespace osncore + { +// Forward Declarations +class UString; + } +using namespace osncore; + +namespace Alf + { + +// Forward Declarations +class MulVisualItem; + +namespace mulsingleitemmodel + { + static const int KLastIndex = -1; + static const int KNumberOfIndices = 4; + + static const char* const KBaseElementName = "base"; + + static const char* const KInvalidVisualItem = "NULL Visual Item passed"; + static const char* const KIndexOutOfBound = "Index out of bound"; + static const char* const KLogicError = "Logic error"; + }// namespace mulsingleitemmodel + +class IMulSingleItemModel : public IAlfModel + { + +public: + + /** + * Adds an item into the specified container at the given index. + * + * @param aItem Item to be added. Takes ownership. + * @param aContainerName Name of the container. + * @param aIndex Index of the item in the container. By default appends item. + * @throw Invalid Argument, incase visual item is NULL or out of bound index. + */ + virtual void AddData(MulVisualItem* aItem, const UString& aContainerName, + int aIndex = mulsingleitemmodel::KLastIndex) = 0; + + /** + * Update an item within the specified container at the given index. + * + * @param aItem Item to be updated. Takes ownership. + * @param aContainerName Name of the container. + * @param aIndex Index of the item in the container. + * @throw Invalid Argument, incase visual item is NULL, invalid container or out of bound index. + * Logic Error, cannot add data because of invalid internal structure + */ + virtual void UpdateData(MulVisualItem& aItem, const UString& aContainerName, int aIndex) = 0; + + /** + * Removes an item from the specified container at the given index. + * + * @param aContainerName Name of the container. + * @param aIndex Index of the item in the container. + * @throw Invalid Argument, incase of invalid container or out of bound index. + */ + virtual void RemoveData(const UString& aContainer, int aIndex) = 0; + + /** + * Returns an item from the specified container at the given index. + * + * @param aContainerName Name of the container. + * @param aIndex Index of the item in the container. + * @return Reference to the item. + * @throw Invalid Argument, incase of invalid container or out of bound index. + */ + virtual MulVisualItem& Data(const UString& aContainerName, int aIndex) = 0; + + /** + * Returns number of items in the specified container. + * + * @param aContainerName Name of the container. + * @return Number of items + * @throw Invalid Argument, incase of invalid container. + */ + virtual int Count(const UString& aContainerName) = 0; + + /** + * Virtual destructor. + */ + virtual ~IMulSingleItemModel() {} + + };// class IMulSingleItemModel + + }// namespace Alf +#endif // IMULSINGLEITEMMODEL_H_ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/imulvarianttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/imulvarianttype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2007-2008 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: Interface for generic data type +* +*/ + + +#ifndef I_MULVARIANTTYPE_H +#define I_MULVARIANTTYPE_H + +#include +//#include +#include + +// Forward Declarations + +namespace Alf + { + +// Forward Declarations + class IAlfMap; + +/*! @class IMulVariantType + * @brief Interface for mul model data type + * + * Application should implement this interface if application needs + * to provide custom data type to model. + * + */ +class IMulVariantType + { +public: + + enum TMulType{ EUnknown ,EBool, EInt, EUint, EReal, EDes, EMap, ECustomData }; + + /** + * Create copy of variant type + * + * @return Copy of variant type and ownsership is transferred + */ + virtual std::auto_ptr< IMulVariantType > Clone() = 0; + + /** + * Get data as symbian descriptior + * + * @return Descriptor data value. + */ + virtual const TDesC& DesC() const = 0 ; + + /** + * Type of data + * + * @return Data type of Variant Data + */ + virtual TMulType Type() const = 0 ; + + /** + * Destructor + */ + virtual ~IMulVariantType() + { + } + + /** + * Get the data value as an bool . + * + * @exception osncore:AlfDataException Thrown if type() is not EBool. + * @return bool data value. + */ + virtual bool boolean() const = 0; + + /** + * Get the data value as an integer. + * + * @exception osncore:AlfDataException Thrown if type() is not EInt. + * @return Integer data value. + */ + virtual int integer() const = 0; + + /** + * Get the data value as an unsigned integer. + * + * @exception osncore:AlfDataException Thrown if type() is not EUInt. + * @return Unsigned integer data value. + */ + virtual uint uinteger() const = 0; + + /** + * Get the data value as a real number. + * + * @exception osncore:AlfDataException Thrown if type() is not EReal. + * @return Real data value. + */ + virtual double real() const = 0; + + /** + * Get the data value as a map interface. + * + * @exception osncore:AlfDataException Thrown if type() is not EMap. + * @return Map interface. + * @since S60 ?S60_version + */ + virtual IAlfMap& Map() const = 0 ; + + }; + + } // namespace Alf + +#endif // I_MULVARIANTTYPE_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/muldatapath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/muldatapath.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2007-2008 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: Header for MulDataPath +* +*/ + + +#ifndef MULDATAPATH_H +#define MULDATAPATH_H + +#include +#include + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + +//Forward Declaration +class MulDataPathImpl; //store data for MulDataPath class +/** + * @class MulDataPath + * + * MulDataPath represent hierarchy in data model. + * It stores index of node for each depth. + */ +class MulDataPath + { +public: + /** + * Default constructor + * + * By default path will point to root node. + */ + OSN_IMPORT MulDataPath(); + + /** + * Constrctor will create path with depth 1 and store specified index + * at depth1 + * + * @param aIndexForDepth1 Index of node at depth 1 + */ + OSN_IMPORT MulDataPath( int aIndexForDepth1 ); + + /** + * Constrctor will create path with depth 2 and store specified index + * at depth 1 and depth 2 + * + * @param aIndexForDepth1 Index of node at depth 1 + * @param aIndexForDepth2 Index of node at depth 2 + */ + OSN_IMPORT MulDataPath( int aIndexForDepth1, int aIndexForDepth2); + + /** + * Copy constructor + * + * @param aPath Existing path object + */ + OSN_IMPORT MulDataPath(const MulDataPath& aPath); + + /** + * Destructor + */ + OSN_IMPORT ~MulDataPath(); + + /** + * Create new depth and add specified index at created depth. + * + * @param aIndex position of node at current depth + */ + OSN_IMPORT void Append(int aIndex); + + /** + * Depth of path + * + * @return Depth + */ + OSN_IMPORT int Depth() const; + + /** + * Return position/index of node at given depth + * + * @param aDepth Depth of path + * @return Position/index of node + */ + OSN_IMPORT int operator[]( int aDepth ) const; + + /** + * Comparisition operator for Path. + * Comapre that path is less that other path or not + * + * @param aPath path to wich current path need to be compared + * @return true - if is less ,false otherwise + */ + bool operator<( MulDataPath& aPath); + + /** + * return position in current depth. For internal use only + * + * @param position in current depth + */ + int Index() const; + + /** + * Set internal position in current depth + * + * @param aIndex position in current depth + */ + void SetIndex( int aIndex ); + + /** + * Check whather both path are equal or not, + * + * + * @param aPath Path object to compare with + * @return true is equals, false other wise + */ + bool operator== ( const MulDataPath& aPath); + + /** + * Check whather both path are equal or not,For internal use only + * + * @param aPath Path object to compare with + * @return true is equals, false other wise + */ + bool IsEqual( const MulDataPath& aPath ); + + + /** + * Assignment operator + * + * @param aPath Existing path + */ + void operator= ( MulDataPath aPath ); + + +private: //data + + std::auto_ptr mData; //own + }; + + } //namespace Alf + +#endif //MULDATAPATH_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/mulkeyboardutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/mulkeyboardutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for keyboard handling + * +*/ + + +#ifndef MULKEYBOARDUTILITY_H_ +#define MULKEYBOARDUTILITY_H_ + +#include +#include +#include +#include +#include +#include // KAknQwertyInputModeActive +#include + + class CQwertySubscriber : public CActive + { + public: + CQwertySubscriber(TCallBack aCallBack, RProperty& aProperty); + ~CQwertySubscriber(); + + public: // New functions + + void SubscribeL(); + void StopSubscribe(); + + private: // from CActive + + void RunL(); + void DoCancel(); + + private: + TCallBack iCallBack; + RProperty& iProperty; + }; + +class CKeyBoardUtility: public CCoeStatic +{ + public: + static CKeyBoardUtility* NewL(); + private: + static TInt QwertyModeChangeNotification(TAny* aObj); + private: + ~CKeyBoardUtility(); + CKeyBoardUtility(); + bool bQwerty; + /** Qwerty Notification */ + CQwertySubscriber* iQwertyModeStatusSubscriber; + RProperty iQwertyModeStatusProperty; + void HandleQwertyModeChangeNotification(); + public: + bool IsQwerty(); +}; +#endif //MULKEYBOARDUTILITY_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/mulmodelutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/mulmodelutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for data model +* +*/ + + +#ifndef MULMODELUTILITY_H_ +#define MULMODELUTILITY_H_ + +#include +#include +#include +#include + +#include "mul/imulwidget.h" + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + +//Forward Declaration +class MulVisualItem; +class MulModelUtility + { +public: + + /** + * Create new Variant data from existing variant data. + * + * @param aValue Existing variant data; + * + * @reutrn new variant data, Ownership is transferred + */ + OSN_IMPORT static IAlfVariantType* CreateVariantType( IAlfVariantType& aValue ); + + /** + * Convert map of visual item to map of alf map. + * Ite create new Map and while returning new map owner ship of map is transfered + * + * @param aVisualItem Map of visual item + * @return Map + */ + OSN_IMPORT static std::auto_ptr ConvertVisualItemToMap( MulVisualItem& aVisualItem ); + + /** + * + * Convert AlfMap to visual item + * + * @param aMap IAlfMAP + * @return MulVisualItem ownership is trsnaferred + */ + OSN_IMPORT static std::auto_ptr ConvertMapToVisualItem( IAlfMap& aMap ); + + /** + * Check the prefix of the name to see whether they can be added in alfmodel + * + * @param aName Name whose prefix is to be checked + */ + static bool CheckNamePrefix( UString aName ) ; + + /** + * Convert UString to CAlfString + * + * @param aUString UString instance to convert to CAlfSTring + + * @return Converted CAlfString + */ + OSN_IMPORT static UString UStringToAlfString(const UString& aUString); + + /** + * Convsert CAlfString to UString + * + * @param aUString CAlfSTring instance to convert to UString + + * @return Converted UString + */ + OSN_IMPORT static UString AlfStringToUString(const UString& aAlfString); + + /** + * Covert integer to AlfString + * + * @param aNumber number to convert + * @return AlfString + */ + OSN_IMPORT static UString IntToUString( int aNumber ); + + /** + * Convert TDes to UString + * + * @param aDes a TDes type string to be converted + * @param aString the converted Ustring + */ + OSN_IMPORT static void ConvertTDesToUString (const TDesC& aDes, UString& aString); + + /** + * Convert TDes8 to UString + * + * @param aDes a TDes8 type string to be converted + * @param aString the converted Ustring + */ + OSN_IMPORT static void ConvertTDes8ToUString (const TDesC8& aDes, UString& aString); + + /** + * Convert UString to TDes + * + * @param aString a UString type string to be converted + * @param aDes the TDes type converted string + */ + OSN_IMPORT static void ConvertUStringToTDes (const UString& aString, TDes& aDes); + + /** + * Convert UString to TDes8 + * + * @param aString a UString type string to be converted + * @param aDes the TDes8 type converted string + */ + OSN_IMPORT static void ConvertUStringToTDes8 (const UString& aString, TDes8& aDes); + + /** + * Create a visualitem and set its default template + * + * @param aDefaultTemplate defaultTemplate for that visual item + */ + OSN_IMPORT static std::auto_ptr CreateVisualItem( mulwidget::TLogicalTemplate aDefaultTemplate ); + + + }; + + } //namespace Alf + +#endif /*MULMODELUTILITY_H_*/ + +//End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/mulutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/mulutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007-2008 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: Implementation for utility class +* +*/ + + +#ifndef MULUTILITY_H_ +#define MULUTILITY_H_ + +#include +#include +#include +#include +#include "mulkeyboardutility.h" + +namespace osncore + { + class UString; + } + +using namespace osncore; + +namespace Alf + { + +static void MUL_ASSERT(bool aExpression, const char* aExceptionString) + { + if( aExpression ) + { + throw std::logic_error(aExceptionString); + } + } + +class MulUtility + { +public: + /** + * Converts the relative path to the absolute path. + * + * @param aRelativePath Which needs to be changed to the absolutepath. + * @return true , if aRelativepath changed to Absoulte path or else false + */ + OSN_IMPORT static bool AbsolutePath(UString& aRelativePath); + + /** + * Checks which orienatation the application is in and returns true if it is in + * Landscape orientation otherwise returns false + * + */ + OSN_IMPORT static bool IsLandscape(); + + /** + * Checks if the given string tag is a pool resource or not + * + * @param aImageTag Path of the image file,which needs to be checked for resource tag format. + */ + OSN_IMPORT static bool IsPoolResource(const UString& aImageTag); + + /** + * Checks if current KeyBoard is QWERTY + * @return true if KeyBoard is QWERTY else false. + */ + OSN_IMPORT static bool IsQwerty(); + +private: + /** + * Checks the file for its existence + * + * @param afilePath File to be checked. + * @return true, In case file exists or else false. + */ + static bool IsFileExists(/*const char* afilePath*/const TDesC& aFilePath); + + + + }; + + } // namespace Alf + +#endif // MULUTILITY_H_ + +// End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/mulvarianttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/mulvarianttype.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2007-2008 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: MulVarianttype implementation +* +*/ + +#ifndef MULVARIANTTYPE_H +#define MULVARIANTTYPE_H + +#include +#include + +#include + +namespace Alf + { +// Forward Declarations + +/*! @class MulVariantType + * @brief To create data for data model + */ +class MulVariantType : public IMulVariantType + { +public: //Constructor and Destructor + + /** + * The default constructor. + */ + OSN_IMPORT MulVariantType(); + + /** + * Constructor for Descriptor + * + * @param aDes Descriptor + * @return new Object + */ + OSN_IMPORT MulVariantType( const TDesC& aDes ); + + /** + * Constructor for variant data type creation for a integer type of data + * @param aValue - integer to be assigned for the variant data + * @return New object. + */ + OSN_IMPORT MulVariantType(const int& aValue); + + /** + * Constructor for variant data type creation for a Unsigned integer type of data + * @param aValue - unsigned integer to be assigned for the variant data + * @return New object. + */ + OSN_IMPORT MulVariantType(const uint& aValue); + + /** + * Constructor for variant data type creation for a real type of data + * @param aValue - Real value to be assigned for the variant data + * @return New object. + */ + OSN_IMPORT MulVariantType(const double& aValue); + + /** + * Constructor for variant data type creation for a bool type of data + * @param aValue - Boolean value to be assigned for the variant data + * @return New object. + */ + OSN_IMPORT MulVariantType(const bool& aValue); + + /** + * Constructor for variant data type creation for a Alf Variant type of data + * @param aData -the variant data + * @return New object. + */ + OSN_IMPORT MulVariantType( IAlfMap& aData ); + + /** + * Destructor + */ + OSN_IMPORT ~MulVariantType(); + +public: // From IMulVariantType + + OSN_IMPORT std::auto_ptr< IMulVariantType > Clone(); + + OSN_IMPORT const TDesC& DesC() const; + + OSN_IMPORT TMulType Type() const; + + OSN_IMPORT bool boolean() const ; + + OSN_IMPORT int integer() const ; + + OSN_IMPORT uint uinteger() const ; + + OSN_IMPORT double real() const ; + + OSN_IMPORT IAlfMap& Map() const ; + +private: + + void Construct( TMulType aType ); + +private: + + class MulVariantTypeImpl; + +private: + + std::auto_ptr mVarData; + + }; + + } // namespace Alf + +#endif //I_MULVARIANTTYPE_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/inc/mul/mulvisualitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/inc/mul/mulvisualitem.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2007-2008 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: Visual Item class + * +*/ + + +#ifndef MULVISUALITEM_H +#define MULVISUALITEM_H + +#include +#include +#include +#include +#include +#include +#include + +namespace osncore + { + class UString; + } +using namespace osncore; +using namespace std; + + +namespace Alf + { + + +//enum mulvisualitem +namespace mulvisualitem + { + + enum TVisualAttribute + { + KMulIcon1 = 0, + KMulIcon2 , + KMulIcon3 , + KMulTitle , + KMulTitle1 , + KMulTitle2 , + KMulDetail , + KMulDate , + KMulIndicator1 , + KMulIndicator2 , + KMulIndicator3 , + KMulIndicator4 , + KMulIndicator5, + KMulIndicator6, + KMulActionItem , + KMulEnabled , + KMulSoftkeyTitle , + KMulLatch , + KMulRead , + KMulInputText, + KMulEmptyItem , + KVisualItemProperties, + KVisualItemAttributes , + KAttributeTemplate, + KMulMaxRange, + KMulMinRange, + KMulTick, + KMulPrimaryTick, + KMulSecondaryTick, + KMulLeftText, + KMulRightText, + KMulCounter1, + KMulCounter2, + KMulImage, + KMulPercent1, + KMulPercent2, + KMul_n, + KLastAttribute = 100 // reserved 0 to 100 + }; + + }//namespace mulvisualitem + +/* Forward declarations*/ +class IAlfMap; +class IAlfContainer; +class IMulVariantType; +/** +/*! @class MulVisualItem + * @brief Client need to use this class to add data in data model. + * + * Visual item is set of attributes corresponding to an item in the widget. + * The attributes added to visual item get visualized on the widget + * + */ +class MulVisualItem + { +private: + + class MulAttribute; + +public: + + /** + * Flags for attribute + */ + enum TAttributeFlags + { + EDisposable = 0x01 // attribute with this flag on can be deleted from item is it is out of visible window + }; + + enum TAttributeOwnership + { + EDoesOwn = 0, //attribute is owned by model + EDoesNotOwn //attribute is not owned by model + }; + +public: //Constructor and Dstructor + + /** + * C++ constructor. + */ + OSN_IMPORT MulVisualItem(); + + /** + * C++ constructor. + */ + OSN_IMPORT MulVisualItem( const MulVisualItem& aVisualData ); + + /** + * Destructor. + */ + OSN_IMPORT ~MulVisualItem(); + +public: // New mehtod + + /** + * Add new attribute to visual item + * + * @param aName name of attribute + * @param aValue value of attribute + * @param aAttributeFlags property of this attribute + */ + //OSN_IMPORT void SetAttribute( mulvisualitem::TVisualAttribute aName, const UString& aValue,int aAttributeFlags = 0 ); + + /** + * Add new attribute to visual item + * + * @param aName name of attribute + * @param aValue value of attribute + * @param aAttributeFlags property of this attribute + */ + OSN_IMPORT void SetAttribute( mulvisualitem::TVisualAttribute aName, int aValue,int aAttributeFlags = 0 ); + + /** + * Add new attribute to visual item + * + * @param aName name of attribute + * @param aValue value of attribute + * @param aAttributeFlags property of this attribute + */ + OSN_IMPORT void SetAttribute( mulvisualitem::TVisualAttribute aName, const TDesC& aValue ,int aAttributeFlags = 0 ); + + /** + * Add new attribute to visual item + * + * @param aName name of attribute + * @param aValue value of attribute + * @param aAttributeFlags property of this attribute + * @param aAttributeOwership If the value is EDoesOwn then the ownership + * of the attribute transfered to the visual item else not. + */ + OSN_IMPORT void SetAttribute( mulvisualitem::TVisualAttribute aName, IMulVariantType* aValue, + int aAttributeFlags = 0,TAttributeOwnership aAttributeOwership = EDoesOwn ); + + /** + * Return Value of specified attribute + * + * @param aName name of attribute need to retrived + * @return Value of attribute + */ + OSN_IMPORT IMulVariantType* Attribute( mulvisualitem::TVisualAttribute aName ) const; + + /** + * Return Value of specified attribute as integer + * + * @param aName name of attribute need to retrived + * @return Value of attribute + */ + OSN_IMPORT int AttributeAsInt( mulvisualitem::TVisualAttribute aName ) const; + + /** + * Return Value of specified attribute as String + * + * @param aName name of attribute need to retrived + * @return Value of attribute + */ + OSN_IMPORT const TDesC& AttributeAsString( mulvisualitem::TVisualAttribute aName ) const; + + /** + * Return the existing attributes of the visual item + * @return Vector of the names of the existing attributes + */ + OSN_IMPORT const std::vector Attributes() const; + + + /** + * Return the bool value if attribute is dirty(updated and not redrawn) + * @return bool Value of attribute dirty status + */ + OSN_IMPORT bool IsDirty( mulvisualitem::TVisualAttribute aAttr ) const; + + + /** + * Return the flag of the attributes + * @param aName name of attribute need to retrived + * @return Value of flag of the attribute + */ + int Flag( mulvisualitem::TVisualAttribute aName ); + + /** + * Remove attribute from visual item - required by garbage collector + * + * @param aName Attribute name to be removed + */ + void RemoveAttribute( mulvisualitem::TVisualAttribute aName ); + + /** + * Sets the dirty flag for a Visual attribute + * @param aDirty sets dirty flag to true/false + * @return void + */ + void SetDirty(mulvisualitem::TVisualAttribute aAttr, bool aDirty); + + + /** + * Resets the dirty flag for a Visual attribute from input Visual item + * @param const MulVisualItem& Visual item with input dirty flags + * @return void + */ + void ResetDirtyAttribute(const MulVisualItem& aVisualItem); + + +private: + + std::map< mulvisualitem::TVisualAttribute, MulAttribute* > mVisualItem; + // Attribute flags - indicates which attributes are dirty(need redrawing) + // Using 2 attributes to store 36 attributes (refer TVisualAttribute) + unsigned int mBitAttrFlag1; // stores dirty bits of first 18 attributes + unsigned int mBitAttrFlag2; // stores dirty bits of second 18 attributes + }; + + } // namespace Alf + +#endif //MULVISUALITEM_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_datamodel_api/mul_datamodel_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_datamodel_api/mul_datamodel_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +mul datamodel api +DataModel API +c++ +muldatamodel + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_sliderwidget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_sliderwidget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: Slider widget API +* +*/ + +#include +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../inc/mul/imulsliderwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulsliderwidget.h) +../inc/mul/imulslidermodel.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulslidermodel.h) +../inc/mul/mulsliderproductids.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulsliderproductids.h) diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_sliderwidget_api/inc/mul/imulslidermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_sliderwidget_api/inc/mul/imulslidermodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2007 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: Model interface with utilities for slider widget. +* +*/ + + +#ifndef I_MULSLIDERMODEL_H +#define I_MULSLIDERMODEL_H + + +//WidgetModel Includes +#include +#include +//#include + +using namespace osncore; + +namespace Alf + { + +enum sliderTemplate + { + ESliderTemplate1, + ESliderTemplate2, + ESliderTemplate3, + ESliderTemplate4, + ESliderTemplate5, + ESliderTemplate6, + ESliderTemplate7, + ESliderTemplate8, + ESliderTemplate9, + ESliderTemplateNone + }; +namespace mulslidermodel + { + static const IfId ident = + { + 0, "mulslidermodel" + }; + } + +/** + * An interface of the slider model. + */ +class IMulSliderModel : public IAlfModel + { + +public: + + /** + * Getter for the type identifier of this interface. + * + * @return A descriptor to identify the type of this interface. + */ + static inline const IfId& type() + { + return mulslidermodel::ident; + } + + /** + * Change slider related attributes within the model. + * + * @param aSliderItem Slider data to be changed. + * + */ + virtual void SetData(const MulVisualItem& aSliderItem) = 0; + + /** + * Return a collection of all the slider attributes. + * + * @return A visual item containing the slider attributes. + */ + virtual const MulVisualItem& Data() const = 0; + + /** + * Set the value of the primary thumb. + * + * @param aValue Position of the primary thumb. + * + */ + virtual void SetPrimaryValue(int aValue) = 0; + + /** + * Return the value of the primary thumb of the slider. + * + * @return Value of the primary thumb. + * + */ + virtual int PrimaryValue() const = 0; + + /** + * Set the value of the secondary thumb. + * + * @param aValue Position of the secondary thumb. + * + */ + virtual void SetSecondaryValue(int aValue) = 0; + + /** + * Return the value of the secondary thumb of the slider. + * + * @return Value of the secondary thumb. + * + */ + virtual int SecondaryValue() const = 0; + + /** + * Return the total number of ticks. + * + * @return Number of ticks (int) + * + */ + virtual int TotalTicks() const = 0; + + + /** + * Set Template that will be used to represent data. + * + * @param aTemplateId Template associated with the widget. + * + */ + + virtual void SetTemplate( sliderTemplate aTemplateId) = 0; + /** + * Get Template that will be used to represent data. + * + * @param aTemplateId Template associated with the widget. + * + */ + virtual sliderTemplate GetTemplate() = 0; + /** + * API to set text on the right side of Slider. + * + * @param aRightText - Text that has to be Displayed. + * + */ + + virtual void SetRightText(char* aRightText) = 0; + /** + * API to Get text on the right side of Slider. + * + */ + + virtual const char* GetRightText() = 0; + /** + * API to set text on the Left side of Slider. + * + * @param aLeftText - Text that has to be Displayed. + * + */ + + virtual void SetLeftText(char* aLeftText) = 0; + /** + * API to Get text on the Left side of Slider. + * + */ + virtual const char* GetLeftText() = 0; + /** + * API to set the Percentage of Slider movement on Track. + * + * @param aPercText - Text that has to be Displayed. + * + */ + virtual void SetPercentText(char* aPercText) = 0; + /** + * API to indicate the percentage movement of Thumb on Track. + * + */ + virtual const char* GetPercentText() = 0; + /** + * API to set the Minimum value of Track. + * + * @param aMinRange - Minimum value for the start of the track. + * + */ + virtual void SetMinRange(int aMinRange) = 0; + /** + * API to retrieve the Minimum value of Track. + * + */ + virtual int MinRange()const = 0; + /** + * API to set the Maximum value of Track. + * + * @param aMaxRange - Maximum value for the start of the track. + * + */ + virtual void SetMaxRange(int aMaxRange) = 0; + /** + * API to retrieve the Maximum value of Track. + * + */ + + virtual int MaxRange()const = 0; + /** + * API to set Tick value for Slider. + * + * @param aTick - Interger value for representing the tick. + * + */ + virtual void SetTick(int aTick) = 0; + /** + * API to retrieve the tick value. + * + */ + virtual int Tick()const = 0; + }; + + } // namespace Alf + +#endif // I_MULSLIDERMODEL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_sliderwidget_api/inc/mul/imulsliderwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_sliderwidget_api/inc/mul/imulsliderwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for slider widget. +* +*/ + +#ifndef I_MUL_SLIDERWIDGET_H +#define I_MUL_SLIDERWIDGET_H + +//WidgetModel includes +#include +#include +#include +#include +#include +#include +#include +//osn includes +#include +#include + +namespace Alf + { +namespace mulsliderwidget + { + /** + * @namespace mulsliderwidget + * + * ident specifies the unique identifier for the grid widget. + */ + static const IfId ident = + { + 0, "mulsliderwidget" + }; + static const Utf8* const KBaseElementName = "BaseElement"; + } + + + +/** + * The data which can be used as last (optional) paramenter of + * IAlfWidgetFactory::createWidget function while creating the slider widget + * imperatively. If this data is not passed, default values are used + * to create visualization. + * + */ +class MulSliderInitData : public AlfCustomInitDataBase + { +public: + /** + * mBaseElementLoadId visualization base element is created + * using Load ID. + */ + const char* mBaseElementLoadId; + + /* mBaseElementData pointed to baseElement custom data + * All baseelement related data are in this class + */ + + AlfCustomInitDataBase *mBaseElementData; + }; + + +/** + * Interface for the slider widget. + * + * + * Default visualization of slider contains following components. + *
    + *
  • Handle (The position of the handle shows the current tick position)
  • + *
  • Track (Place holder for Handle)
  • + *
+ * + * + * A slider widget is used along with photos,coverflow and list widget. + *
    + *
  • template 1 is used i.e. in 2D coverflow as a navigational component. + * + *
  • template 3 is used i.e. in Photos as a pop-up zoom slider. + * + *
  • template 7 is used i.e. in Video Centre list view as a progressive + * downloading track counter/progress bar. + * There is no potrait version of this template. + * + *
+ * The communication between slider and the widgets happens by means of an + * event ETypePrimaryValueChange from slider and in response widgets directly + * update slider's model. + * Slider handles both Key and Pointer Events. + * + * KeyEvents : EStdKeyRightArrow,EStdKeyLeftArrow,EEventKeyDown,EEventKeyUp. + * PointerEvents : EButton1Down,EDrag. + * + * + */ +class IMulSliderWidget: public IAlfWidget + { +public: + /** + * Get the type of widget. + * + * @return The type of widget + */ + static const IfId& type() + { + return mulsliderwidget::ident; + } + + /** + * Gets the Base Element Name. + * + * @return The base element's name + */ + static inline const char* baseElementName() + { + return mulsliderwidget::KBaseElementName; + } + /** + * Get the model for widget. + * + * @return model of the slider widget + */ + virtual IMulSliderModel& SliderModel() = 0; + + /** + * Set the transparency for the background of the slider widget. + * + * @param True, to set background as transparent + * @param False, to set background as opaque + */ + virtual void MakeTransparent( bool aTransparent ) = 0; + + /** + * Enable/Disable key handling . + * + * @param aVal: True, to handle keyevents by Application + * False, to handle keyevents as defined in the control + */ + virtual void SetHandleKeyEvent( bool aVal ) = 0; + /** + * Hide or Show widget . + * + * @param aShow: True, Shows the widget + * False, Hides the widget + * @param aTransitionTime: Transition time to show/Hide. + */ + virtual void ShowWidget(bool aShow, int aTransitionTime =0) = 0; + /** + * Returns the state of the Widget(Hide/show). + * + */ + virtual bool IsHidden() = 0; + + /** + * Returns the container layout. + * + */ + virtual const CAlfLayout& ContainerLayout() = 0; + /** + * Add an observer to widget inorder to get event notifications + * from the widget. Widget can have multiple observersers. + * + * @param aObserver Observer of widget. + **/ + virtual void AddEventHandler( IAlfWidgetEventHandler& aObserver) = 0; + /** + * Remove an observer to widget + * + * @param aObserver Observer of widget. + */ + virtual void RemoveEventHandler( IAlfWidgetEventHandler& aObserver) = 0; + /** + * Destructor. + */ + virtual ~IMulSliderWidget() {} + + }; + + } // namespace Alf + +#endif // I_MUL_SLIDERWIDGET_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_sliderwidget_api/inc/mul/mulsliderproductids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_sliderwidget_api/inc/mul/mulsliderproductids.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for slider widget. +* +*/ + +#ifndef MUL_SLIDERPRODUCTIDS_H +#define MUL_SLIDERPRODUCTIDS_H + +static const char* const KSliderWidget = "mulsliderwidget"; +static const char* const KSliderModel = "mulslidermodel"; +static const char* const KSliderVerticalElement = + "sliderverticalelement"; +static const char* const KSliderHorizontalElement = + "sliderhorizontalelement"; +static const char* const KSliderProgressbarElement = + "sliderprogressbarelement"; +#endif // MUL_SLIDERPRODUCTIDS_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_sliderwidget_api/mul_sliderwidget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_sliderwidget_api/mul_sliderwidget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +mul sliderwidget api +API for MulSliderWidget +c++ +mulsliderwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: widget API +* +*/ + + + +#include + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../inc/mul/imulwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulwidget.h) +../inc/mul/imulwidgetdef.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulwidgetdef.h) +../inc/mul/imulmultiitemwidget.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/imulmultiitemwidget.h) +../inc/mul/mulevent.h MW_LAYER_PLATFORM_EXPORT_PATH(mul/mulevent.h) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/inc/mul/imulmultiitemwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/inc/mul/imulmultiitemwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2007 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: The base class for Multimedia multi-item widgets. + * +*/ + + +#ifndef I_MULMULTIITEMWIDGET_H +#define I_MULMULTIITEMWIDGET_H + +// Includes +#include + +// Namespaces used +using namespace osncore; + +namespace Alf + { + + // Forward declaration + class IMulModelAccessor; + + namespace mulmultiitemwidget + { + static const IfId Ident= + { + 0, "mulmultiitemwidget" + }; + } + + /*! @class IMulMultiItemWidget + * @brief An interface for all Multimedia multi-item widgets. + */ + class IMulMultiItemWidget : public IMulWidget + { + public: + + /*! @enum TMulWidgetPropertiesFlag + * This enumeration defines some properties for the widgets. These can + * be enabled or disabled for individual widget instances. + */ + enum TMulWidgetPropertiesFlag + { + EMulWidgetFlagFastScroll = 0x0001, /*!< Enable fast scroll.*/ + EMulWidgetFlagCyclic = 0x0002, /*!< Enable cyclic/looping effect on widget.*/ + EMulWidgetFlagNaviScroll = 0x0004, /*!< Enable navi scroll support.*/ + EMulWidgetFlagCenterFocus = 0x0008, /*!Examples: + * @code + * Set the flag for selection. + * + * mListWidget->SetFlags( IMulMultiItemWidget::EMulWidgetFlagMultiSelect ); + * @endcode + */ + virtual void SetFlags(unsigned int aAnyFlag) = 0; + + /** + * Clear a property or a group of properties. Properties not specified are not changed. + * + * @param aAnyFlag Property flag(s) to be cleared. To clear more than one property, + * the flags can be ORed. + * @throw Invalid argument, if unknown/undefined flag is passed. + * @throw Invalid argument, if the property is not supported by the widget. + * + * Examples: + * @code + * Clear the flag for selection. + * + * mListWidget->ClearFlags( IMulMultiItemWidget::EMulWidgetFlagMultiSelect ); + * @endcode + */ + virtual void ClearFlags(unsigned int aAnyFlag) = 0; + + /** + * Return the status of all the flags. The flags that are set have the + * corresponding bit ON. + * + * @return All enabled flag(s). The corresponding bit for enabled flag(s) are set to 1. + * + * Examples: + * @code + * Get all flags status. + * + * int allFlags = mListWidget->GetFlags(); + * @endcode + */ + virtual unsigned int GetFlags() const = 0; + + /** + * Returns the property state, whether flag is on or off for widget. + * + * @param aAnyFlag Flag to be cross-checked + * @return True if set, False if not set + * + * Examples: + * @code + * Check if the cyclic flag is set + * + * if( mListWidget->IsFlagSet( IMulMultiItemWidget::EMulWidgetFlagCyclic ) ) + * { + * ... + * } + * @endcode + */ + virtual bool IsFlagSet(TMulWidgetPropertiesFlag aAnyFlag) const = 0; + + /** + * Provide an empty text for the widget. This text is shown if there is no + * data to be displayed in the widget. Widget makes a copy of the variable + * and it is safe to call it many times. + * + * @param aDefaultText Text to be displayed in empty widget + * + * Examples: + * @code + * Set the empty text to "No Images" + * + * mListWidget->SetEmptyText( UString("No Images") ); + * @endcode + */ + virtual void SetEmptyText( const UString& aDefaultText ) = 0; + + /** + * Set the data model for this widget. Widget uses the data model via + * IMulModelBase interface because it needs to know only limited functionality + * about the data model. + * + * @param aModel Model to be set for widget. + * @param aOwnership Flag which conveys the widget whether it should take + * the ownersip of the model or not. + * @throw Logic error, if same accessor object passed again. + * + * Examples: + * @code + * Create the data model using widget factory and assign it to a widget. + * + * mWidgetModel = widgetFactory.createModel (KLoadNameModel); + * + * Set the default visualization for the list items. If the visualization is not + * specified there will be a panic when the model is assigned to the widget. + * + * mWidgetModel->SetTemplate( UString ( mulwidget::KTemplate6)); + * + * Setting the data model to the widget. + * + * AddItems(10); + * mListWidget->SetModel( mWidgetModel); + * @endcode + */ + // virtual void SetModel(IMulModelBase* aModel, bool aOwnership) = 0; + + /** + * Set the state of the mark mode. + * + * @param aFlag True means mode is On, False means mode is Off. + * + * Examples: + * @code + * Switch on the mark mode. + * + * mListWidget->SetMarkMode(true); + * @endcode + */ + virtual void SetMarkMode(bool aFlag) = 0; + + /** + * Returns the state of the mark mode. + * + * @return Status of the mark mode. + * + * Examples: + * @code + * Check if the mark mode is On. + * + * if( mListWidget->IsMarkMode() ) + * { + * ... + * } + * @endcode + */ + virtual bool IsMarkMode()const = 0; + + /** + * Set the state of the reorder mode. + * + * @param aFlag EReorderShiftOn : Switch on reorder mode in type shift. + * EReorderSwapOn : Switch on reorder mode in type swap. + * EReorderDone : Switch Off the reorder with operatoin done + * EReorderCancel : Switch off the reorder mode with cancel last operation. + * + * Examples: + * @code + * Switch on the reorder mode. + * + * mListWidget->SetReorderMode(IMulMultiItemWidget::EReorderShiftOn); + * @endcode + */ + virtual void SetReorderMode(IMulMultiItemWidget::TMulReOrderMode aReorderMode ) = 0; + + + /** + * Returns whether reorder mode on/off. + * + * @return Reorder Mode On/Off Status. + * + * Examples: + * @code + * Check if the reorder mode is On. + * + * if( mListWidget->IsReorderModeOn() ) + * { + * ... + * } + * @endcode + */ + virtual bool IsReorderModeOn()const = 0 ; + + + /** + * During fast scroll mode, the widget displays an overlay with more info. + * Setter API for the overlay strip. + * + * @param aType Attribute data type + * @param aAttribute Attribute whose value will be shown in the overlay + * @param aFormat Format string for formatting the value of the attribute + * + * Examples: + * @code + * Set the overlay to display (Month, Year) as more info. + * + * mListWidget->SetOverlay( IMulMultiItemWidget::EDate, + * UString(mulvisualitem::KMulDetail), + * UString("") ); + * @endcode + */ + virtual void SetOverlay(TMulAttributeDataType aType, const UString& aAttribute, const UString& aFormat) = 0 ; + + /** + * Sets the default image of the widget. + * This image will be shown when the actual image data is not available + * + * @param aTextureId texture id to be used for default image. + * + * Examples: + * @code + * Set default image in coverflow widget. + * + * mCoverFlowWidget->SetDefaultImage( 1000 ); + * + * @endcode + */ + virtual void SetDefaultImage(int aTextureId) = 0; + + /** + * Virtual destructor. + */ + virtual ~IMulMultiItemWidget() + { + } + + }; + + } // namespace Alf + +#endif // I_MULMULTIITEMWIDGET_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/inc/mul/imulwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/inc/mul/imulwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2007 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: The base class for all Multimedia widgets. + * +*/ + + +#ifndef I_MULWIDGET_H +#define I_MULWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace osncore; + +// Include widget observer + +namespace Alf + { + class IMulModelAccessor; + + namespace mulwidget + { + static const IfId Ident= + { + 0, "mulwidget" + }; + + enum TLogicalTemplate + { + KTemplateUnknown = 0, + KTemplate1 , + KTemplate2, + KTemplate3, + KTemplate4, + KTemplate5, + KTemplate6, + KTemplate7, + KTemplate8, + KTemplate9, + KTemplate10, + KTemplate11, + KTemplate12, + KTemplate13, + KTemplate14 + }; + /* + static const char* const KTemplate1 = "logical_template_1"; + static const char* const KTemplate2 = "logical_template_2"; + static const char* const KTemplate3 = "logical_template_3"; + static const char* const KTemplate4 = "logical_template_4"; + static const char* const KTemplate5 = "logical_template_5"; + static const char* const KTemplate6 = "logical_template_6"; + static const char* const KTemplate7 = "logical_template_7"; + static const char* const KTemplate8 = "logical_template_8"; + static const char* const KTemplate9 = "logical_template_9"; + static const char* const KTemplate10 = "logical_template_10"; + static const char* const KTemplate11 = "logical_template_11"; + static const char* const KTemplate12 = "logical_template_12"; + static const char* const KTemplate13 = "logical_template_13"; + static const char* const KTemplate14 = "logical_template_14"; + */ + } + + /** + * An interface for all Multimedia widgets. + * Widgets consist of control and visualization elements. + * Model owned by the application. + * + * Interface paradigm would be used in a restrictive way. + * Controls are owned by Alfred environment. + * Widgets can be constructed using the widget factory. + * Widgets are owned and accessed using the Alfred + * environment. + */ + class IMulWidget : public IAlfWidget // base class + { + public: + + /*! @enum TMulVisualEffect + * This enumeration defines Visual effect that widget support + * + */ + enum TMulVisualEffect + { + EHighlightTransition = 1 /*!< Highlight transition effect.*/ + }; + + enum TMulVisualType + { + ETextVisual = 1, /*!< Color of the text in the widgets.*/ + ECoverflowCounterVisual, /*!< Color of the Counter text in the Coverflow Widget.*/ + EItemBackgroundBrush, /*!< Color of the Item brush in the Widget.*/ + EThumbnailBackgroundBrush /*!< Color for the background of the thumbnail image. Currently used in list widget only.*/ + }; + + /*! @enum TMulRotation + * This enumeration defines Rotation effect that widget supports + * + */ + enum TMulRotation + { + ERotateLeft = 1, /*!< For left rotation*/ + ERotateRight /*!< For right rotation*/ + }; + + /** + * Getter for the type identifier of this interface. + * + * @return A descriptor to identify the type of this interface. + **/ + static inline const IfId& Type() + { + return mulwidget::Ident; + } + + /** + * Set the data model for this widget. Widget uses the data model via + * IMulModelAccessor interface. Does not take ownership of the accessor + * and there can be only one accessor to the widget at any point. This + * will remove the binding to previous accessor, if any. Before + * deleting the accessor application should remove the binding to + * widget by calling the api by passing NULL. + * + * @param aAccessor model to be set for widget + */ + virtual void SetModel(IMulModelAccessor* aAccessor , bool aFlag = true) = 0; + + /** + * Set the size and position of the widget.All parameter values are in pixels and are relevant + * to the parent of the widget. + * + * @param aLeftMargin margin for the left border (top left x co-ordinate value) + * @param aTopmargin margin for the top border (top left y co-ordinate value) + * @param aHeight height of widget + * @param aWidth width of widget + * @param aTransitionTime Transition Time in MilliSeconds + */ + virtual void SetRect(int aLeftMargin, int aTopmargin, int aHeight, + int aWidth, int aTransitionTime =0) = 0; + + /** + * To hide and unhide Widget. + * + * @param aShow value to hide/unhide the Widget + * @param aTransitionTime Transition Time in MilliSeconds + */ + virtual void ShowWidget(bool aShow, int aTransitionTime =0) = 0; + + /** + * Get the icon size from the template + * + * @param atemplateId Logical Template Id + * @param aAttribute Attribute name of the Icon + * @param aHeight Height of the Icon + * @param aWidth Width of the Icon + */ + virtual void GetIconSize( mulwidget::TLogicalTemplate aTemplateId, + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) = 0; + + /** + * Get the icon size from the template + * + * @param aAttribute Attribute name of the Icon + * @param aHeight Height of the Icon + * @param aWidth Width of the Icon + */ + virtual void GetIconSize( + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) = 0; + + + /** + * Add an observer to widget inorder to get event notifications + * from the widget. Widget can have multiple observersers. + * + * @param aObserver Observer of widget. + **/ + virtual void AddEventHandler( IAlfWidgetEventHandler& aObserver) = 0; + + /** + * Remove an observer to widget + * + * @param aObserver Observer of widget. + */ + virtual void RemoveEventHandler( IAlfWidgetEventHandler& aObserver) = 0; + + /** + * Get the Container Layout for widget. + * + * @return Container layout of the widget. This can be used to set the position of widget. + */ + virtual const CAlfLayout& ContainerLayout() = 0; + + + /** + * Set Transaction/Animation time for variaous visual effect. + * + * @param aVisualEffect Visual effect to which animation time/transation time to set + * @param aTransitionTime Transition Time in MilliSeconds + * + * Examples: + * @code + * Set the animation time. + * + * mListWidget->SetAnimationTime( TMulVisualEffect::EHighlightTransition, 1000 ); + * @endcode + */ + virtual void SetAnimationTime( TMulVisualEffect aVisualEffect, int aTransitionTime = 0 ) = 0; + + /** + * Set the color and opacity of the visual for various visuals as per the widget. + * Also used to set the background transparent. + * + * @param aVisualType visual to which color is to be applied. + * @param aColor RGB color + * + * NOTE: TRgb with the alpha is mandatory .,if application doesnt sets the alpha results in the 0-opacity-Transparent. + * so applications always should use TRgb with alpha constructor: like- TRgb(TUint32 color,TInt alpha); + * + * Examples: To Set the color and opacity of the thumbnail background + * @code + * Set the color and alpha of the visual.0x008090 and 0 respectively. + * + * iMyWidget->SetVisualColor( TMulVisualColor::EThumbnailBackgroundColor, TRgb(0x008090,0) ); + * Here 0(zero) implies opacity - 1. + * @endcode + * + * Examples: To make the background Transparent + * @code + * Set the color and alpha of the visual.0x008090 and 255 respectively. + * + * iMyWidget->SetVisualColor( TMulVisualColor::EThumbnailBackgroundColor, TRgb(0x008090,255) ); + * Here 255 alpha implies Transparent Background.No matter what the color is. + * @endcode + * + */ + virtual void SetVisualColor( TMulVisualType aVisualType , const TRgb& aColor ) = 0; + + + /** + * + Virtual destructor. + **/ + virtual ~IMulWidget() + { + } + + }; + + } // namespace Alf + +#endif // I_MULWIDGET_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/inc/mul/imulwidgetdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/inc/mul/imulwidgetdef.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2007-2008 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: Widget definations +* +*/ + + +#ifndef I_MULWIDGETDEF_H_ +#define I_MULWIDGETDEF_H_ + +namespace Alf + { + +class MulWidgetDef + { + +public: //enum + /** Marking enums */ + enum TMulWidgetMarkingType + { + EMulMark=1, + EMulUnmark, + EMulMarkAll, + EMulUnmarkAll + }; + + }; + + }// namespace Alf + +#endif // I_MULWIDGETDEF_H_ \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/inc/mul/mulevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/inc/mul/mulevent.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2006 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: Event class. +* +*/ + + +#ifndef T_MULEVENT_H +#define T_MULEVENT_H + +namespace Alf +{ + enum TMulEventType + { + ETypeHighlight= 200, /*!< A message regarding an item getting highlighted. + * Data for the event will be the highlighted index(int).*/ + ETypeSelect, /*!< a message regarding an item getting selected. + * Data for the event will be the selected index(int).*/ + ETypeDoubleTap, /*!< a message regarding an item getting double tapped. + * Data for the event will be the selected index(int).*/ + ETypeMark, /*!< a message regarding start/stop of marking. + * Data for the event will be marking state(TMulMarkState).*/ + ETypeFastScroll, /*!< a message regarding start/stop of fast scrolling + * Data for the event will be fast scrolling state(TMulFastScrollState).*/ + ETypePrimaryValueChange, /*!< a message regarding slider primary value getting changed + * Data for the event will be previous & current value + * encapsulated within TMulSliderPos.*/ + ETypeSecondaryValueChange, /*!< a message regarding slider secondary value getting changed + * Data for the event will be previous & current value + * encapsulated within TMulSliderPos.*/ + ETypeAction, /*!< a message regarding an action item being selected + * Data for the action event will be encapsulated within TMulActionItem.*/ + + ETypeRemove, /*!< a message regarding an item has to be removed. + * Data for the event will be the highlighted index(int).*/ + + ECustomEventMarqueeFinished, /*!< A message regarding marquee Finished. + * no custom data required.*/ + + ECustomEventMarqueeStart, /*!< A message regarding marquee started. + * no custom data required.*/ + + ECustomEventIconClick, /*!< A message regarding clicking on icon. + * no custom data required.*/ + + EMulEventReorder, /*!< Data for the event will be previous and current index + * encapsulated within MulReorderValues .*/ + + EMulEventSwap, /*!< Data for the event will be previous and current index + * encapsulated within MulReorderValues .*/ + + EMulEditorUpdated, /*!< A message regarding plain text editor of an item is changed. + * Data for the event will be the item index(int).*/ + + ECustomHighlightClearTransition, /*!< A message regarding transition after clear focus and before set focus finished. + * no custom data required.*/ + + ECustomHighlightFocusTransition, /*!< A message regarding transition after set focus finished. + *no custom data required.*/ + + ETypeItemMarked, /*!< a message regarding an item getting marked. + * Data for the event will be the marked index(int).*/ + + ETypeItemUnmarked, /*!< a message regarding an item getting unmarked. + * Data for the event will be the unmarked index(int).*/ + + ECustomEventTitleMarqueeFinished, /*!< A message regarding title marquee Finished. + * no custom data required.*/ + + ECustomEventDetailMarqueeStart, /*!< A message regarding detail marquee started. + * no custom data required.*/ + + ECustomEventContinuousScroll, /*!< A message regarding Continuous Scrolling. + * Data for the event is the View Start Position.*/ + + ESliderDrag, /*!< A message regarding Slider starting the drag + */ + + EVideoIconSelect, /*!< A message regarding there was tap on the video icon of the Coverflow widget full screen template. + * no custom data required.*/ + + ECustomEventVisiblePageIndexChanged, /*!< a message regarding change of visible page + * Data for the event will be the first index of the new visible page.*/ + + ETypeSwitchUiStateOnDrag, /*!< a message to switch off the ui when drag starts. + * no custom data required. This event is specific to coverflow widget*/ + + ECustomEventIconRelease, /*!< A message regarding release on icon. + * no custom data required. */ + + ETypePinch, /*!< A message regarding a multitouch pinch gesture identified in coverflow */ + + ETypeItemRemoved /*!< A message regarding a remove operation completed. Requested by photos for refreshing + the HDMI view when an item is deleted, No custom data */ + }; + + + /*! @enum TMulMarkState + * Marking state of the widget. + */ + enum TMulMarkState + { + EMarkStart, /*!< A state which indicates that the marking has started.*/ + EMarkStop /*!< A state which indicates that the marking has stopped.*/ + }; + + /*! @enum TMulFastScrollState + * Fast Scroll State of the widget. + */ + enum TMulFastScrollState + { + EScrollStart, /*!< A state which indicates that the fast scrolling has started.*/ + EScrollSmallIcon, /*!< A state which indicates that the fast scrolling is using + * the smaller size of the thumbnails.*/ + EScrollLargeIcon, /*!< A state which indicates that the fast scrolling is using + * the larger size of the thumbnails.*/ + EScrollStop /*!< A state which indicates that the fast scrolling has stopped.*/ + }; + + /*! @struct TMulSliderPos + * The structure holds the data change details of the slider. It stores both the previous + * value and current value of the slider thumb. + */ + struct MulSliderPos + { + /* @var Original value of the slider thumb.*/ + int mPreviousValue; + + /* @var New value of the slider thumb.*/ + int mCurrentValue; + }; + + struct MulReorderValues + { + /* @var old value of the item index.*/ + int mOldIndex; + + /* @var New value of the item index */ + int mNewIndex; + }; + + struct MulDoubleTapData + { + TPoint mDoubleTapPoint; + TInt mTapVisualIndex; + MulDoubleTapData() { + mDoubleTapPoint.SetXY(0,0); + mTapVisualIndex = -1 ; + } + }; // end of structure + + +}//namespacealf +#endif // T_MULEVENT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/inc/mul/muluiaccelinc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/inc/mul/muluiaccelinc.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006 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: UIAccelerator Include File. +* +*/ + + +#ifndef MULUIACCELINC_H +#define MULUIACCELINC_H + +#include "../../../../../../../antriksh/group/stdinc.mmh" + +#endif // MULUIACCELINC_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/mul_widget_api/mul_widget_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/mul_widget_api/mul_widget_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ + + +mul widget api +API for mulwidget +c++ +mulwidget + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_container_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_container_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: ALF widget factory API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/osn/alfptrvector.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/alfptrvector.h) +../inc/osn/alfptrvectorimpl.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/alfptrvectorimpl.h) \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_container_api/inc/osn/alfptrvector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_container_api/inc/osn/alfptrvector.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2007 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: vector implementation + * +*/ + + +#ifndef ALF_PTRVECTOR_H +#define ALF_PTRVECTOR_H + + +#include +#include + +namespace osncore +{ + +/** +* @deprecated Use STL vector +* @class AlfPtrVector alfptrvector.h "osn/alfptrvector.h" +* Template class for a pointer vector +* +* @lib osncore.lib +* @since S60 5.0 +* @status Draft +* @interfaces AlfPtrVector +*/ +template +class AlfPtrVector: public IDeleter + { +public: + /** + * @deprecated Use STL vector + * Default constructor for vector. + * By default contents are automatically deleted + * when destructor is called. + * + * @since S60 5.0 + */ + AlfPtrVector() : mImpl(*this),mDelItem(true) {} + + /** + * @deprecated Use STL vector + * Constructor for vector with some default size. + * Size can be increased or decreased afterwards. + * + * @since S60 5.0 + * @param aSize Default size of vector. + */ + explicit AlfPtrVector(uint aSize) : mImpl(aSize,*this),mDelItem(true) {} + + /** + * @deprecated Use STL vector + * Destructor. + */ + ~AlfPtrVector() { if (mDelItem) { mImpl.clear(mDelItem); } } + + /** + * @deprecated Use STL vector + * Returns the value of auto delete property. + * + * @since S60 5.0 + * @return true or false. + */ + bool autoDelete() { return mDelItem; } + + /** + * @deprecated Use STL vector + * Sets the auto delete property of vector. + * + * @since S60 5.0 + * @param aAutoDelete Value(true/false) of the property.Default value is true. + */ + void setAutoDelete(bool aAutoDelete=true) { mDelItem = aAutoDelete; } + + /** + * Deletes all items of vector. + * + * @since S60 5.0 + */ + void clear() { mImpl.clear(mDelItem); } + + /** + * @deprecated Use STL vector + * Checks if there are some items in vector. + * + * @since S60 5.0 + * @return true or false. + */ + bool isEmpty() const { return mImpl.isEmpty(); } + + /** + * @deprecated Use STL vector + * Returns number of items in vector. + * + * @since S60 5.0 + * @return number of items in vector. + */ + uint count() const { return mImpl.count(); } + + /** + * @deprecated Use STL vector + * Returns the size in bytes occupied by vector. + * + * @since S60 5.0 + * @return number of bytes used by vector. + */ + uint size() const { return mImpl.size(); } + + /** + * @deprecated Use STL vector + * Removes the item from vector at given position. + * Item will be automatically deleted if auto delete + * property is set to true. + * + * @since S60 5.0 + * @param aPos Position of the item to be removed. + * @return true/false to indicate if item has been removed. + */ + bool remove(uint aPos) { return mImpl.remove(aPos, mDelItem); } + + /** + * @deprecated Use STL vector + * Resizes the vector to new size. Existing items in + * the vector will be restored if auto delete property is false. + * + * @since S60 5.0 + * @param aSize New size in bytes. + * @return true/false to indicate if item has been resized. + */ + bool resize(uint aSize) { return mImpl.resize(aSize, mDelItem); } + + /** + * @deprecated Use STL vector + * Inserts a new item at given position in the vector. + * + * @since S60 5.0 + * @param aPos Position at which item has to be inserted. + * @param aItem Pointer to the item to be inserted. + * @return true/false to indicate if the item has been inserted. + */ + bool insert(uint aPos, T *aItem) { return mImpl.insert(aPos, aItem, mDelItem); } + + /** + * @deprecated Use STL vector + * Returns pointer to the item at given position in the vector. + * + * @since S60 5.0 + * @param aPos Position from which item is queried. + * @return Pointer to the item. + */ + T *at(int aPos) const {return (T *)mImpl.at(aPos); } + + /** + * @deprecated Use STL vector + * Returns pointer to the raw data used by vector to stroe the items. + * + * @since S60 5.0 + * @return Pointer to data. + */ + T **data() {return (T **)mImpl.data(); } + + /** + * @deprecated Use STL vector + * Returns the position of the item in the vector. + * + * @since S60 5.0 + * @param aItem Pointer to the item being searched in the vector. + * @return Position of item in the vector.-1 is returned if item is not found. + */ + int findRef(T *aItem){return mImpl.findRef(aItem);} + + /** + * @deprecated Use STL vector + * Returns the item at given index in the vector. + * + * @since S60 5.0 + * @param aPos Position from which item has been queried. + * @return Pointer to the item at given position. + */ + T* operator[](uint aPos) const { return (T *)mImpl.at(aPos); } + +private: + void deleteItem(void* aItem) + { + delete (T*) aItem; + } + AlfPtrVector(const AlfPtrVector&); + AlfPtrVector& operator=(const AlfPtrVector&); +private: + /** + * Owned body + */ + AlfPtrVectorImpl mImpl; + /** + * Auto delete + */ + bool mDelItem; + + }; + +} +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_container_api/inc/osn/alfptrvectorimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_container_api/inc/osn/alfptrvectorimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007 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: vector implementation + * +*/ + + + +#ifndef ALFPTRVECTORIMPL_H +#define ALFPTRVECTORIMPL_H + +#include +#include + +namespace osncore +{ + +class IDeleter + { +private: + friend class AlfPtrVectorImpl; + virtual void deleteItem(void* aItem)=0; + }; + + +/** + * @deprecated Use STL vector + * @class AlfPtrVectorImpl alfptrvectorimpl.h "osn/alfptrvectorimpl.h" + * Implementation class for AlfPtrVector + * + * @lib osncore.lib + * @since S60 5.0 + * @status Draft + */ +class AlfPtrVectorImpl + { +public: // constructors / destructor + + /** + * @deprecated Use STL vector + * Constructor + * + * @since S60 5.0 + * @param aDeleter + */ + OSN_IMPORT AlfPtrVectorImpl( IDeleter& aDeleter ); + + /** + * @deprecated Use STL vector + * Constructor + * + * @since S60 5.0 + * @param aSize + * @param aDeleter + */ + OSN_IMPORT AlfPtrVectorImpl(uint aSize, IDeleter& aDeleter); + + /** + * @deprecated Use STL vector + * Destructor + */ + OSN_IMPORT ~AlfPtrVectorImpl(); + + /** + * @deprecated Use STL vector + * Clears the vector + * + * @since S60 5.0 + * @param aDelItems determines whether the items are deleted + */ + OSN_IMPORT void clear(bool aDelItems); + + /** + * @deprecated Use STL vector + * Removes an item from the vector + * + * @since S60 5.0 + * @param aCount the item to be deleted + * @param aDelItems determines whether the item is deleted + * @return true/false to indicate if item has been removed. + */ + OSN_IMPORT bool remove(uint aCount, bool aDelItems); + + /** + * @deprecated Use STL vector + * Resizes the vector to new size. Existing items in + * the vector will be restored if auto delete property is false. + * + * @since S60 5.0 + * @param aSize New size in bytes. + * @param aDelItems determines whether the items are deleted + * @return true/false to indicate if item has been resized. + */ + OSN_IMPORT bool resize(uint aSize, bool aDelItems); + + /** + * @deprecated Use STL vector + * Inserts a new item at given position in the vector. + * + * @since S60 5.0 + * @param aCount Position at which item has to be inserted. + * @param aItem Pointer to the item to be inserted. + * @param aDelItems determines whether the item is deleted, not used! + * @return true/false to indicate if the item has been inserted. + */ + OSN_IMPORT bool insert(uint aCount, void *aItem, bool aDelItems); + + /** + * @deprecated Use STL vector + * Returns the position of the item in the vector. + * + * @since S60 5.0 + * @param aItem Pointer to the item being searched in the vector. + * @return Position of item in the vector.-1 is returned if item is not found. + */ + OSN_IMPORT int findRef(void *aItem); + +public: // inliners + bool isEmpty() const { return mcount == 0; } + uint count() const { return mcount; } + uint size() const { return msize; } + void* at(uint aCount) const { return mdata[aCount]; } + void** data() { return mdata; } + + +private: + AlfPtrVectorImpl& operator=(const AlfPtrVectorImpl&); + + void** mdata; + uint msize; + uint mcount; + IDeleter& mDeleter; + }; + +} // namespace core +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_container_api/osn_container_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_container_api/osn_container_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +osn container api +Osn Container Classes API +c++ +osncore + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: OSN common API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/osn/osncommon.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/osncommon.h) +../inc/osn/osndefines.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/osndefines.h) +../inc/osn/osnnew.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/osnnew.h) +../inc/osn/osntypes.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/osntypes.h) +../inc/osn/osntypes.inl MW_LAYER_PLATFORM_EXPORT_PATH(osn/osntypes.inl) \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/inc/osn/osncommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/inc/osn/osncommon.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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: Most basic macro definitions + * +*/ + + + +#ifndef OSNCOMMON_H +#define OSNCOMMON_H + +#include +#include + +#ifndef __GNUC__ +#include +#endif +#endif // OSNDEFINES_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/inc/osn/osndefines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/inc/osn/osndefines.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 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: Most basic macro definitions + * +*/ + + + +#ifndef OSNDEFINES_H +#define OSNDEFINES_H + + + +/** + * Defines Keyword that can be used to check if OSN is in use + */ +#define __OSN__ + +#if defined(__VC32__) +#define OSN_IMPORT __declspec(dllexport) +#define OSN_EXPORT __declspec(dllexport) +#endif + +#if defined(__CW32__) +#define OSN_IMPORT __declspec(dllexport) +#define OSN_EXPORT __declspec(dllexport) +#define OSN_NONSHARABLE_CLASS(x) class x +#endif + +#if defined(__GNUC__) +#define OSN_IMPORT +#define OSN_EXPORT +#define EXPORT_C +#define IMPORT_C +#endif + +#if defined(__GCC32__) || defined(__GCCE__) +#define OSN_IMPORT +#if !defined(__WINS__) && defined(_WIN32) // VC++ Browser Fix +#define OSN_EXPORT +#else +#define OSN_EXPORT __declspec(dllexport) +#endif +#elif defined (__ARMCC_VERSION) // ARM RCVT +#define OSN_IMPORT __declspec(dllimport) +#define OSN_EXPORT __declspec(dllexport) +#define OSN_NONSHARABLE_CLASS(x) class __declspec(notshared) x +#endif + + +#endif // OSNDEFINES_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/inc/osn/osnnew.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/inc/osn/osnnew.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 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: operator new overloads + * +*/ + + + +#ifndef OSNNEW_H +#define OSNNEW_H + +#ifdef __GNUC__ +#include +#endif +#include + +#ifndef __GNUC__ +namespace std + { + class bad_alloc; + } +#endif +enum newarg {EMM}; + +typedef unsigned int size_t; + +/** + * Overloaded operator new. + * + * @since S60 5.0 + * @param s size of the allocation + * @return void* pointer to allocated object. + */ +OSN_IMPORT void* operator new(size_t s,newarg) throw (std::bad_alloc); + +/** + * Overloaded operator delete. + * + * @since S60 5.0 + * @param ptr pointer to the object to be deleted + */ +OSN_IMPORT void operator delete(void* ptr,newarg)throw(); + +/** + * Overloaded operator new[]. + * + * @since S60 5.0 + * @param s size of the allocation + * @return void* pointer to allocated object. + */ +OSN_IMPORT void* operator new[] (size_t s,newarg) throw (std::bad_alloc); + +/** + * Overloaded operator delete[]. + * + * @since S60 5.0 + * @param ptr pointer to the object to be deleted + */ +OSN_IMPORT void operator delete[](void* ptr,newarg)throw(); + + +#endif // OSNNEW_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/inc/osn/osntypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/inc/osn/osntypes.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,723 @@ +/* +* Copyright (c) 2007 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: Defines basic types. + * +*/ + + + +#ifndef OSNTYPES_H +#define OSNTYPES_H + +namespace osncore +{ + +/** + * Defines a signed 8 bit integer. + */ +typedef signed char int8; + +/** + * Defines an unsigned 8 bit integer. + */ +typedef unsigned char uint8; + +/** + * Defines a signed 16 bit integer. + */ +typedef signed short int int16; + +/** + * Defines an unsigned 16 bit integer. + */ +typedef unsigned short int uint16; + +/** + * Defines an signed 32 bit integer. + */ +typedef signed long int int32; + +/** + * Defines an unsigned 32 bit integer. + */ +typedef unsigned long int uint32; + +/** + * Defines a signed 64 bit integer. + */ +typedef signed long long int64; + +/** + * Defines an unsigned 64 bit integer. + */ +typedef unsigned long long uint64; + +/** + * Defines a 32 bit floating point number. + */ +typedef float float32; + +/** + * Defines a 64 bit floating point number. + */ +typedef double float64; + +/** + * Defines an 8 bit character (usually ASCII). + */ +typedef char char8; + +/** + * Defines an system dependent unsigned int + * (in 32 bit system it is 4 bytes and in 16 bit system it is 2 bytes). + */ +typedef unsigned int uint; + +/** + * Defines an 8 bit unsigned char + */ +typedef unsigned char uchar; + + + +/** + * Defines a 16 bit character (usually unicode). + */ +#if defined(__VC32__) +typedef uint16 char16; //here a uint16 is needed because the vc +//version of L"..." returns an unsigned short +#elif defined(__CW32__) +typedef uint16 char16; //the same like for __VC32__ +#elif defined(__GCC32__) +typedef __wchar_t char16; //when using gcc the wchar_t type must be +//used or else L in front of ASCI strings +//(e.g. L"xyz") can't be used to assign a +//unicode string to a char16[] +#elif defined(__ARMCC_VERSION) // RVCT ARM COMPILER +typedef wchar_t char16; +#elif defined(__GCCE__) +typedef wchar_t char16; +#elif defined(__GNUC__) +typedef uint16 char16; +#endif + +/** + * Defines a 32 bit boolean. + */ +typedef int32 bool32; + +/** + * Defines the return code data type. + */ +typedef int32 ReturnCode; + + +class CPoint; + +/** + * @class CSize osntypes.h "osn/osntypes.h" + * Defines a two dimensional size data type. + * + * @since S60 5.0 + * @status Draft + * @interfaces CSize + */ +class CSize + { +public: + /** + * Default constructor, initializing the mX and mY members to zero. + */ + inline CSize(); + + /** + * Parameterized constructor. + * + * @param aX The first dimension of the size ( usually the width ). + * @param aY The second dimension of the size ( usually the height ). + */ + inline CSize( int32 aX, int32 aY ); + + /** + * Copy constructor. + * + * @param aSize The size object to be copied. + */ + inline CSize( const CSize& aSize ); + + /** + * Gets a CPoint whose coordinates are the width and height of this + * CSize. + * + * @return The coordinates of this CSize converted to a point. + */ + inline CPoint AsPoint(); + + /** + * Compares this CSize with the specified CSize for equality. + * + * For two CSizes to be equal, both their width and height values + * must be equal. + * + * @param aSize The CSize to be compared with this CSize. + * + * @return TRUE, if the sizes are equal, FALSE otherwise. + */ + inline bool32 operator==( const CSize& aSize ) const; + + /** + * Compares this CSize with the specified CSize for inequality. + * + * For two CSize to be unequal, either their width or height values + * must be different. + * + * @param aSize The CSize to be compared with this CSize. + * + * @return TRUE, if the sizes are different, FALSE + * otherwise. + */ + inline bool32 operator!=( const CSize& aSize ) const; + + /** + * CSize addition assignment operator. + * + * The operator adds the specified CSize to this CSize, and + * assigns the result back to this CSize. + * + * @param aSize The CSize to be added. + * + * @return A reference to this point object. + */ + inline CSize& operator+=( const CSize& aSize ); + + /** + * CSize subtraction assignment operator. + * + * The operator substracts the specified CSize from this CSize, + * and assigns the result back to this CSize. + * + * @param aSize The CSize to be substracted. + * + * @return A reference to this point object. + */ + inline CSize& operator-=( const CSize& aSize ); + + int32 mX; ///< The first dimension. + int32 mY; ///< The second dimension. + }; + +/** + * CSize addition operator. + * + * Calculates the sum of two CSize objects + * + * @param aLeftHandSide The left addend. + * @param aRightHandSide The right addend. + * + * @return The sum. + * + */ +inline const CSize operator+( const CSize& aLeftHandSide, + const CSize& aRightHandSide ); + +/** + * CSize substraction operator. + * + * Calculates the difference of two CSize objects + * + * @param aLeftHandSide The minuend. + * @param aRightHandSide The subtrahend. + * + * @return The difference. + * + */ +inline const CSize operator-( const CSize& aLeftHandSide, + const CSize& aRightHandSide ); + + +/** + * @class CPoint osntypes.h "osn/osntypes.h" + * Defines a two dimensional point data type. + * + * @since S60 5.0 + * @status Draft + * @interfaces CPoint + */ +class CPoint + { +public: + /** + * Default constructor, initializing the mX and mY members to zero. + */ + inline CPoint( ); + + /** + * Parameterized constructor. + * + * @param aX The first coordinate of the point. + * @param aY The second coordinate of the point. + */ + inline CPoint( int32 aX, int32 aY ); + + /** + * Copy constructor. + * + * @param aPoint The point object to be copied. + */ + inline CPoint( const CPoint& aPoint ); + + /** + * Gets a CSize whose width and height are the coordinates of this + * CPoint. + * + * @return The width and height of this CPoint converted to a size. + */ + inline CSize AsSize(); + + /** + * Compares two points for equality. + * + * For two points to be equal, both their x and y coordinate values + * must be equal. + * + * @param aPoint The point to be compared with this point. + * + * @return TRUE, if the points are equal, FALSE otherwise. + */ + inline bool32 operator==( const CPoint& aPoint ) const; + + /** + * Compares two points for inequality. + * + * For two points to be unequal, either their x or their y + * coordinate values must be different. + * + * @param aPoint The point to be compared with this point. + * + * @return TRUE, if the points are different, FALSE + * otherwise. + */ + inline bool32 operator!=( const CPoint& aPoint ) const; + + /** + * CPoint addition assignment operator. + * + * The operator adds the specified CPoint to this CPoint, and + * assigns the result back to this CPoint. + * + * @param aPoint The CPoint to be added. + * + * @return A reference to this point object. + */ + inline CPoint& operator+=( const CPoint& aPoint ); + + /** + * CPoint subtraction assignment operator. + * + * The operator substracts the specified CPoint from this CPoint, + * and assigns the result back to this CPoint. + * + * @param aPoint The CPoint to be substracted. + * + * @return A reference to this point object. + */ + inline CPoint& operator-=( const CPoint& aPoint ); + + int32 mX; ///< The x-coordinate position of the point. + int32 mY; ///< The y-coordinate position of the point. + }; + +/** + * CPoint addition operator. + * + * Calculates the sum of two CPoint objects + * + * @param aLeftHandSide The left addend. + * @param aRightHandSide The right addend. + * + * @return The sum. + * + */ +inline const CPoint operator+( const CPoint& aLeftHandSide, + const CPoint& aRightHandSide ); + +/** + * CPoint substraction operator. + * + * Calculates the difference of two CPoint objects + * + * @param aLeftHandSide The minuend. + * @param aRightHandSide The subtrahend. + * + * @return The difference. + * + */ +inline const CPoint operator-( const CPoint& aLeftHandSide, + const CPoint& aRightHandSide ); + +/** + * @class CRect osntypes.h "osn/osntypes.h" + * Defines a two dimensional rectangle data type. + * + * @since S60 5.0 + * @status Draft + * @interfaces CRect + */ +class CRect + { +public: + /** + * Default constructor, initializing the coordinates of the top left + * corner and the size to ( 0,0 ). + */ + inline CRect(); + + /** + * Parameterized constructor. + * + * @param aX The first coordinate of the rectangle's top left point. + * @param aY The second coordinate of the rectangle's top left + * point. + * @param aWidth The width of the rectangle. + * @param aHeight The height of the rectangle. + */ + inline CRect( int32 aX, int32 aY, int32 aWidth, int32 aHeight ); + + /** + * Parameterized constructor. + * + * Constructs the rectangle with a point ( top left corner ) and a + * size. + * + * @param aTopLeft The top left point of the rectangle. + * @param aSize The size of the rectangle. + */ + inline CRect( const CPoint& aTopLeft, const CSize& aSize ); + + /** + * Parameterized constructor. + * + * Constructs the rectangle with a size. The top left corner is set + * to (0,0). + * + * @param aSize The size of the rectangle. + */ + inline CRect( const CSize& aSize ); + + /** + * Copy constructor. + * + * @param aRect The rectangle object to be copied. + */ + inline CRect( const CRect& aRect ); + + /** + * Determines whether the area covered by the rectangle is zero. + * + * @return TRUE, if the rectangle is empty, FALSE + * otherwise. + */ + inline bool32 IsEmpty() const; + + /** + * Tests whether this rectangle overlaps with the specified + * rectangle. + * + * Two rectangles overlap if any point is located within both + * rectangles. There is no intersection if two adjacent sides touch + * without overlapping, or if either rectangle is empty. + * + * @param aRect The rectangle to compare with this rectangle for an + * intersection. + * + * @return TRUE, if the two rectangles overlap, FALSE + * otherwise. + */ + inline bool32 Intersects( CRect aRect ) const; + + /** + * Tests whether this normalized rectangle overlaps with the + * specified normalized rectangle. + * + * Two rectangles overlap if any point is located within both + * rectangles. There is no intersection if two adjacent sides touch + * without overlapping, or if either rectangle is empty. + * If one of the rectangles isn't normalized, then the function also + * returns FALSE, + * + * Because of performance reasons this function should favored over + * the Intersects function, when it is certain that both rectangles + * are normalized. + * + * @param aRect The rectangle to compare with this rectangle for an + * intersection. + * + * @return TRUE, if the two rectangles are normalized and + * overlap, FALSE otherwise. + */ + inline bool32 FastIntersects( const CRect& aRect ) const; + + /** + * Gets the normalized area of intersection between this rectangle + * and the specified rectangle, and assigns it to this rectangle. + * + * If the two rectangles do not intersect, then, on return, this + * rectangle is set to be empty. + * + * @param aRect The rectangle to be used with this rectangle to get + * the area of intersection. + */ + inline void Intersection( CRect aRect ); + + /** + * Gets the normalized area of intersection between this normalized + * rectangle and the specified normalized rectangle, and assigns it + * to this rectangle. + * + * If the two rectangles do not intersect or are not normalized, + * then, on return, this rectangle is set to be empty. + * + * Because of performance reasons this function should be favored + * over the Intersection() function, when it is certain that both + * rectangles are normalized. + * + * @param aRect The rectangle to be used with this rectangle to get + * the area of intersection. + */ + inline void FastIntersection( const CRect& aRect ); + + /** + * Ensures that the rectangle's width and height have positive + * values. + * + * For example, if the rectangle's co-ordinates are such that the + * top is below the bottom, or the right hand side is to the left of + * the left hand side, normalisation swaps the co-ordinates of the + * top and bottom or of the left and right. + */ + inline void Normalize(); + + /** + * Tests whether the rectangle is normalized. + * + * A rectangle is normalized, when its width and height are both + * greater than or equal to zero. + */ + inline bool32 IsNormalized() const; + + /** + * Compares two rectangles for equality. + * + * For two rectangles to be equal, the coordinates of their top left + * corners and their sizes must be equal. + * + * @param aRect The rectangle to compare with this rectangle. + * + * @return TRUE, if the rectangles are equal, FALSE + * otherwise. + */ + inline bool32 operator==( const CRect& aRect ) const; + + /** + * Compares two rectangles for inequality. + * + * Two rectangles are unequal if the coordinates of their top left + * corners or their sizes differ. + * + * @param aRect The rectangle to compare with this rectangle. + * + * @return TRUE, if the rectangles are different, FALSE + * otherwise. + */ + inline bool32 operator!=( const CRect& aRect ) const; + + /** + * CPoint addition assignment operator. + * + * The operator moves this CRect's offset by the given point's + * coordinates. + * + * @param aPoint The CPoint to be added. + * + * @return A reference to this rectangle object. + */ + inline CRect& operator+=( const CPoint& aPoint ); + + /** + * CPoint subtraction assignment operator. + * + * The operator moves this CRect's offset by the given point's + * coordinates. + * + * @param aPoint The CPoint to be substracted. + * + * @return A reference to this rectangle object. + */ + inline CRect& operator-=( const CPoint& aPoint ); + + /** + * CSize addition assignment operator. + * + * The operator increases this CRect's size by the given size. + * + * @param aSize The CSize to be added. + * + * @return A reference to this rectangle object. + */ + inline CRect& operator+=( const CSize& aSize ); + + /** + * CSize subtraction assignment operator. + * + * The operator decreases this CRect's size by the given size. + * + * @param aSize The CSize to be substracted. + * + * @return A reference to this rectangle object. + */ + inline CRect& operator-=( const CSize& aSize ); + + int32 mX; ///< The position of the left-hand side of the + ///< rectangle. + int32 mY; ///< The position of the top side of the rectangle. + int32 mWidth; ///< The width of the rectangle. + int32 mHeight; ///< The height of the rectangle. + }; + +/** + * CRect + CPoint addition operator. + * + * The operator copies the CRect and moves the copy's offset by the given + * point's coordinates. + * + * @param aRect The CRect addend. + * @param aPoint The CPoint to be added. + * + * @return The moved CRect. + * + */ +inline const CRect operator+( const CRect& aRect, + const CPoint& aPoint ); + +/** + * CRect - CPoint subtraction operator. + * + * The operator copies the CRect and moves the copy's offset by the + * given point's coordinates. + * + * @param aRect The CRect addend. + * @param aPoint The CPoint to be substracted. + * + * @return The moved CRect. + * + */ +inline const CRect operator-( const CRect& aRect, + const CPoint& aPoint ); + +/** + * CRect + CSize addition operator. + * + * The operator copies the CRect and resizes the copy by the given size. + * + * @param aRect The CRect addend. + * @param aSize The CSize to be added. + * + * @return The resized CRect. + * + * @ingroup Runtime + */ +inline const CRect operator+( const CRect& aRect, + const CSize& aSize ); + +/** + * CRect - CSize subtraction operator. + * + * The operator copies the CRect and resizes the copy by the given size. + * + * @param aRect The CRect minuend. + * @param aSize The CSize to be substracted. + * + * @return The resized CRect. + * + * @ingroup Runtime + */ +inline const CRect operator-( const CRect& aRect, + const CSize& aSize ); + +/** + * Defines maximum value for a int8 variable + */ +const int8 MAX_INT8 = 0x7f; + +/** + * Defines minimum value for a int8 variable + */ +const int8 MIN_INT8 = 0x80; + +/** + * Defines maximum value for a uint8 variable + */ +const uint8 MAX_UINT8 = 0xffu; + +/** + * Defines maximum value for a int16 variable + */ +const int16 MAX_INT16 = 0x7fff; + +/** + * Defines minimum value for a int16 variable + */ +const int16 MIN_INT16 = 0x8000; + +/** + * Defines maximum value for a uint16 variable + */ +const uint16 MAX_UINT16 = 0xffffu; + +/** + * Defines maximum value for a int32 variable + */ +const int32 MAX_INT32 = 0x7fffffff; + +/** + * Defines minimum value for a int32 variable + */ +const int32 MIN_INT32 = 0x80000000; + +/** + * Defines maximum value for a uint32 variable + */ +const uint32 MAX_UINT32 = 0xffffffffu; + + +/** + * Maximum path/filename length including a NULL terminator. A char16* + * array of this size is guaranteed to accomodate all filenames returned + * by the system. + */ +const uint32 MAX_PATH_LENGTH = 257; + +/// Filename path delimiter. +const char16 PATH_DELIMITER = '\\'; + +/// Filename drive delimiter. +const char16 DRIVE_DELIMITER = ':'; + +/// Filename extension delimiter. +const char16 EXTENSION_DELIMITER = '.'; + + +#include +} +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/inc/osn/osntypes.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/inc/osn/osntypes.inl Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,576 @@ +/* +* Copyright (c) 2007 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: Defines all inline functions of the osn types. + * +*/ + + +#ifndef OSNTYPES_INL +#define OSNTYPES_INL + +// ======== GLOBAL FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// CSize operator+ +// ----------------------------------------------------------------------------- +// +inline const CSize operator+( const CSize& aLeftHandSide, + const CSize& aRightHandSide ) + { + return CSize( aLeftHandSide ) += aRightHandSide; + } + +// ----------------------------------------------------------------------------- +// CSize operator- +// ----------------------------------------------------------------------------- +// +inline const CSize operator-( const CSize& aLeftHandSide, + const CSize& aRightHandSide ) + { + return CSize( aLeftHandSide ) -= aRightHandSide; + } + +// ----------------------------------------------------------------------------- +// CPoint operator+ +// ----------------------------------------------------------------------------- +// +inline const CPoint operator+( const CPoint& aLeftHandSide, + const CPoint& aRightHandSide ) + { + return CPoint( aLeftHandSide ) += aRightHandSide; + } + +// ----------------------------------------------------------------------------- +// CSize operator- +// ----------------------------------------------------------------------------- +// +inline const CPoint operator-( const CPoint& aLeftHandSide, + const CPoint& aRightHandSide ) + { + return CPoint( aLeftHandSide ) -= aRightHandSide; + } + +// ----------------------------------------------------------------------------- +// CRect + CPoint +// Point addition. +// ----------------------------------------------------------------------------- +// +inline const CRect operator+( const CRect& aRect, + const CPoint& aPoint ) + { + return CRect( aRect ) += aPoint; + } + +// ----------------------------------------------------------------------------- +// CRect - CPoint +// Point substraction. +// ----------------------------------------------------------------------------- +// +inline const CRect operator-( const CRect& aRect, + const CPoint& aPoint ) + { + return CRect( aRect ) -= aPoint; + } + +// ----------------------------------------------------------------------------- +// CRect + CSize +// Size addition. +// ----------------------------------------------------------------------------- +// +inline const CRect operator+( const CRect& aRect, + const CSize& aSize ) + { + return CRect( aRect ) += aSize; + } + +// ----------------------------------------------------------------------------- +// CRect - CSize +// Size substraction. +// ----------------------------------------------------------------------------- +// +inline const CRect operator-( const CRect& aRect, + const CSize& aSize ) + { + return CRect( aRect ) -= aSize; + } + +// ======== MEMBER FUNCTIONS ======== + +// ----------------------------------------------------------------------------- +// CSize::CSize +// Default Constructor. +// ----------------------------------------------------------------------------- +// +inline CSize::CSize() : + mX( 0 ), + mY( 0 ) + { + } + +// ----------------------------------------------------------------------------- +// CSize::CSize +// Parameterized constructor. +// ----------------------------------------------------------------------------- +// +inline CSize::CSize( int32 aX, int32 aY ) : + mX( aX ), + mY( aY ) + { + } + +// ----------------------------------------------------------------------------- +// CSize::CSize +// Copy Constructor. +// ----------------------------------------------------------------------------- +// +inline CSize::CSize( const CSize& aSize ) : + mX( aSize.mX ), + mY( aSize.mY ) + { + } + +// ----------------------------------------------------------------------------- +// CSize::AsPoint +// Assignment substraction. +// ----------------------------------------------------------------------------- +// +inline CPoint CSize::AsPoint() + { + return CPoint( mX, mY ); + } + +// ----------------------------------------------------------------------------- +// CSize::operator== +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CSize::operator==( const CSize& aSize ) const + { + return ( mX == aSize.mX ) && ( mY == aSize.mY ); + } + +// ----------------------------------------------------------------------------- +// CSize::operator!= +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CSize::operator!=( const CSize& aSize ) const + { + // call operator== and negate it (logically) + return !( *this == aSize ); + } + +// ----------------------------------------------------------------------------- +// CSize::operator+= +// Assignment addition. +// ----------------------------------------------------------------------------- +// +inline CSize& CSize::operator+=( const CSize& aSize ) + { + mX += aSize.mX; + mY += aSize.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CSize::operator-= +// Assignment substraction. +// ----------------------------------------------------------------------------- +// +inline CSize& CSize::operator-=( const CSize& aSize ) + { + mX -= aSize.mX; + mY -= aSize.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CPoint::CPoint +// Default Constructor. +// ----------------------------------------------------------------------------- +// +inline CPoint::CPoint() : + mX( 0 ), + mY( 0 ) + { + } + +// ----------------------------------------------------------------------------- +// CPoint::CPoint +// Parameterized Constructor. +// ----------------------------------------------------------------------------- +// +inline CPoint::CPoint( int32 aX, int32 aY ) : + mX( aX ), + mY( aY ) + { + } + +// ----------------------------------------------------------------------------- +// CPoint::CPoint +// Copy Constructor. +// ----------------------------------------------------------------------------- +// +inline CPoint::CPoint( const CPoint& aPoint ) : + mX( aPoint.mX ), + mY( aPoint.mY ) + { + } + +// ----------------------------------------------------------------------------- +// CPoint::AsSize +// Assignment substraction. +// ----------------------------------------------------------------------------- +// +inline CSize CPoint::AsSize() + { + return CSize( mX, mY ); + } + +// ----------------------------------------------------------------------------- +// CPoint::operator== +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CPoint::operator==( const CPoint& aPoint ) const + { + return ( mX == aPoint.mX ) && ( mY == aPoint.mY ); + } + +// ----------------------------------------------------------------------------- +// CPoint::operator!= +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CPoint::operator!=( const CPoint& aPoint ) const + { + // call operator== and negate it (logically) + return !( *this == aPoint ); + } + +// ----------------------------------------------------------------------------- +// CPoint::operator+= +// Assignment addition. +// ----------------------------------------------------------------------------- +// +inline CPoint& CPoint::operator+=( const CPoint& aPoint ) + { + mX += aPoint.mX; + mY += aPoint.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CPoint::operator-= +// Assignment substraction. +// ----------------------------------------------------------------------------- +// +inline CPoint& CPoint::operator-=( const CPoint& aPoint ) + { + mX -= aPoint.mX; + mY -= aPoint.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CRect::CRect +// Default Constructor. +// ----------------------------------------------------------------------------- +// +inline CRect::CRect() : + mX( 0 ), + mY( 0 ), + mWidth( 0 ), + mHeight( 0 ) + { + } + +// ----------------------------------------------------------------------------- +// CRect::CRect +// Parameterized Constructor. +// ----------------------------------------------------------------------------- +// +inline CRect::CRect( int32 aX, int32 aY, int32 aWidth, int32 aHeight ) : + mX( aX ), + mY( aY ), + mWidth( aWidth ), + mHeight( aHeight ) + { + } + +// ----------------------------------------------------------------------------- +// CRect::CRect +// Parameterized Constructor. +// ----------------------------------------------------------------------------- +// +inline CRect::CRect( const CPoint& aTopLeft, const CSize& aSize ) : + mX( aTopLeft.mX ), + mY( aTopLeft.mY ), + mWidth( aSize.mX ), + mHeight( aSize.mY ) + { + } + +// ----------------------------------------------------------------------------- +// CRect::CRect +// Parameterized Constructor. +// ----------------------------------------------------------------------------- +// +inline CRect::CRect( const CSize& aSize ) : + mX( 0 ), + mY( 0 ), + mWidth( aSize.mX ), + mHeight( aSize.mY ) + { + } + +// ----------------------------------------------------------------------------- +// CRect::CRect +// Copy Constructor. +// ----------------------------------------------------------------------------- +// +inline CRect::CRect( const CRect& aRect ) : + mX( aRect.mX ), + mY( aRect.mY ), + mWidth( aRect.mWidth ), + mHeight( aRect.mHeight ) + { + } + +// ----------------------------------------------------------------------------- +// CRect::IsEmpty +// Check for emptyness. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::IsEmpty() const + { + // is empty if either width or heigth are zero + return ( !mHeight ) || ( !mWidth ); + } + +// ----------------------------------------------------------------------------- +// CRect::Intersects +// Checks whether two rects are intersecting. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::Intersects( CRect aRect ) const + { + if( IsEmpty() || aRect.IsEmpty() ) + { + return false; + } + + aRect.Normalize(); + + if( ( mWidth >= 0 ) && ( mHeight >= 0 ) ) + { + return FastIntersects( aRect ); + } + else if ( ( mWidth < 0 ) && ( mHeight < 0 ) ) + { + return ( mX > aRect.mX ) && + ( mY > aRect.mY ) && + ( ( mX + mWidth ) < ( aRect.mX + aRect.mWidth ) ) && + ( ( mY + mHeight ) < ( aRect.mY + aRect.mHeight ) ); + } + else if ( ( mWidth >= 0 ) && ( mHeight < 0 ) ) + { + return ( ( mX + mWidth ) > aRect.mX ) && + ( mY > aRect.mY ) && + ( mX < ( aRect.mX + aRect.mWidth ) ) && + ( ( mY + mHeight ) < ( aRect.mY + aRect.mHeight ) ); + } + else // ( mWidth < 0 ) && ( mHeight >= 0 ) + { + return ( mX > aRect.mX ) && + ( ( mY + mHeight ) > aRect.mY ) && + ( ( mX + mWidth ) < ( aRect.mX + aRect.mWidth ) ) && + ( mY < ( aRect.mY + aRect.mHeight ) ); + } + } + +// ----------------------------------------------------------------------------- +// CRect::FastIntersects +// Checks whether two normalized rects are intersecting. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::FastIntersects( const CRect& aRect ) const + { + return !( IsEmpty() || // Empty rects do not + aRect.IsEmpty() || // intersect. + !IsNormalized() || // Non-normalized rects are + !aRect.IsNormalized() || // ignored. + ( mX + mWidth ) <= aRect.mX || // Top or left side of aRect + ( mY + mHeight ) <= aRect.mY || // inside of this rect? + mX >= ( aRect.mX + aRect.mWidth ) || // Or the other way + mY >= ( aRect.mY + aRect.mHeight ) ); // around? + } + +// ----------------------------------------------------------------------------- +// CRect::Intersection +// Changes this rect to become the intersection rect of this rect and aRect. +// ----------------------------------------------------------------------------- +// +inline void CRect::Intersection( CRect aRect ) + { + Normalize(); + aRect.Normalize(); + + FastIntersection( aRect ); + } + +// ----------------------------------------------------------------------------- +// CRect::FastIntersection +// Changes this rect to become the intersection rect of this rect and aRect. +// Works only for normalized rectangles. +// ----------------------------------------------------------------------------- +// +inline void CRect::FastIntersection( const CRect& aRect ) + { + // if not intersecting at all, the intersection area is zero. + if( !FastIntersects( aRect ) ) + { + mX = 0; + mY = 0; + mWidth = 0; + mHeight = 0; + return; + } + // this rect's left side lies left of aRect's left side + if( mX < aRect.mX ) + { + mWidth -= ( aRect.mX - mX ); // adjust this rect's width + mX = aRect.mX; // move this rect's left side + } + // this rect's top side lies above aRect's top side + if( mY < aRect.mY ) + { + mHeight -= ( aRect.mY - mY ); // adjust this rect's height + mY = aRect.mY; // move this rect's top side + } + // this rect's right side lies right of aRect's right side + if( ( mX + mWidth ) > ( aRect.mX + aRect.mWidth ) ) + { + mWidth = ( aRect.mX + aRect.mWidth ) - mX; // adjust this rect's width + } + // this rect's bottom side lies below aRect's bottom side + if( ( mY + mHeight ) > ( aRect.mY + aRect.mHeight ) ) + { + mHeight = ( aRect.mY + aRect.mHeight ) - mY; // adjust this rect's + // height + } + } + +// ----------------------------------------------------------------------------- +// CRect::Normalize +// Makes sure the rect has positive width and height. +// ----------------------------------------------------------------------------- +// +inline void CRect::Normalize() + { + if( mWidth < 0 ) + { + mX += mWidth; + mWidth = -mWidth; + } + if( mHeight < 0 ) + { + mY += mHeight; + mHeight = -mHeight; + } + } + +// ----------------------------------------------------------------------------- +// CRect::IsNormalized +// Tests whether is rectangle is normalized. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::IsNormalized() const + { + return ( mWidth >= 0 ) && ( mHeight >= 0 ); + } + +// ----------------------------------------------------------------------------- +// CRect::operator== +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::operator==( const CRect& aRect ) const + { + return ( mY == aRect.mY ) && + ( mX == aRect.mX ) && + ( mHeight == aRect.mHeight ) && + ( mWidth == aRect.mWidth ); + } + +// ----------------------------------------------------------------------------- +// CRect::operator!= +// Logical comparison. +// ----------------------------------------------------------------------------- +// +inline bool32 CRect::operator!=( const CRect& aRect ) const + { + // is empty, if either width or height are zero + return !( *this == aRect ); + } + +// ----------------------------------------------------------------------------- +// CPoint::operator+= +// Point addition. +// ----------------------------------------------------------------------------- +// +inline CRect& CRect::operator+=( const CPoint& aPoint ) + { + mX += aPoint.mX; + mY += aPoint.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CPoint::operator-= +// Point substraction. +// ----------------------------------------------------------------------------- +// +inline CRect& CRect::operator-=( const CPoint& aPoint ) + { + mX -= aPoint.mX; + mY -= aPoint.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CPoint::operator+= +// Size addition. +// ----------------------------------------------------------------------------- +// +inline CRect& CRect::operator+=( const CSize& aSize ) + { + mWidth += aSize.mX; + mHeight += aSize.mY; + return *this; + } + +// ----------------------------------------------------------------------------- +// CPoint::operator-= +// Size substraction. +// ----------------------------------------------------------------------------- +// +inline CRect& CRect::operator-=( const CSize& aSize ) + { + mWidth -= aSize.mX; + mHeight -= aSize.mY; + return *this; + } + +#endif // OSNTYPES_INL__ diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_global_api/osn_global_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_global_api/osn_global_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +osn global api +osn global api +c++ +osncore + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_string_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_string_api/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: OSN String API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/osn/ustring.h MW_LAYER_PLATFORM_EXPORT_PATH(osn/ustring.h) \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_string_api/inc/osn/ustring.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_string_api/inc/osn/ustring.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,449 @@ +/* +* Copyright (c) 2007 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: String class +* +*/ + + + + +#ifndef USTRING_H +#define USTRING_H + +#include +#include +#include +#include + +using namespace std; + +namespace osncore +{ + +class UStringImpl; + +typedef char Utf8; +typedef unsigned short Utf16; +typedef unsigned long Unicode; + +/** + * @class UString ustring.h "osn/ustring.h" + * Class encapsulates utf-8 encoded string. UString has a character based API thus + * e.g length will return number of charaters. Unicode operations for utf8 encoded + * string can be done using glib unicode manipulation functions and/or using non-member functions for + * UString type. + * + * @lib osncore.lib + * @since S60 5.0 + * @status Draft + * @interfaces UString + */ +class UString + { +public: + /** + * UString exception class + * @since S60 5.0 + */ + class InvalidUtf8: public invalid_argument + { + public: + + InvalidUtf8(): invalid_argument("invalid"){} + /** + * Gets the invalid utf string + * @since S60 5.0 + * @return the class name (InvalidUtf8) as a C-style string. + */ + OSN_IMPORT virtual const char* what()const throw(); + }; +public: + /** + * Default constructor. + */ + OSN_IMPORT UString(); + + /** + * Construct a UString as a copy of given null terminated string. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @param aStr Utf-8 encoded string + */ + OSN_IMPORT explicit UString(const Utf8* aStr); + + /** + * Construct a UString as a copy of given string + * with byte length of the source buffer. + * Because a length is provided, source doesn't need to be null terminated. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @param aStr Utf-8 encoded string + * @param aByteCount Byte count of Utf-8 encoded string + */ + OSN_IMPORT explicit UString(const Utf8* aStr, int aByteCount); + + /** + * Construct a UString from unicode code point. If Unicode is invalid, + * @since S60 5.0 + * @exception std::bad_alloc + * @param aCodePoint Unicode code point + */ + OSN_IMPORT explicit UString(Unicode aCodePoint); + + /** + * UString copy constructor + * @since S60 5.0 + * @exception std::bad_alloc + * @param aUString Copy source + */ + OSN_IMPORT UString(const UString& aUString); + + /** + * Copy assignment + * + * @since S60 5.0 + * @param aRhs Assignment source + */ + OSN_IMPORT UString& operator=(const UString& aRhs); + + /** + * Copy assignment + * + * @since S60 5.0 + * @param aRhs Assignment source + */ + OSN_IMPORT UString& operator=(const Utf8* aRhs); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~UString(); + + /** + * Checks whether string is empty. + * + * @since S60 5.0 + * @return True if string doesn't have content. + */ + OSN_IMPORT bool isEmpty()const; + + /** + * Returns the length of the string in characters. + * + * @since S60 5.0 + * @return Length + */ + OSN_IMPORT long getCharLength()const; + + /** + * Returns the length of the string in bytes + * + * @since S60 5.0 + * @return Bytes + */ + OSN_IMPORT long getByteLength()const; + + /** + * Returns utf8 type string + * + * @since S60 5.0 + * @return utf8 type string + */ + OSN_IMPORT const Utf8* getUtf8()const; + + /** + * Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive. + * + * @since S60 5.0 + * @param aUString UString object to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + OSN_IMPORT int compare(const UString& aUString)const; + + /** + * Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive. + * + * @since S60 5.0 + * @param aStr String to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + OSN_IMPORT int compare(const Utf8* aStr)const; + + /** + * Compares two strings for ordering using the linguistically correct rules for the current locale. + * When sorting a large number of strings, it will be significantly faster + * to obtain collation keys with g_utf8_collate_key()from libglib and compare the keys + * with strcmp() when sorting instead of sorting the original strings. + * + * @since S60 5.0 + * @param aUString UString object to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + OSN_IMPORT int compareC(const UString& aUString)const; + + /** + * Compares two strings for ordering using the linguistically correct rules for the current locale. + * When sorting a large number of strings, it will be significantly faster + * to obtain collation keys with g_utf8_collate_key() from libglib and compare the keys + * with strcmp() when sorting instead of sorting the original strings. + * If aStr is invalid utf8, UString::InvalidUtf8 exception is thrown. + * + * + * @since S60 5.0 + * @param aStr String to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + OSN_IMPORT int compareC(const Utf8* aStr)const; + + + /** + * Compares two strings using strcmp() + * + * @since S60 5.0 + * @param aRhs UString object to compare + * @return true if they compare equal. + */ + OSN_IMPORT bool operator==(const UString& aRhs)const; + + /** + * Compares two strings using strcmp() + * + * @since S60 5.0 + * @param aRhs String to compare + * @return true if they compare equal. + */ + OSN_IMPORT bool operator==(const Utf8* aRhs) const; + + /** + * Adds a string onto the end of string, expanding it if necessary. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @param aUString String object to append + */ + OSN_IMPORT void append(const UString& aUString); + + /** + * Adds a string onto the end of string, expanding it if necessary. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @param aStr String to append + */ + OSN_IMPORT void append(const Utf8* aStr); + + /** + * Inserts aStr into string, expanding it if necessary. + * If aPos is -1, bytes are inserted at the end of the string. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The character position to insert the copy of the string + * @param aStr The string to insert + */ + OSN_IMPORT void insert(long aPos, const Utf8* aStr); + + /** + * Inserts aStr into string, expanding it if necessary. Because length is + * provided, aStr may contain embedded nulls and need not be null terminated. + * If aPos is -1, bytes are inserted at the end of the string. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The character position to insert the copy of the string + * @param aStr The string to insert + * @param aCharCount Character count. + */ + OSN_IMPORT void insert(long aPos, const Utf8* aStr, long aCharCount); + + /** + * Replace a substring with a given string, expanding it if necessary + * + * @since S60 5.0 + * @exception std::bad_alloc + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The charater position to replace the string + * @param aStr The string to insert + */ + OSN_IMPORT void replace(long aPos, const Utf8* aStr); + + /** + * Replace a substring with a given string, expanding it if necessary. Because length is + * provided, aStr may contain embedded nulls and need not be null terminated. + * If aLength is < 0, length is assumed to be aStr's length. + * + * @since S60 5.0 + * @exception std::bad_alloc + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The character position to replace the string + * @param aStr The string to insert + * @param aCharCount Character count. + */ + OSN_IMPORT void replace(long aPos, const Utf8* aStr, long aCharCount); + + /** + * Erase a substring + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The character position to start erasing from + * @param aCharCount number of characters to erase. + */ + OSN_IMPORT void erase(long aPos, long aCharCount); + + /** + * Returns unicode at given position in string + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The requested position + */ + OSN_IMPORT Unicode operator[](long aPos); + + /** + * Checks whether string is null. + * + * @since S60 5.0 + * @return True if string is null. + */ + OSN_IMPORT bool isNull()const; + +private: // data + + /** + * Implementation. + */ + auto_ptr mImpl; + }; + + +/** + * @class UtfProxy ustring.h "osn/ustring.h" + * Proxy class to ease utf encoded string memory management. + * + * @lib osncore.lib + * @since S60 5.0 + * @status Draft + */ +template +class UtfProxy + { +public: + /** + * Constructor for templated UtfProxy class + */ + explicit UtfProxy(T* aString):iUtf(aString){} + + /** + * Destructor + */ + OSN_IMPORT ~UtfProxy(); + + /** + * Raw data + * + * @return const pointer to templated class + * @since S60 5.0 + */ + const T* getUtf()const{return iUtf;} +private: + /** + * Default constructor disabled + */ + UtfProxy(); + /** + * Copy constructor disabled + */ + UtfProxy(const UtfProxy& a); + /** + * Assignment disabled + */ + UtfProxy& operator=(const UtfProxy& a); + +private: + /** + * pointer to templated class + */ + T* iUtf; + }; + +typedef UtfProxy Utf16Proxy; +typedef UtfProxy Utf8Proxy; + +// Non member functions for UString type + +/** + * Convert a string from UTF-8 to UTF-16. A 0 word will be added to the result after the converted text. + * + * @since S60 5.0 + * @param aSourceUtf8 Non empty string object. + * @return auto_ptr to proxy object holding converted string. + */ +OSN_IMPORT auto_ptr toUtf16(const UString& aSourceUtf8); + +/** + * Converts a string to int.If no conversion could be performed, UString::InvalidUtf8 exception is returned. + * + * @since S60 5.0 + * @param aSource source string + * @return integer + */ +OSN_IMPORT int toInt(const UString& aSource); + +/** + * Normalize a unnormalized text. Characters are decomposed by canonical equivalence e.g û -> u^ + * + * @since S60 5.0 + * @param aSource source string + * @return auto_ptr holding UString object. + */ +OSN_IMPORT auto_ptr normalizeNFD(const UString& aSource); + +/** + * Normalize a unnormalized text. Does canonical decomposition,followed by canonical composition. + * Resulting text is to be a canonical equivalent to the original unnormalized text. + * + * @since S60 5.0 + * @param aSource source string + * @return auto_ptr holding UString object. + */ +OSN_IMPORT auto_ptr normalizeNFC(const UString& aSource); + +/** + * Normalize a unnormalized text. Does compatibility decomposition. + * Resulting text is to be a compatibility equivalent to the original unnormalized text. + * + * @since S60 5.0 + * @param aSource source string + * @return auto_ptr holding UString object. + */ +OSN_IMPORT auto_ptr normalizeNFKD(const UString& aSource); + +/** + * Normalize a unnormalized text. Does compatibility decomposition,followed by compatibility composition. + * Resulting text is to be a compatibility equivalent to the original unnormalized text. + * + * @since S60 5.0 + * @param aSource source string + * @return auto_ptr holding UString object. + */ +OSN_IMPORT auto_ptr normalizeNFKC(const UString& aSource); +} + + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mmuifw_plat/osn_string_api/osn_string_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmuifw_plat/osn_string_api/osn_string_api.metaxml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + +osn string api +osn string api +c++ +osncore + + + + +no +no + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/group/alfcontainerwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/group/alfcontainerwidget.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007 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: This is the project specification file for alfcontainerwidget. +* +*/ + +#include + +TARGET alfcontainerwidget.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x200100FE + + + + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +// Common project specification for container widget ECom plugin +// and static container widget library meant to be linked against EUnit unit tests. +#include "mmp_common.inc" + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY libc.lib +LIBRARY alfwidgetutils.lib +LIBRARY alfwidgetmodel.lib + +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + +LIBRARY libpthread.lib +LIBRARY libstdcpp.lib +LIBRARY alfclient.lib +LIBRARY osncore.lib +SOURCEPATH ../src +LANG SC + +START RESOURCE 200100fe.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET alfcontainerwidget.rsc +#endif +END + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/group/alfcontainerwidgetstatic.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/group/alfcontainerwidgetstatic.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007 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: Project definition file for project alfcontainerwidgetstatic +* +*/ + + +#include + +TARGET alfcontainerwidgetstatic.lib +TARGETTYPE lib +UID 0x00000000 0x0332F1CB // Random UID + + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +// Common project specification for container widget ECom plugin +// and static container widget library meant to be linked against EUnit unit tests. +#include "mmp_common.inc" + +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: This file provides the information required for building the +* whole of a alfcontainerwidget. +* +*/ + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES +alfcontainerwidget.mmp + +PRJ_TESTEXPORTS + + +PRJ_TESTMMPFILES + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/group/mmp_common.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/group/mmp_common.inc Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,20 @@ +/* +============================================================================ + Name : mmp_common.inc + Author : + Copyright : + Description : Common project specification for container widget ECom plugin + and static container widget library meant to be linked against EUnit unit tests. +============================================================================ +*/ + +USERINCLUDE ../inc +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE alfcontainerwidgetfactoryplugin.cpp +SOURCE alfcontainerwidget.cpp +SOURCE alfcontainerwidgetexception.cpp +SOURCE alfcontainercontrol.cpp + +USERINCLUDE ../../../inc \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/inc/alfcontainercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/inc/alfcontainercontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2007 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: Container widget control class. +* +*/ + + +#ifndef ALFCONTAINERCONTROL_H_ +#define ALFCONTAINERCONTROL_H_ + +#include + +namespace Alf +{ + +/** + * Control class of the container widget. + * + * This class implements logic of the container widget. + * + * Container widget automatically creates an AlfContainerControl object + * for it's control. It is not possible to construct this control through + * AlfContainerWidgetFactoryPlugin. + */ +class AlfContainerControl : public CAlfWidgetControl +{ +public: + + /** + * Default constructor + * + * @param aEnv UI Accelerator Toolkit environment where this container widget + * is created. + */ + AlfContainerControl(CAlfEnv& aEnv); + + /** + * Default destructor + */ + virtual ~AlfContainerControl(); + + /** + * Handles events sent to widget control. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * @return True if the event is handled, false elsevhere. + */ + virtual AlfEventStatus handleEvent( const TAlfEvent& aEvent ); +}; + +} + +#endif /*ALFCONTAINERCONTROL_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/inc/alfcontainerwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/inc/alfcontainerwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,267 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for container widget. +* +*/ + + +#ifndef ALFCONTAINERWIDGET_H +#define ALFCONTAINERWIDGET_H + +#include "alf/ialfcontainerwidget.h" +#include + +// Forward declarations +class CAlfEnv; + +namespace Alf +{ + +// Forward declarations +class AlfWidget; + +/** + * Container widget implementation. + * + * Container widget can be used to contain other widgets in an arbitrary layout. + * To create a container widget see CAlfContainerWidgetFactoryPlugin class. + * + * Container widget creates a control group with ID 0 and stores it's control + * in it. It will also append all added widget controls into the same control group + * unless the added widget control is added to its own control group. + */ +class AlfContainerWidget : public IAlfContainerWidget +{ +public: + + /** + * Default constructor. + * + * Use CAlfContainerWidgetFactoryPlugin::CreateProduct() to instantiate a container + * widget. + * + * @param aWidgetName The widget name or ID to be assigned to this widget. + * @param aContainer Container widget in which this container is contained. + * @param aEnv UI Accelerator Environment instance to which the widget is created. + * @param aNode Runtime declaration of the widget + * @param aFilePath Path to XML file describing the presentation of the widget + */ + AlfContainerWidget( const char* aWidgetName, + IAlfContainerWidget& aContainer, + CAlfEnv& aEnv, + DuiNode* aNode, + const char* aFilePath); + + /** + * Default destructor. + */ + virtual ~AlfContainerWidget(); + + // From Alf::IAlfWidget base class + + /** + * Getter for the control. The ownership is not passed. + * + * @since S60 5.0 + * @return The control of this widget, or NULL if the control is not specified. + */ + virtual CAlfWidgetControl* control() const; + + /** + * getter for the parent container. The ownership is not passed. + * @return the parent container or NULL if the widget is the root-widget. + */ + virtual IAlfContainerWidget* parent() const; + + /** + * Setter for the control. The control is owned by the Alfred environment. + * The previously set control can be destroyed when new control is set. + * + * The set control is added to the control group of this container widget. + * The set control is removed from it's previous control group. + * + * @since S60 5.0 + * @param aControl The control for this widget. + * @param aDeletePreviousControl A boolean to indicate whether the previously set control + * is to be destroyed when this method is called. + */ + virtual void setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl = true); + + /** + * Getter for the model. The ownership is not passed. + * + * @since S60 5.0 + * @return The model of this widget, or NULL if the model is not specified. + */ + virtual IAlfModel* model(); + + /** + * Setter for the model. Ownership is passed and the old model is released. + * + * @since S60 5.0 + * @param aModel The model for this widget. + * @param aTakeOwnership Whether takes ownership of model or not + */ + virtual void setModel(IAlfModel* aModel, bool aTakeOwnership = true); + + /** + * Get the name of the widget instance. + * + * @since S60 5.0 + * @return Widget name + */ + virtual const char* widgetName() const; + + /** + * Sets/Releases the Focus from child widget of container. + * Does not set the actual focused status in roster. + * + * @since S60 5.0 + * @param aFocus boolean value for focused status + */ + virtual void setChildFocus(bool aFocus); + + /** + * Sets the presentation for the widget using presentation XML file. + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + virtual void setPresentation(const char* aFilePath); + + // From Alf::IAlfContainerWidget base class + + /** + * Returns total number of widgets contained by this container. + * + * @return int Total number of widgets. + */ + virtual int widgetCount() const; + + /** + * Adds a child widget to the container. + * + * Ownership of the widget is transferred to this container + * object. + * + * The control of the added widget is appended to the control group of + * this container widget unless the control already is appended to + * another control group. + * + * @param aWidget Child widget to be added to container. + */ + virtual void addWidget(IAlfWidget& aWidget); + + /** + * Returns child widget at given index. + * + * If index is not found returns null. + * + * @param aIndex Index of widget to be returned. + * @return Widget at given index or null if not found. + */ + virtual IAlfWidget* getWidget(int aIndex) const; + + /** + * Returns the child index, when given the child widget. + * + * @param aWidget child widget, which index is returned + * @return the index of the child widget, or -1, if widget is not child of this container. + */ + virtual int getWidgetIndex(IAlfWidget& aWidget) const; + + /** + * Removes the child widget from given index. + * + * This will destroy the widget object at the given index. + * + * @param aIndex Index from which widget has to be removed. + */ + virtual void removeWidget(int aIndex); + + /** + * Sets the base layout of container widget. + * + * @param aLayout New base layout of container widegt. + */ + virtual void applyLayout(IAlfLayoutManager& aLayout); + + // From Alf::IAlfInterfaceBase base class + + /** + * Interface getter. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 5.0 + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + +private: + /** + * Constructs widget from declaration. + * + * @param aNode declaration node. + */ + void constructComponentsFromNode(); + + /** + * Constructs widget from declaration. + * + * @param aNode declaration node. + */ + void processTreeRecursively(); + + /** + * Constructs widget using the presentation XML. + * + * @param aFilePath Path to XML file describing the presentation of the widget. + */ + void constructFromPresentationXML(const char *aFilePath); + + /** + * Constructs control for widget + * + */ + void constructDefault(); + + /** + * Sets default layout mgr. + */ + void setDefaultLayoutManager(); +private: + + /** Pointer to the adaptee AlfWidget - object. */ + auto_ptr mWidget; + + /** + * UI Accelerator Environment where this widget is used. + * Not owned. + */ + CAlfEnv& mEnv; + +}; + +} + +#endif /*ALFCONTAINERWIDGET_H*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/inc/alfcontainerwidgetexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/inc/alfcontainerwidgetexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: Container widget exception class. +* +*/ + + +#ifndef ALFCONTAINERWIDGETEXCEPTION_H +#define ALFCONTAINERWIDGETEXCEPTION_H + +// INCLUDES +#include +#include + +namespace Alf + { + +/** + * Error codes used with AlfContainerWidgetException. + * + * There is an offset in AlfContainerWidgetException error codes, so that + * AlfContainerWidget specific exceptions can be separated from + * osncore::AlfException base exceptions and exceptions of other widgets. + */ +enum TAlfContainerWidgetErrorCode + { + /** + * Error occured in construction or initialization of the container + * widget. + */ + EInitializationError = 500 + }; + +/** + * AlfContainerWidgetException is a base class for all container widget + * exceptions. + * + */ +class AlfContainerWidgetException : public osncore::AlfException + { +public: + // Constructors and destructor + + /** + * Constructor with AlfContainerWidget specific error code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + */ + AlfContainerWidgetException(int aError) throw(); + + /** + * Constructor with AlfContainerWidget specific error code + * and additional information. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + */ + AlfContainerWidgetException(int aError, const char* aInfo) throw(); + + /** + * Constructor with AlfContainerWidget specific error code, + * additional information, source file and line of code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfContainerWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + * @param aFileAndLine Optional file and line information or NULL. + */ + AlfContainerWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw(); + + /** + * Default destructor. + */ + virtual ~AlfContainerWidgetException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + const char* what() const throw(); + +private: + + /** + * Error description + */ + osncore::UString mDescription; + + }; + + } // Namespace Alf + +#endif // ALFCONTAINERWIDGETEXCEPTION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/inc/alfcontainerwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/inc/alfcontainerwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 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: Factory plugin implementation that can construct container widgets. +* +*/ + + +#ifndef ALFCONTAINERWIDGETFACTORYPLUGIN_H +#define ALFCONTAINERWIDGETFACTORYPLUGIN_H + +// INCLUDES +#include + +namespace Alf +{ + +/** + * AlfContainerWidgetFactoryPlugin is a widget factory plugin implementation + * that can be used to create container widgets. + * + * Can be used to create container widgets and associated products. + */ +class AlfContainerWidgetFactoryPlugin : public IAlfFactoryPlugin + { +public: + // Constructors and destructor + + /** + * Default Symbian constructor to create the factory plugin. + */ + static AlfContainerWidgetFactoryPlugin* newL(); + + // From base class MAlfPluginFactory + + /** + * Create container widget factory product. + * @since Series 60 5.0 + * @param aProduct Product to create. + * @param aInitData Initialization data for product + * @return Instance or NULL + */ + IAlfInterfaceBase* createProduct( const char* aProduct, void* aInitData ); + + /** + * Count available products this factory can produce. + * + * @since S60 5.0 + * @return Product count + */ + int productCount() const; + + /** + * Fetch product info by index + * + * @param aIndex List index + * @since S60 5.0 + * @return Descriptor describing product + */ + const char* productInfo(int aIndex) const; + + // From base class IAlfInterfaceBase + + /** + * Creates interface based on the given type. + * + * @since Series 60 5.0 + * @param aType Interface type to create. + * @return Requested interface. + */ + IAlfInterfaceBase* makeInterface(const IfId& aType); + + }; + +} // Namespace Alf + +#endif // ALFCONTAINERWIDGETFACTORYPLUGIN_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/src/200100fe.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/src/200100fe.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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: container widget rss file. +* +*/ + +#include +#include "alf/alfecompluginfactoryuid.rh" + + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x200100FE; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x200100FF; + version_no = 1; + display_name = ""; + default_data = "container"; + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/src/alfcontainercontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/src/alfcontainercontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2007 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: Container widget control class. +* +*/ + + +// Local Includes +#include "../inc/alfcontainercontrol.h" + +// AlfClient Includes +#include + +// Widget Model +#include + +using namespace Alf; + +AlfContainerControl::AlfContainerControl(CAlfEnv& aEnv) + : CAlfWidgetControl(aEnv) + { + } + +AlfContainerControl::~AlfContainerControl() + { + } + +// --------------------------------------------------------------------------- +// From base class IAlfWidgetControl +// Handles events sent to widget control. +// --------------------------------------------------------------------------- +// +AlfEventStatus AlfContainerControl::handleEvent( const TAlfEvent& aEvent ) + { + AlfEventStatus ret = CAlfWidgetControl::handleEvent(aEvent); + + if(ret == EEventNotHandled && aEvent.IsKeyEvent()) + { + if(aEvent.KeyEvent().iScanCode == EStdKeyRightArrow || + aEvent.KeyEvent().iScanCode == EStdKeyDownArrow ) + { + if(aEvent.Code() == EEventKey) + { + TAlfEvent focusNext(EEventFocusNextWidget); + return CAlfWidgetControl::processEvent(focusNext); + } + } + else if(aEvent.KeyEvent().iScanCode == EStdKeyLeftArrow || + aEvent.KeyEvent().iScanCode == EStdKeyUpArrow) + { + if(aEvent.Code() == EEventKey) + { + TAlfEvent focusPrevious(EEventFocusPreviousWidget); + return CAlfWidgetControl::processEvent(focusPrevious); + } + } + } + + return ret; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/src/alfcontainerwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/src/alfcontainerwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2007 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: Widget interface with utilities for container widget. +* +*/ + + +#include "alfcontainerwidget.h" +#include "alfcontainercontrol.h" +#include "alfcontainerwidgetexception.h" +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include + +#include "alf/attrproperty.h" + +namespace Alf +{ + +AlfContainerWidget::AlfContainerWidget( + const char* aWidgetName, + IAlfContainerWidget& aContainer, + CAlfEnv& aEnv, + DuiNode* /*aNode*/, + const char* /*aFilePath*/) + : mWidget(0), + mEnv(aEnv) + { + mWidget.reset(new (EMM) AlfWidget(aWidgetName, aContainer, aEnv)); + + + + constructDefault(); + setDefaultLayoutManager(); + + } + +AlfContainerWidget::~AlfContainerWidget() + { + } + +CAlfWidgetControl* AlfContainerWidget::control() const + { + return mWidget->control(); + } + +IAlfContainerWidget* AlfContainerWidget::parent() const + { + return mWidget->parent(); + } + +void AlfContainerWidget::setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl) + { + mWidget->setControl(aControl, aDeletePreviousControl); + } + +IAlfModel* AlfContainerWidget::model() + { + return 0; + } + +void AlfContainerWidget::setModel(IAlfModel* /*aModel*/, bool /*aTakeOwnership*/) + { + + } + +const char* AlfContainerWidget::widgetName() const + { + return mWidget->widgetName(); + } + +void AlfContainerWidget::setChildFocus(bool /*aFocus*/) + { + + } + + +//--------------------------------------------------------------------------- +// Creates the presentation for the widget from XML. Destroys any existing +// presentation. +//--------------------------------------------------------------------------- +// +void AlfContainerWidget::setPresentation (const char* aFilePath) + { + if(mWidget.get()) + { + mWidget->setPresentation(aFilePath); + } + } + +int AlfContainerWidget::widgetCount() const + { + return mWidget->widgetCount(); + } + +void AlfContainerWidget::addWidget(IAlfWidget& aWidget) + { + mWidget->addWidget(aWidget); + } + +IAlfWidget* AlfContainerWidget::getWidget(int aIndex) const + { + return mWidget->getWidget(aIndex); + } + +int AlfContainerWidget::getWidgetIndex(IAlfWidget& aWidget) const + { + return mWidget->getWidgetIndex(aWidget); + } + +void AlfContainerWidget::removeWidget(int aIndex) + { + mWidget->removeWidget(aIndex); + } + +void AlfContainerWidget::applyLayout(IAlfLayoutManager& aLayout) + { + mWidget->applyLayout(aLayout); + } + +IAlfInterfaceBase* AlfContainerWidget::makeInterface(const IfId& aType) + { + // Type cast to IAlfWidget + if(!strcmp(aType.mImplementationId, IAlfWidget::type().mImplementationId)) + { + return static_cast(this); + } + + // Type cast to IAlfContainerWidget + if(!strcmp(aType.mImplementationId, IAlfContainerWidget::type().mImplementationId)) + { + return static_cast(this); + } + + return mWidget->makeInterface ( aType ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfContainerWidget::constructDefault() + { + // Create control for the container widget + auto_ptr control(new (EMM) AlfContainerControl(mEnv)); + setControl(control.get()); + control.release(); + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfContainerWidget::setDefaultLayoutManager() + { + // Default layout manager provided by the container widget + auto_ptr layoutManager(new (EMM) AlfGridLayoutManager()); + this->applyLayout(*layoutManager.get()); + AlfGridLayoutManager* lm = layoutManager.release(); + + IAlfGridLayoutPolicy* gridPolicy = IAlfInterfaceBase::makeInterface(lm); + gridPolicy->fillWeights(IAlfGridLayoutPolicy::EGridDimensionColumn, 1, TAlfMetric(1, EAlfUnitWeight)); + gridPolicy->fillWeights(IAlfGridLayoutPolicy::EGridDimensionRow, 1, TAlfMetric(1, EAlfUnitWeight)); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfContainerWidget::constructComponentsFromNode() + { + constructDefault(); + + //check, if the layoutmanager is already set. + IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control()); + if (!layoutManager) + { + setDefaultLayoutManager(); + } + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfContainerWidget::processTreeRecursively() + { + } + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// +void AlfContainerWidget::constructFromPresentationXML(const char* /*aFilePath*/ ) + { + constructDefault(); + setDefaultLayoutManager(); + } +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/src/alfcontainerwidgetexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/src/alfcontainerwidgetexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 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: Container widget exception class. +* +*/ + + +#include "alfcontainerwidgetexception.h" + +using namespace Alf; + +AlfContainerWidgetException::AlfContainerWidgetException(int aError) throw() + : osncore::AlfException(aError) + { + } + +AlfContainerWidgetException::AlfContainerWidgetException(int aError, const char* aInfo) throw() + : osncore::AlfException(aError, aInfo) + { + mDescription = osncore::UString(aInfo); + } + +AlfContainerWidgetException::AlfContainerWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw() + : osncore::AlfException(aError, aInfo, aFileAndLine) + { + mDescription = osncore::UString(aInfo); + mDescription.append(aFileAndLine); + } + +AlfContainerWidgetException::~AlfContainerWidgetException() throw() + { + } + +const char* AlfContainerWidgetException::what() const throw() + { + return mDescription.getUtf8(); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfcontainerwidget/src/alfcontainerwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfcontainerwidget/src/alfcontainerwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: AlfContainerWidgetFactoryPlugin implementation +* +*/ + +#include +#include +#include "alf/ialfcontainerwidget.h" +#include "alf/alfwidget.h" +#include +#include "alfcontainerwidget.h" +#include "alfcontainerwidgetexception.h" +#include "alfcontainerwidgetfactoryplugin.h" + +using namespace Alf; + +// UID of the container widget factory plugin. +const TInt KContainerWidgetFactoryPluginUid = {0x200100FF}; + +// Amount of products produced by this factory. +const int KProductCount = 1; + +AlfContainerWidgetFactoryPlugin* AlfContainerWidgetFactoryPlugin::newL() + { + return new (ELeave) AlfContainerWidgetFactoryPlugin(); + } + +IAlfInterfaceBase* AlfContainerWidgetFactoryPlugin::createProduct(const char* aProduct, void* aInitData) + { + IAlfInterfaceBase* ret(0); + + if(!strcmp(aProduct, IAlfContainerWidget::type().mImplementationId)) + { + // Typecast the initialization data + AlfWidgetInitData* initData = (AlfWidgetInitData*) aInitData; + + // Throw exception if init data is null + if(initData == 0) + { + ALF_THROW(AlfContainerWidgetException, EInitializationError, "Container widget initialization data was NULL."); + } + + // Assert that widget id in the initialization data is correct. + if(initData->mWidgetId == 0) + { + ALF_THROW(AlfContainerWidgetException, EInitializationError, "Widget ID was NULL."); + } + + // Assert that the UI Accelerator Toolkit Environment in the initialization data is correct. + if(initData->mEnv == 0) + { + ALF_THROW(AlfContainerWidgetException, EInitializationError, "Environment instance was NULL."); + } + + // Assert that container widget pointer in the initialization data is correct. + if(initData->mContainerWidget == 0) + { + ALF_THROW(AlfContainerWidgetException, EInitializationError, "Container widget instance was NULL."); + } + + // Create container widget + ret = new (EMM) AlfContainerWidget( + initData->mWidgetId, *initData->mContainerWidget, *initData->mEnv, initData->mNode, initData->mFilePath); + } + + return ret; + } + +int AlfContainerWidgetFactoryPlugin::productCount() const + { + return KProductCount; + } + +const char* AlfContainerWidgetFactoryPlugin::productInfo(int aIndex) const + { + switch(aIndex) + { + case 0: return ialfcontainerwidget::ident.mImplementationId; + default: break; + } + + return 0; + } + +IAlfInterfaceBase* AlfContainerWidgetFactoryPlugin::makeInterface(const IfId& aType) + { + if(!strcmp(aType.mImplementationId, IAlfFactoryPlugin::type().mImplementationId)) + { + return static_cast(this); + } + + return 0; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KContainerWidgetFactoryPluginUid, + AlfContainerWidgetFactoryPlugin::newL ) + }; + +// Entry point for ECom architecture to resolve the instantiation method pointer +// for a given implementation UID. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/group/alfscrollbarwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/group/alfscrollbarwidget.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ +#include + +#define ALF_LINK_STDCPP_DLL + +TARGET alfscrollbarwidget.dll +TARGETTYPE PLUGIN + +UID 0x10009d8d 0x20010105 +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + + +SOURCEPATH ../src +SOURCE alfscrollbarwidgetfactoryplugin.cpp +SOURCE alfscrollbarwidget.cpp +SOURCE alfscrollbarcontrol.cpp +SOURCE alfscrollbarmodel.cpp +SOURCE alfscrollbardefaultbaseelement.cpp +SOURCE alfscrollbarlongtaptimer.cpp + + +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY osncore.lib +LIBRARY alfclient.lib +LIBRARY alfwidgetmodel.lib +LIBRARY alfwidgetutils.lib +LIBRARY charconv.lib +LIBRARY libc.lib +LIBRARY cone.lib +LIBRARY gdi.lib +LIBRARY libpthread.lib +LIBRARY aknlayout2hierarchy.lib +LIBRARY aknlayout2scalable.lib +LIBRARY avkon.lib +LIBRARY cdlengine.lib +LIBRARY estlib.lib +LIBRARY libstdcpp.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif // RD_TACTILE_FEEDBACK + +LANG SC +START RESOURCE 20010105.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET alfscrollbarwidget.rsc +#endif +END + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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: Build information file for scrollbar widget +* +*/ + +#include + + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS +//../internal/tsrc/TestScrollBar/rom/testscrollbar.iby CORE_MW_LAYER_IBY_EXPORT_PATH(testscrollbar.iby) +PRJ_MMPFILES +alfscrollbarwidget.mmp + + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbarcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbarcontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,166 @@ +/* +* 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: Control interface with utilities for scrollbar widget. +* +*/ + +#ifndef ALF_SCROLLBARCONTROL_H +#define ALF_SCROLLBARCONTROL_H + +//WidgetModel Includes +#include +#include +#include + +//Osn Includes +#include + +//Internal Includes + +using namespace osncore; +using namespace Alf; + +// Forward declarations +//class TAlfCustomEventCommand; + +const float roundOff = 0.5; +namespace Alf + { +// Forward declaration +class AlfScrollBarControl : public CAlfWidgetControl + { +public: + + /** + * Constructor. + */ + AlfScrollBarControl ( CAlfEnv& aEnv ); + + /** + * Class Destructor. + * @since S60 ?S60_version + */ + virtual ~AlfScrollBarControl(); + + /** + * Sets whether or not tactile feedback is enabled. + * + * @param aEnabled Whether or not tactile is enabled. + */ + void EnableTactileFeedback( bool aEnabled ); + + /** + * Generates the feedback based on the events recieved + * + */ + void TactileEffectOnTouchandHold(); + + /** + * Generates the feedback based on the events recieved + * + * @param aEvent Events recieved by the widget on Drag + */ + void TactileEffectOnDrag(TAlfEvent& aEvent); + + /** + * Generates the feedback based on the thumb release + * or drag on thumb is stopped + */ + void TactileEffectOnRelease(); + + + /** + * Returns the state of tactile feedback whether it is enabled/disabled. + * + */ + bool IsTactileFeedbackEnabled(); + + // From Base class CAlfControl + + /** + * Notifies the owner that the layout of a visual has been recalculated. + * Called only when the EAlfVisualFlagLayoutUpdateNotification flag has + * been set for the visual. + * + * @param aVisual Visual that has been laid out. + */ + void VisualLayoutUpdated ( CAlfVisual& aVisual ); + + /** + * Returns top level layout. Returns NULL if this control does not + * implement the IAlfHostAPI interface or if there is no base layout. + * + * @return Pointer to top level layout, or NULL if not available. + */ + CAlfLayout* ContainerLayout ( const CAlfControl* aConnected ) const; + + // From base class CAlfWidgetControl + + /** + * @see IAlfWidgetControl + */ + AlfEventStatus handleEvent( const TAlfEvent& aEvent ); + + +private: + + /** + * Rounds float to int + * + * @param aFloatValue float value + * @return int + */ + inline int roundFloatToInt ( float aFloatValue ) + { + return(int)(aFloatValue + roundOff); + } + +private: + + /** + * Default contructor + */ + AlfScrollBarControl(); + + /** + * height of the Layout. + */ + int mLayoutHeight; + + /** + * width of the Layout. + */ + int mLayoutWidth; + + /** + * tactile is enabled or not. + */ + bool mEnableTactile; + + /** + * Tactile effect for drag started + */ + bool mDragTactileFeedbackStarted; + + /** + * Tactile feedback instance + */ + MTouchFeedback *mTactilefdbInstance; + + }; // class AlfScrollBarControl + + } // namespace Alf + +#endif //ALF_SCROLLBARCONTROL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbardefaultbaseelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbardefaultbaseelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,451 @@ +/* +* Copyright (c) 2007 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: Header file for presentation elements. + * +*/ + + +#ifndef ALF_SCROLLBAR_DEFAULT_BASEELEMENT_H +#define ALF_SCROLLBAR_DEFAULT_BASEELEMENT_H + +//INCLUDES +#include "alf/alfelement.h" +#include +#include + +#include +#include +#include "ialfscrollbarbaseelementinternal.h" + +#include "alfscrollbarmodel.h" +#include + +using namespace osncore; + +namespace Alf + { + +enum TOperation + { + ENop, // Nothing is going on. + EMoveItem // Item is begin moved. + }; +// Forward declarations +class IAlfWidgetEventHandler; +class CAlfWidgetControl; +class AlfScrollBarLongTapTimer; + +/** + * Default Base Element of the Scrollbar. + */ +class AlfScrollBarDefaultBaseElement : + public IAlfScrollBarDefaultBaseElement, + public AlfElement, + public IAlfWidgetEventHandler, + public IAlfScrollBarBaseElementInternal + { +public: + + /** + * Constructor + * @param aControl Widget control. + * @param aName Name of the item element. + * @param aCustomData . + * @param mNode . + * @since S60 ?S60_version + */ + AlfScrollBarDefaultBaseElement ( + CAlfWidgetControl& aControl, + const char* aName, + DuiNode* mNode = NULL, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Destructor + */ + virtual ~AlfScrollBarDefaultBaseElement(); + + //-------------------------------------------------------------------------- + // APIs from the IAlfScrollBarDefaultBaseElement for controlling the + // visualization of the scrollbar + //-------------------------------------------------------------------------- + + /** + * Sets the animation time for the thumb movement. + * Controls the movement of the thumb in the context of scroll + * @since S60 ?S60_version + * @param Animation time in milliseconds + */ + void setThumbAnimationTime(int aTime); + + /** + * Gets the Thumb animation time. + * @since S60 ?S60_version + * @return Animation time. + */ + int getThumbAnimationTime() const; + + /** + * Sets the Opacity of thumb. This is relative to widget opacity. + * Default value is 1.0. The value of aOpacity should be between 0.0 to 1.0 + * @since S60 ?S60_version + * @param Opacity of the thumb + */ + void setThumbOpacity(float aOpacity); + + /** + * Gets the Opacity of thumb. + * @since S60 ?S60_version + * @return: Thumb opacity + */ + float getThumbOpacity() const; + + /** + * Sets the Opacity of widget. + * Default value of scrollbar opacity is 1.0. + * + * @param aOpacity Opacity of the scrollbar. The value should be between 0.0 + * to 1.0. + * + * @exception AlfException + */ + void setOpacity(float aOpacity); + + /** + * Gets the Opacity of widget. + * + * @return: Thumb opacity + */ + float getOpacity() const; + + //-------------------------------------------------------------------------- + // APIs from the IAlfScrollBarBaseElement + //-------------------------------------------------------------------------- + + + + //-------------------------------------------------------------------------- + // Overriden Apis from IAlfWidgetEventHandlers + //-------------------------------------------------------------------------- + // + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. + * Pointer event handlers cannot be identified directly, + * since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * @since S60 ?S60_version + * @param aEvent The event. + * @param aControl + * @return ETrue if the event can be processed. + * Otherwise EFalse. + */ + bool accept(CAlfWidgetControl& aControl, const TAlfEvent& aEvent) const; + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerType eventHandlerType(); + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerExecutionPhase eventExecutionPhase(); + + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return ETrue if the event was processed. + * Otherwise EFalse. + */ + virtual AlfEventStatus offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ); + + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . The high 16 bits are + * available for states defined by the client code. + */ + void setActiveStates(unsigned int aStates); + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + + /** + * Returns AlfWidgetEventHandlerInitData. + * @return A pointer to AlfWidgetEventHandlerInitData structure + * which contains for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + /** + * Friend class for timer functions. + * + */ + friend class AlfScrollBarLongTapTimer; + + //-------------------------------------------------------------------------- + //Overriden Apis from IAlfScrollBarBaseElementInternal + //-------------------------------------------------------------------------- + // + + /** + * Notified when the base layout of scrollbar changes . + * Relayouts all the visuals with respect to the new size. + */ + void baseLayoutSizeChanged(); + + /** + * Send the corresponding Custom events to the scrollbar eventhandlers + * according to the visual clicked. + */ + bool processPointerEvent(TAlfEvent * aPntrEvent); + + /** + * Creates the Visualization of scrollbar + * + */ + void createVisualization(); + + /** + * Updates the Visualization of scrollbar + * + */ + void updateVisualization(); + + /** + * Destroy the Visualization of scrollbar + * + */ + void destroyVisualization(); + + /** + * Returns pointer to AlfScrollBarModel + * + */ + void initializeScrollModel(); + + /** + * handles longTap event + */ + AlfEventStatus handleLongTapEvent(); + + // --------------------------------------------------------------------------- + // From class IAlfInterfaceBase. + // + // --------------------------------------------------------------------------- + // + /** + * Getter for interfaces provided by the widget. + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + + + //-------------------------------------------------------------------------- + // Internal member functions AlfScrollBarDefaultBaseElement + //-------------------------------------------------------------------------- + // + + /** + * handles the pointerDown event + */ + bool handlePointerDownEvent(TAlfEvent * aPntrEvent); + + /** + * Sends pageup or pagedown event according to hit point on track + */ + AlfEventStatus trackVisualHit(CAlfVisual * aHitVisual); + + /** + * handles the pointerUp event + */ + void handlePointerUpEvent(); + + /** + * Initializes the scrollbar layouts with LCT layout data + */ + void initializeLayout(); + + /** + * Initializes the scrollbar Tracklayout with LCT layout data + */ + void initializeTrackLayout(); + + /** + * Initializes the scrollbar Thumblayout with LCT layout data + */ + void initializeThumbLayout(); + + /** + * Sets position and Size on the Visual/layout + * @param aVisual Visual/Layout on which position and size is being set + * @param aXVal Position X value + * @param aYVal Position Y value + * @param aWidth Width + * @param aHeight Height + */ + void setPositionAndSize(CAlfVisual * aVisual, + int aXVal, int aYVal, + int aWidth, int aHeight); + + /** + * Set skin images on scrollbar track + */ + void setTrackImage(); + + /** + * Set skin images on scrollbar thumb + */ + void setThumbImage(); + + /** + * Changes the scrollbar track image, based on the flag state + * @param aPressed false for normal graphics, + * true for pressed graphics + */ + void changeTrackImage(bool aPressed = false); + + /** + * Changes the scrollbar thumb image, based on the flag state + * @param aPressed false for normal graphics, + * true for pressed graphics + */ + void changeThumbImage(bool aPressed = false); + + /** + * Calculates the StepSize and thumbLength + */ + void calculateStepSizeAndThumbLength(); + + /** + * Calculates minimum and maximum thumbLength + */ + void setThumbMinMaxLength(); + + +private: + + /** + * handles the scroll bar click event + * + */ + AlfEventStatus handleScrollBarClickedEvent( + const TAlfEvent& aEvent ); + /** + * Creates the visual template hirarchy of scrollbar. + */ + void createDefaultBaseElement(); + + /** + * Sets LctLayoutData on the Visual/layout + * @param aRect Parent rect of the visual + * @param aWindowLineLayout TAknWindowLineLayout handle which has the LCT values + * to be set + * @param aVisual Visual/Layout on which LctLayoutData is being set + */ + void setLCTData(const TRect& aRect , + TAknWindowLineLayout& aWindowLineLayout,CAlfVisual * aVisual); + + /** + * Initialize drag flags and store drag start point + */ + bool initializeThumbDragData( const TPoint& aPointerPos ); + + /** + * Stop drag + */ + bool stopDrag(CAlfVisual* aHitVisual, TInt aAnimTime); + + /** + * changes the graphics of scrollbar to pressed/normal + */ + void changeGraphics(); + + /** + * checks whether it is scrollbar trackVisual or not + */ + bool isScrollbarTrackVisual(CAlfVisual *aVisual); + + /** + * changes the graphics of scrollbar to pressed/normal + */ + bool isScrollbarThumbVisual(CAlfVisual *aVisual); + + /* + * Instance of ScrollBarLongTapTimer. + */ + auto_ptr mLongTapTimer; + + /* + * holds the value if minimum thumb size. + */ + TAlfMetric mThumbMinSize; + + /* + * holds that value of minimum thumb size specified by the user. + */ + TAlfMetric mUserThumbMinSize; + + /* + * Flag set to true if minimum thumbsize is set. + */ + bool mIsMinSizeFlagSet; + + /* + * Flag set to true if longTapObserver is set. + */ + bool mIsLongTapObserverSet; + + /* + * pointer to scrollbarThumbLCTData. + */ + struct ScrollbarThumbLCTData *mLCTData; + + /* + * pointer to ScrollBarDefaultLCTBaseElementData. + */ + struct ScrollBarBaseElementData *mData; + + }; // end of class AlfScrollBarDefaultBaseElement + + } // end of namespace Alf + +#endif //ALF_SCROLLBAR_DEFAULT_BASEELEMENT_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbarlongtaptimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbarlongtaptimer.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2007 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: Timer for creating longtap event +* +*/ + +#ifndef __ALF_SCROLLBARLLONGTAPTIMER_H__ +#define __ALF_SCROLLBARLLONGTAPTIMER_H__ + +#include +#include +#include + +namespace Alf + { + +// Forward declarations +class AlfScrollBarBaseElement; + +class AlfScrollBarLongTapTimer: public CActive + { + + enum TState + { + //To indicate the event is in running state. + ERunning, + + //To indicate the event is in stopped state. + EStopped + }; +public: +/** + * Constructor + * @param aBaseElement . + * @since S60 ?S60_version + */ + AlfScrollBarLongTapTimer(IAlfScrollBarDefaultBaseElement* aBaseElement); + +/** + * Destructor + */ + ~AlfScrollBarLongTapTimer(); + +/** + * Start the Timer. + */ + void Start(); + + /** + * Stops the Timer. + */ + void Stop(); + + /** + * user code runs under this active object. + */ + void RunL(); + + /** + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + +private: + RTimer iTimer; + TState iState; + + /** + * Instance of IAlfScrollBarBaseElement. + */ + IAlfScrollBarDefaultBaseElement* iBaseElement; + + /** + * Instance of TAlfEvent. + */ + TAlfEvent* mEvent; + }; + + } + +#endif // __ALF_SCROLLBARLLONGTAPTIMER_H__ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbarmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbarmodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,369 @@ +/* +* 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: Model Interface with utilities for scrollbar widget. +* +*/ + +#ifndef ALF_SCROLLBARMODEL_H +#define ALF_SCROLLBARMODEL_H + +// Widget Model and Exported API includes +#include + +// OsnCore includes +#include +#include + +// Namespace +using namespace osncore; + +namespace Alf + { + +//Forward Declarations +class AlfModel; +class AlfScrollBarWidget; + + + +/** + * ScrollBar model implementation. + * + * Implements utility methods to create and update + * the data hierarchy of a scrollbar. + */ +class AlfScrollBarModel : public IAlfScrollBarModel + { +public: + + /** + * Constructor. + */ + AlfScrollBarModel(IAlfVariantType* aDataSource = NULL); + + /** + * Destructor. + */ + ~AlfScrollBarModel(); + + /** From base class IAlfModel + * + */ + + /** + * Add a new observer to be notified of any changes in the model. + * + * @param aObserver The model change observer to be added. + * @return void + * @since S60 ?S60_version + */ + void addModelChangeObserver(IAlfModelChangeObserver& aObserver); + + /** + * Remove an observer which is added to get notified of any changes + * in the model. + * + * @param aObserver The model change observer to be removed. + * @return void + * @since S60 ?S60_version + */ + void removeModelChangeObserver(IAlfModelChangeObserver& aObserver); + + /** + * API to change the model completely at one short. + * + * @see IAlfModel + * @param aData The new data. + * @return void + * @since S60 ?S60_version + */ + void setData(IAlfVariantType* aData); + + /** + * Change a given of data fields in the model . All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @param aData The new data to be set. + * @since S60 ?S60_version + */ + void updateData(int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData); + + /** + * Add a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @param aData The new data. + * @return void + * @since S60 ?S60_version + */ + void addData(int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData); + + /** + * Remove a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @return void + * @since S60 ?S60_version + */ + void removeData(int aNumContainerIndices, int* aContainerIndices); + + /** + * API for executing batch operations + * + * @param aOperationsArray An RPOinterArray containing the list of + * operations to be executed in batch. + * @return void + * @since S60 ?S60_version + */ + void executeOperations(AlfPtrVector& aOperationsArray); + + /** + * API for executing one operation at a Time + * + * @param aOperation An Operation to be executed on the model. + * @since S60 ?S60_version + */ + void executeOperation(AlfModelOperation* aOperation); + + /** + * Clears the Model. + * + * @return void + * @since S60 ?S60_version + */ + void clearModel(); + + /** + * Get the root data object of this model. + * + * @return The root data object. + * @since S60 ?S60_version + */ + IAlfVariantType* data() const; + + // From base class IAlfInterfaceBase + + IAlfInterfaceBase* makeInterface(const IfId& aType); + + // From base class IAlfScrollBarModel + + /** + * Create the default data structure for a ScrollBar widget. + * + * @param aTotalLengthInSteps + * @param aViewLengthInSteps + * @param aViewStartPosition + * + * + * @return void + * @exception std::bad_alloc + * @since S60 ?S60_version + */ + void initializeData(int aTotalLengthInSteps, + int aViewLengthInSteps, + int aViewStartPosition); + + /** + * Sets the TotalLength for the Scrollbar. Does not notify observers about this. + * + * @param aTotalLength TotalLength value + * + * @return void. + * @since S60 ?S60_version + */ + void setTotalLength(int aTotalLength); + + /** + * Sets the View Length for the Scrollbar. Does not notify observers + * about this. + * + * @param aViewSize + * + * @return void. + * @since S60 ?S60_version + */ + void setViewLength(int aViewSize); + + /** + * Sets the View Start Position for the Scrollbar. Does not notify + * observers about this. + * + * @param aViewStartPosition + * + * @return void. + * @since S60 ?S60_version + */ + void setViewStartPosition(int aViewStartPosition); + + /** + * Sets the TotalLength for the Scrollbar. Does not notify observers about this. + * + * @param aTotalLength TotalLength value + * @param aViewLength view length value + * @param aViewStartPosition view start position + * + * @return void. + * @since S60 ?S60_version + */ + void changeData(int aTotalLength,int aViewLength, int aViewStartPosition); + + /** + * Length of the document or viewable data. + * + * Arbitrary units are used, but the same units as the rest of the model. + * This length is best current estimate of the length of the entire + * viewable data in this model's direction.(i.e, vertical, horizontal). + * It represents physical extent (e.g. could be pixels), not logical + * size of the data. It is understood to represent the physical laid out + * size of the data if it were possible to view it all at once. + * + * @return length in arbitrary units of the viewable data + * @since S60 ?S60_version + */ + int getTotalLength() const; + + /** + * Length of the view. + * + * For horizontal models, this is the width of the view. + * For veritcal, this is the height of the view. + * + * Note the units are arbitrary but uniform with the rest of the model. + * Note that this measure is proportional to the physical width or height + * of the view. This metric is sometimes called the Thumb size. + * + * @return position of the start of the view + * @since S60 ?S60_version + */ + int getViewLength() const; + /** + * Position in arbitrary units of the start of the currently viewed data. + * + * For horizontal models, this is the position of the left of the view + * relative to the far left end of the document. + * For vertical, this is the position of the top of the view from the top + * of the viewable data. + * + * Note the units are arbitrary but uniform with the rest of the model. + * Position is in physical space as if the entire data were laid out. + * This metric is sometimes called the Thumb position. + * + * @return position of the start of the view + * @since S60 ?S60_version + */ + int getViewStartPosition() const; + + /** + * Updates the model according to the values passed. + * + * @param aTotalLengthInSteps + * @param aViewLength + * @param aViewStartPosition + * + * @return void. + * @since S60 ?S60_version + * + */ + void updateScrollBarModel(int aTotalLengthInSteps, + int aViewLength, + int aViewStartPosition); + /** + * Updates visualization of scrollbar according + * to the model values. + */ + void updateScrollBarVisualization(); + + /** + * Stores the scrollbar widget pointer in model + */ + void storeWidget(AlfScrollBarWidget* aWidget); + +private: + + /** + * This function validates view length passed and changes it if required + * + * @param aViewLength - in/out param + * + * @return bool false, if the data was not valid and changes were made + * else returns true + */ + bool validateViewLength(int & aViewLength); + + /** + * This function validates view start position passed and changes it if + * required + * + * @param aViewStartPos - in/out param + * + * @return bool false, if the data was not valid and changes were made + * else returns true + */ + bool validateViewStartPos(int & aViewStartPos); + + /** + * This function validates total length passed and changes it if + * required. This validation can change aViewLength, aViewStartPos + * too if reuired. + * + * @param aTotalLength - in/out param + * @param aViewLength - in/out param + * @param aViewStartPos - in/out param + * + * @return bool false, if the data was not valid and changes were made + * else returns true + */ + bool validateAllData(int & aTotalLength, + int & aViewLength, + int & aViewStartPos); + + /** + * Private method to create the ScrollBar Widget. + * + * @param aDataSource Model for the ScrollBar + * @return void + * @since S60 ?S60_version + * + */ + void construct ( IAlfVariantType* aDataSource ); + + /* + * pointer to scrollbarmodelData. + */ + struct ScrollbarModelDataImpl *mModelData; + + AlfModel* mModel; //Owned + AlfScrollBarWidget* mScrollWidget; + }; // class AlfScrollBarModel + + } // End of namespace Alf + +#endif // ALF_SCROLLBARMODEL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbarwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbarwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,226 @@ +/* +* 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: Widget interface with utilities for scrollbar widget. + * +*/ + + + +#ifndef ALF_SCROLLBARWIDGET_H +#define ALF_SCROLLBARWIDGET_H + + +// WidgetModel Includes +#include +#include "alf/alfwidget.h" +#include + +// Widget Includes +#include +#include + + +// Forward Declarations +class CAlfEnv; + +// From namespace Alf +namespace Alf + { + // Forward Declarations + class CAlfWidgetControl; + class IAlfModel; + } + +//From name space duiuimodel +namespace duiuimodel + { +class DuiNode; + } + +namespace Alf + { + + /** + * A basic scrollbar widget implementation. + * Contains methods for creating the default + * building blocks for the scrollbar widget. + */ +class AlfScrollBarWidget : public IAlfScrollBarWidget + { +public: + + /** + * Creator Method. + * + * @param aEnv The environment for the widget. + * @param aContainer The container widget where this widget is contained. + * @param aWidgetId The name of the widget. Not Owned. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @param aCustomData Custom data. Not Owned. + * @param aNode Node. Not Owned. + * @return AlfScrollBarWidget , or NULL if it does not create + */ + static AlfScrollBarWidget* create(CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + DuiNode *aNode=NULL, + const char* aFilePath=NULL, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Virtual Destructor. + */ + virtual ~AlfScrollBarWidget(); + + // From IAlfInterfaceBase + /** + * Getter for interfaces provided by the scrollbar widget class. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + IAlfInterfaceBase* makeInterface(const IfId& aType); + + // From IAlfWidget + + /** + * Return the control + */ + CAlfWidgetControl* control() const; + + /** + * getter for the parent container. The ownership is not passed. + * @param none + * @return the parent container or NULL if the widget is the root-widget. + */ + virtual IAlfContainerWidget* parent() const; + + /** + * Setter for the control. The control is owned by the Alfred environment. + * + * @since S60 ?S60_version + * @param aControl The control for this widget. + * @param aDeletePreviousControl delete previous control.TRUE by default. + * @return void. + */ + void setControl(CAlfWidgetControl* aControl, + bool aDeletePreviousControl = true); + + /** + * Gets the model. + */ + IAlfModel* model(); + + /** + * Sets the model. + + * @return void. + */ + void setModel(IAlfModel* aModel, bool /*param*/); + + /** + * Return the widget name + */ + const char* widgetName() const; + + /** + * sets the focus to the child. + + * @return void. + */ + void setChildFocus(bool /*aFocus*/); + + + + /** + * Sets the presentation for the widget using presentation XML file. + + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + virtual void setPresentation(const char* aFilePath); + + /** + * Sets whether or not tactile feedback is enabled. + * + * @param aFlag Whether or not tactile is enabled. + */ + void enableTactile(bool aFlag); + + /** + * Returns the state of tactile feedback whether it is enabled/disabled. + * + */ + bool IsTactileEnabled(); + +protected: + + /** + * C++ constructor. + * + * @param aEnv The environment for the widget. + * @param aContainer The container widget where this widget is contained. + * @param aWidgetId The name of the widget. Not Owned. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @param aCustomData Custom data. + * @param aNode Node. Not Owned. + */ + AlfScrollBarWidget(CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + DuiNode *aNode=NULL, + const char *aFilePath=NULL, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Methods to create different default elements and control of scroll bar. + * + * @param aEnv The environment for the widget. + * @return void. + */ + void constructDefault(CAlfEnv& aEnv); + + /** + * Creates the default control. + * + * @param aEnv The environment for the widget. + * @return The Control. + */ + CAlfWidgetControl *constructDefaultControl(CAlfEnv& aEnv); + +private: + + /** + * Base widget. Own. + */ + auto_ptr mWidget; + + IAlfScrollBarModel * mScrollModel; + CAlfWidgetControl * mScrollControl; + }; // class AlfScrollBarWidget + + } // namespace Alf + +#endif // C_ALFSCROLLBARWIDGET_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/alfscrollbarwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/alfscrollbarwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007-2007 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: Scroollbar Widget factory plugin header +* +*/ + +#ifndef ALF_SCROLLBARWIDGETFACTORYPLUGIN_H +#define ALF_SCROLLBARWIDGETFACTORYPLUGIN_H + +// Includes +#include +#include +#include + +namespace Alf + { + +class IfId; + + /** + * Plugin factory to create widget factory + * + * @lib alfwidgetfactory.dll + * @since S60 5.0 + */ +class AlfScrollBarWidgetFactoryPlugin: public IAlfFactoryPlugin + { + +public: + + /** + * Two-phased Symbian constructor. + */ + static AlfScrollBarWidgetFactoryPlugin* NewL(); + + /** + * Destructor + */ + virtual ~AlfScrollBarWidgetFactoryPlugin(); + + // from IAlfFactoryPlugin + + /** + * Create factory product. + * @since Series 60 5.0 + * @param aProduct Product to create. + * @param aInitData Initialization data for product + * @return Instance or NULL + */ + IAlfInterfaceBase* createProduct ( const char* aProduct, void* aInitData ); + + /** + * Count available products + * + * @since S60 5.0 + * @return Product count + */ + int productCount() const; + + /** + * Fetch product info by index + * + * @param aIndex List index + * @since S60 5.0 + * @return Descriptor describing product + */ + const char* productInfo ( int aIndex ) const; + + /** + * From IAlfInterfaceBase. + * Creates interface based on the given type. + */ + IAlfInterfaceBase* makeInterface ( const IfId& aType ); + }; + + } // namespace Alf + + /** + * Exported factory function required by ECOM-framework + */ + OSN_IMPORT const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ); + +#endif //ALF_SCROLLBARWIDGETFACTORYPLUGIN_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/inc/ialfscrollbarbaseelementinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/inc/ialfscrollbarbaseelementinternal.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2007 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: interface for the scrollbar base element internal functions. +* +*/ + +#ifndef I_ALFSCROLLBARBASEELEMENTINTERNAL_H +#define I_ALFSCROLLBARBASEELEMENTINTERNAL_H + +//Widget Model include +#include + +//Toolkit include +#include + +namespace Alf + { + +/** + * @namespace alfscrollbarbaseelementinternal + * + * ident specifies the unique identifier for the scrollbar base-element + * internal interface. + */ +namespace alfscrollbarbaseelementinternal + { + static const IfId ident = + { + 0,"scrollbarbaseelementinternal" + }; + } + +/** + * An internal interface to be used by custom scrollbar base element writer. + * + * An interface which should be implemented by all the base elements of + * scrollbar (e.g. AlfScrollBarDefaltBaseElement, AlfScrollBarArrowBAseElement, + * AlfScrollBarDefaltLctBaseElement). The interface is exported for the + * developers who wants to create their custom scrollbar base element. + * The functions of this interface are not supposed to be called by scrollbar + * widget users directly. These functions are called by different part of + * scrollbar widget (e.g. scrollbar control, long tap pointer event timer). + * + */ +class IAlfScrollBarBaseElementInternal : public IAlfInterfaceBase + { + +public: + + /** + * Getter for the type identifier of this interface. + * Usage: + * @code + * IAlfElement* element; + * IAlfScrollBarBaseElementInternal* elementInternal = + * static_cast ( + * element->makeInterface (IAlfScrollBarBaseElementInternal::type() ) ); + * @endcode + * @see \link IAlfInterfaceBase \endlink for + * \link IAlfInterfaceBase::makeInterface \endlink + * The above code provides all the interfaces of ScrollBar base element. + * @since S60 ?S60_version + * @return Identifier of this interface. + */ + static inline const IfId& type() + { + return alfscrollbarbaseelementinternal :: ident; + } + + /** + * baseLayoutSizeChanged. + * This function is called by scrollbar control to notify scrollbar base + * element the base layout size has been changed ( and so the base element + * should relayout its internal visualization). + * + * @since S60 ?S60_version + */ + virtual void baseLayoutSizeChanged()=0; + + /** + * Send the corresponding Custom events to the scrollbar eventhandlers + * according to the visual clicked. + * + */ + virtual bool processPointerEvent(TAlfEvent * aPntrEvent)=0; + + /** + * creates the visualization + * + */ + virtual void createVisualization() = 0; + + /** + * Destroys the visualization + * + */ + virtual void updateVisualization() = 0; + + /** + * updates the visualization + * + */ + virtual void destroyVisualization() = 0; + + /** + * Returns pointer to AlfScrollBarModel + */ + virtual void initializeScrollModel() = 0; + + /** + * Handles Longtap event + */ + virtual AlfEventStatus handleLongTapEvent() = 0; + + /** + *virtual Destructor. + * + */ + virtual ~IAlfScrollBarBaseElementInternal() {} + + }; // end of class IAlfScrollBarBaseElementInternal + + } // end of namespace Alf + +#endif // I_ALFSCROLLBARBASEELEMENTINTERNAL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/20010105.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/20010105.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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: Scrollbar widget Resource file +* +*/ + +#include +#include "alf/alfecompluginfactoryuid.rh" + + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x20010105; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20010106; + version_no = 1; + display_name = ""; + default_data = "scrollbarwidget||scrollbarmodel||scrollbardefaultbaseelement"; + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbarcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbarcontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,267 @@ +/* +* Copyright (c) 2007, 2008 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: Control Implementation with utilities for scrollbar widget. +* +*/ + +// Toolkit includes +#include +#include +#include + +// Widget model includes +#include +#include + +// Widget includes +#include +#include "ialfscrollbarbaseelementinternal.h" + +// Internal includes +#include "alfscrollbarcontrol.h" +#include "alfscrollbarwidget.h" + + +// namespaces +using namespace osncore; +using namespace alfscrollbarwidget; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarControl::AlfScrollBarControl(CAlfEnv& aEnv) : + CAlfWidgetControl(aEnv) + { + mLayoutHeight = -1; //this means that the first draw is yet to happen. + mLayoutWidth = -1; //this means that the first draw is yet to happen. + disableState(IAlfWidgetControl::Focusable); + mTactilefdbInstance = NULL; + mDragTactileFeedbackStarted = false; + mEnableTactile = false; // Next statement will make it true + EnableTactileFeedback(true); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarControl::~AlfScrollBarControl() + { + } + +// --------------------------------------------------------------------------- +// +// enableTactileFeedback +// --------------------------------------------------------------------------- +// +void AlfScrollBarControl::EnableTactileFeedback(bool aEnabled) + { + if (!mTactilefdbInstance) + { + mEnableTactile = aEnabled; + mTactilefdbInstance = MTouchFeedback::Instance(); + } + } + +//----------------------------------------------------------------------------- +// +// TouchTactileEffectOnTouch +//----------------------------------------------------------------------------- + +void AlfScrollBarControl::TactileEffectOnTouchandHold() + { + if (mTactilefdbInstance) + { + mTactilefdbInstance->InstantFeedback(ETouchFeedbackSlider); + } + } + +//------------------------------------------------------------------------------- +// +// +//-------------------------------------------------------------------------------- + +void AlfScrollBarControl::TactileEffectOnDrag(TAlfEvent& aEvent) +{ + if (mTactilefdbInstance) + { + CCoeControl* ccoecntrl = static_cast(Display()->ObjectProvider()); + TInt intensity = 50; + TTimeIntervalMicroSeconds32 timespan = 400000; + mTactilefdbInstance->StartFeedback(ccoecntrl,ETouchContinuousSlider,&aEvent.PointerEvent(),intensity,timespan); + mDragTactileFeedbackStarted = true; + } +} + +//------------------------------------------------------------------------------- +// +// TouchTactileEffectOnRelease +//-------------------------------------------------------------------------------- +// +void AlfScrollBarControl::TactileEffectOnRelease() +{ + if (mTactilefdbInstance) + { + if ( mDragTactileFeedbackStarted ) + { + // Touch Release on Thumb after drag + CCoeControl* ccoecntrl = static_cast(Display()->ObjectProvider()); + mTactilefdbInstance->StopFeedback(ccoecntrl); + mDragTactileFeedbackStarted = false; + } + else + { + // Touch Release on thumb + mTactilefdbInstance->InstantFeedback(ETouchFeedbackSlider); + } + } +} + +// --------------------------------------------------------------------------- +// +// getTactileFeedbackState +// +// --------------------------------------------------------------------------- +bool AlfScrollBarControl::IsTactileFeedbackEnabled() + { + return mEnableTactile; + } + +// --------------------------------------------------------------------------- +// From Base class CAlfControl +// Notifies the owner that the layout of a visual has been recalculated. +// Called only when the EAlfVisualFlagLayoutUpdateNotification flag has +// been set for the visual. +// --------------------------------------------------------------------------- +// +void AlfScrollBarControl::VisualLayoutUpdated(CAlfVisual& aVisual) + { + if((mLayoutWidth == -1 && roundFloatToInt( + aVisual.Size().ValueNow().iX) == 0) || + (mLayoutHeight == -1 && roundFloatToInt( + aVisual.Size().ValueNow().iY) == 0)) + { + return; /*No size assigned yet*/ + } + else + { + //do nothing + } + + if(mLayoutWidth == roundFloatToInt(aVisual.Size().ValueNow().iX) && + mLayoutHeight == roundFloatToInt(aVisual.Size().ValueNow().iY)) + { + //return; /* No change in layout size */ + } + else + { + //do nothing + } + + mLayoutWidth = roundFloatToInt(aVisual.Size().ValueNow().iX); + mLayoutHeight = roundFloatToInt(aVisual.Size().ValueNow().iY); + IAlfElement* baseelement = findElement ("BaseElement"); + IAlfScrollBarBaseElementInternal* elementInternal = NULL; + if(baseelement) + { + elementInternal = + static_cast ( + baseelement->makeInterface(IAlfScrollBarBaseElementInternal::type())); + } + else + { + // do nothing + } + + if(elementInternal) + { + elementInternal->baseLayoutSizeChanged(); + } + else + { + //do nothing + } + } + +// --------------------------------------------------------------------------- +// Returns top level layout. +// --------------------------------------------------------------------------- +// +CAlfLayout* AlfScrollBarControl::ContainerLayout( + const CAlfControl* /*aConnected*/) const + { + //Return the root layout of the control + return(static_cast (&Visual(0))); + } + +// --------------------------------------------------------------------------- +// From base class CAlfWidgetControl +// Handle Alfred events. +// --------------------------------------------------------------------------- +// +AlfEventStatus AlfScrollBarControl::handleEvent( const TAlfEvent& aEvent ) + { + IAlfElement *base = findElement("BaseElement"); + + if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventMissedPointerUp) + { + if(base) + { + IAlfWidgetEventHandler* element = + static_cast ( + base->makeInterface(IAlfWidgetEventHandler::type())); + if(element) + { + element->offerEvent(*this,aEvent); + } + + } + } + } + else if(aEvent.IsPointerEvent()) + { + // if the type of base element is scrollbardefaultbaseelement, then + // convert the event to custom event + if(base) + { + + if(base->makeInterface( + IAlfScrollBarDefaultBaseElement::type()) != NULL) + { + TAlfEvent customevent(EEventScrollBarClicked,(TInt )&aEvent); + return CAlfWidgetControl::processEvent(customevent); + } + else // other elements (like AlfElement) dont understand custom events + { // Let them handle the original event in their own way + return CAlfWidgetControl::handleEvent(aEvent); + } + } + } + //ScrollBar should not handle any key event + else + { + return EEventNotHandled; + } + + return EEventNotHandled; + } + + }//End of namespace Alf +//End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbardefaultbaseelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbardefaultbaseelement.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1355 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + +//Toolkit Includes +#include +#include +#include +#include +//AknLayout2 includes +#include + +// Alfred Client includes +#include +#include + +//Widget Model Includes +#include +#include "alf/alfelement.h" +#include +#include +#include + +//scrollbar widget includes +#include +#include "alfscrollbardefaultbaseelement.h" +#include "alfscrollbarwidget.h" +#include "alfscrollbarcontrol.h" +#include "alfscrollbarmodel.h" +#include "alfscrollbarlongtaptimer.h" + +#include + +enum + { + EReleased, + ETrackPressed, + EThumbPressed + }; + +// EPSILON is an small constant used to compare two real values +const float KEpsilon = 0.000001; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// A function to compare two real values. The difference less than aEpsilon +// is assumed negligible. +// --------------------------------------------------------------------------- +// +inline int realCompare(float aReal1, float aReal2, float aEpsilon) + { + if (Abs(aReal1-aReal2) < aEpsilon) + { + return 0; + } + else if ((aReal1-aReal2) > 0) + { + return 1; + } + else + { + return -1; + } + }; + +struct ScrollBarBaseElementData + { + TOperation mOperation; // Thumb Drag + CAlfVisual* mVisual; // Hit visual + TPoint mDragPoint; // Current pointer value + TPoint mLongTapPos; // Long Tap Point + int mDragStartStep; // Value of view start position when drag starts + int mCurrentState; // track or thumb clicked state indicator + bool mLongTapStarted; // Long Tap Timer started ( true if started) + + int mViewLength; // For avoiding thumb length calculation + // everytime when model data changes + // Stores current viewLength + + int mTotalLength; // For avoiding thumb length calculation + // everytime when model data changes + // Stores current spanLength + + float mWidgetOpacity; // default value =1.0. + float mThumbOpacity; // default value =1.0. thumb will eventually have + // opacity=iWidgetOpacity*iThumbOpacity. + + int mThumbAnimationTime; // thumb animation time in milliseconds. + float mThumbLength; // Length of scrollbar thumb + float mThumbMinLength; // Minimum Length of thumb + float mThumbMaxLength; // Maximum Length of thumb + float mStepSize; // Step Size + bool mThumbSizeChanged; // flag to indicate whether thumbSize is Changed. + int mExtendedTouch; // extended area width. + AlfScrollBarModel* mScrollbarModel; // Pointer to scrollbar model + + CAlfLayout* mRootLayout ; // Layouts and visuals + CAlfLayout* mTrackLayout ; + CAlfLayout* mExtendedTrackLayout; + CAlfLayout* mThumbLayout ; + CAlfLayout* mExtendedThumbLayout; + + CAlfImageVisual* mTrackTopImage ; + CAlfImageVisual* mTrackMiddleImage ; + CAlfImageVisual* mTrackEndImage ; + + CAlfImageVisual* mThumbTopImage ; + CAlfImageVisual* mThumbMiddleImage ; + CAlfImageVisual* mThumbEndImage ; + };//End of struct ScrollBarBaseElementData + +struct ScrollbarThumbLCTData + { + TInt left; //used to specify left value + TInt top; //used to specify top value + TInt right; //used to specify right value + TInt bottom; //used to specify bottom value + TInt height; //used to specify height value + TInt width; //used to specify width value + }; + +// --------------------------------------------------------------------------- +// C++ default constructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarDefaultBaseElement::AlfScrollBarDefaultBaseElement( + CAlfWidgetControl& aControl, + const char* aName, + DuiNode* /*mNode*/, + AlfCustomInitDataBase* /*aCustomData*/) + : mData(NULL) + { + try + { + // Base class (AlfElement) construct + construct(aControl, aName); + + mLongTapTimer.reset( + new (EMM) AlfScrollBarLongTapTimer(this)); + + mIsLongTapObserverSet=EFalse; + //For Imperative construct + createDefaultBaseElement(); + } + catch(AlfException& e) + { + aControl.removeElement(*this); + throw; + } + // AlfScrollBarDefaultBaseElement is an event handler too so it + // should be added to the control + aControl.addEventHandler(this); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +AlfScrollBarDefaultBaseElement::~AlfScrollBarDefaultBaseElement() + { + + if(mData) + { + delete mData; + } + else + { + + } + if(mLCTData) + { + delete mLCTData; + } + else + { + + } + }//End of Destructor + +//-------------------------------------------------------------------------- +// APIs from the IAlfScrollBarDefaultBaseElement for controlling the +// visualization of the scrollbar +//-------------------------------------------------------------------------- + + +// --------------------------------------------------------------------------- +// Sets the thumb animation time. +// @aTime : Time in miliseconds +// @exception : for aTime less then O.0 miliseconds +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setThumbAnimationTime ( int aTime ) + { + // Sanity check + if (aTime < 0) + { + ALF_THROW(AlfException, EInvalidArgument, "AnimationTime is invalid"); + } + else + { + // do nothing + } + + if(mData->mThumbAnimationTime != aTime) + { + mData->mThumbAnimationTime = aTime; + } + } + +// --------------------------------------------------------------------------- +// From class IAlfScrollBarWdget. +// --------------------------------------------------------------------------- +// +int AlfScrollBarDefaultBaseElement::getThumbAnimationTime() const + { + return mData->mThumbAnimationTime; + } + +// --------------------------------------------------------------------------- +// Sets opacity value for the Thumb. +// Thumb opacity is relative to the track. +// @param : aOpacity float value between 0.0 to 1.0 +// @exception : value of aOpacity more than 1.0 and less than 0.0 +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setThumbOpacity (float aOpacity) + { + // Sanity check + if (realCompare(aOpacity, 0.0, KEpsilon) < 0 + || realCompare(aOpacity, 1.0, KEpsilon) > 0) + { + ALF_THROW(AlfException, EInvalidArgument, "Opacity is invalid"); + } + else + { + // do nothing + } + // if there is a change, update the visualization + if (aOpacity != mData->mThumbOpacity) + { + mData->mThumbOpacity = aOpacity; + const TAlfTimedValue opacity(mData->mThumbOpacity * mData->mWidgetOpacity); + if(mData->mThumbLayout) + { + mData->mThumbLayout->SetOpacity(opacity); + control().Visual(0).UpdateChildrenLayout(); + } + } + }//End of setThumbOpacity + +// --------------------------------------------------------------------------- +// Returns Thumb opacity is relative to the track. +// --------------------------------------------------------------------------- +// +float AlfScrollBarDefaultBaseElement::getThumbOpacity() const + { + return mData->mThumbOpacity; + } + +// --------------------------------------------------------------------------- +// Sets opacity value for the widget. +// +// @param : aOpacity float value between 0.0 to 1.0 +// @exception : value of aOpacity more than 1.0 and less than 0.0 +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setOpacity (float aOpacity) + { + // Sanity check + if (realCompare(aOpacity, 0.0, KEpsilon) < 0 + || realCompare(aOpacity, 1.0, KEpsilon) > 0) + { + ALF_THROW(AlfException, EInvalidArgument, "Opacity is invalid"); + } + else + { + // do nothing + } + // if there is a change, update the visualization + if (aOpacity != mData->mWidgetOpacity) + { + mData->mWidgetOpacity = aOpacity; + const TAlfTimedValue opacity(mData->mWidgetOpacity); + if(mData->mTrackLayout) + { + mData->mRootLayout->SetOpacity(opacity); + control().Visual(0).UpdateChildrenLayout(); + } + } + }//End of setThumbOpacity + +// --------------------------------------------------------------------------- +// Returns Widget opacity is relative to the track. +// --------------------------------------------------------------------------- +// +float AlfScrollBarDefaultBaseElement::getOpacity() const + { + return mData->mWidgetOpacity; + } + +//-------------------------------------------------------------------------- +// APIs from the IAlfScrollBarBaseElement +//-------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// Gets called when the parent layout is relayouted. +// resets all the anchor points and updates the visualization +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::baseLayoutSizeChanged() + { + initializeLayout(); + } + +// --------------------------------------------------------------------------- +// processPointerEvent generates custom events +// according the focus visual . +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::processPointerEvent(TAlfEvent * aPntrEvent) + { + // retrieve pointer event (NULL check not required here) + // Get the hit visual + CAlfVisual *focusvisual =aPntrEvent->Visual(); + + if ( aPntrEvent->IsPointerEvent() ) + { + if (aPntrEvent->PointerEvent().iType == TPointerEvent::EButton1Down) + { + bool ret = handlePointerDownEvent(aPntrEvent); + return ret; + } + else if (aPntrEvent->PointerEvent().iType == TPointerEvent::EDrag) + { + if(!mData->mOperation) + { + // Drag during tap and hold on track + if(mIsLongTapObserverSet) + { + mData->mLongTapPos=aPntrEvent->PointerEvent().iParentPosition; + } + else + { + //Do Nothing. + } + } + else + { + // Drag on thumb + if(mIsLongTapObserverSet && + mData->mVisual && (isScrollbarThumbVisual(focusvisual)) ) + { + mData->mLongTapPos= aPntrEvent->PointerEvent().iParentPosition ; + } + else + { + // Do nothing + } + int dist = aPntrEvent->PointerEvent().iParentPosition.iY - mData->mDragPoint.iY; + int steps = ceil(dist / mData->mStepSize) + mData->mDragStartStep; + + // checking steps to avoid negative value, incase of max scrollbar length + if( steps > mData->mScrollbarModel->getTotalLength() - mData->mScrollbarModel->getViewLength()) + { + steps = mData->mScrollbarModel->getTotalLength() - mData->mScrollbarModel->getViewLength(); + } + else if(steps < 0 ) + { + steps = 0; + } + if(steps != mData->mScrollbarModel->getViewStartPosition()) + { + // send tactile sensitive event + //control().processEvent(TAlfEvent(EEventScrollBarDrag)); + TAlfEvent customevent(EEventDragVertical,(TInt )steps); + control().processEvent(customevent); + } + // Tactile Feedback for Thumb drag + AlfScrollBarControl& slbrcntrl = static_cast(control()); + slbrcntrl.TactileEffectOnDrag(*aPntrEvent); + } + } + + else if(aPntrEvent->PointerUp() ) + { + mData->mLongTapStarted = false; + handlePointerUpEvent(); + } + else + { + //Do Nothing. + } + } + + return true; + }//End of processPointerEvent + +void AlfScrollBarDefaultBaseElement::createVisualization() + { + initializeScrollModel(); + CAlfWidgetControl *ctrl = &control(); + + // Create Root Layout + mData->mRootLayout = CAlfLayout::AddNewL(*((CAlfControl*)ctrl),NULL); + mData->mRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + mData->mRootLayout->SetFlag( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + + // Create Track Layout + mData->mTrackLayout = CAlfLayout::AddNewL(*((CAlfControl*)ctrl),mData->mRootLayout); + mData->mTrackLayout->SetFlag( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + mData->mExtendedTrackLayout = CAlfLayout::AddNewL(*((CAlfControl*)ctrl),mData->mTrackLayout); + + if(mData->mTrackLayout) + { + mData->mTrackTopImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mTrackLayout); + mData->mTrackMiddleImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mTrackLayout); + mData->mTrackEndImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mTrackLayout); + + if(mData->mTrackTopImage && + mData->mTrackMiddleImage && + mData->mTrackEndImage) + { + setTrackImage(); + } + + // Create Thumb Visuals + mData->mThumbLayout = CAlfLayout::AddNewL(*((CAlfControl*)ctrl), + mData->mRootLayout); + mData->mThumbLayout->SetFlag( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + mData->mExtendedThumbLayout = CAlfLayout::AddNewL(*((CAlfControl*)ctrl), + mData->mThumbLayout); + + if(mData->mThumbLayout) + { + mData->mThumbTopImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mThumbLayout); + mData->mThumbMiddleImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mThumbLayout); + mData->mThumbEndImage = CAlfImageVisual::AddNewL( + *((CAlfControl*)ctrl),mData->mThumbLayout); + + if(mData->mThumbTopImage && + mData->mThumbMiddleImage && + mData->mThumbEndImage) + { + setThumbImage(); + } + } + } + } + +void AlfScrollBarDefaultBaseElement::updateVisualization() + { + calculateStepSizeAndThumbLength(); + if(mData->mViewLength != mData->mScrollbarModel->getViewLength() || mData->mTotalLength != mData->mScrollbarModel->getTotalLength()) + { + mData->mViewLength = mData->mScrollbarModel->getViewLength(); + mData->mTotalLength = mData->mScrollbarModel->getTotalLength(); + initializeThumbLayout(); + } + TAlfRealPoint thumbPos; + thumbPos.iX = mData->mThumbLayout->Pos().iX.ValueNow(); + thumbPos.iY = ceil(mData->mStepSize * mData->mScrollbarModel->getViewStartPosition()); + mData->mThumbLayout->SetPos(thumbPos,mData->mThumbAnimationTime); + } + +void AlfScrollBarDefaultBaseElement::destroyVisualization() + { + mData->mRootLayout->RemoveAndDestroyAllD(); + delete mData; + delete mLCTData; + createDefaultBaseElement(); + } + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Getter for interfaces provided by the scrollbar widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfScrollBarDefaultBaseElement::makeInterface( + const IfId& aType) + { + UString param (aType.mImplementationId); + if (param == + IAlfScrollBarDefaultBaseElement::type().mImplementationId) + { + return static_cast(this); + } + else if (param == IAlfWidgetEventHandler::type().mImplementationId) + { + return static_cast(this); + } + + else if (param == + IAlfScrollBarBaseElementInternal::type().mImplementationId) + { + return static_cast(this); + } + else + { + //do nothing + } + return AlfElement::makeInterface(aType); + } + +// --------------------------------------------------------------------------- +// handles the pointerDown event +// +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::handlePointerDownEvent(TAlfEvent * aPntrEvent) + { + CAlfVisual * focusvisual = aPntrEvent->Visual(); + AlfEventStatus result = EEventNotHandled; + + if (focusvisual) + { + mData->mVisual = focusvisual; + + // Register with the Roster to receive drag Event + control().Display()->Roster().SetPointerEventObservers( + EAlfPointerEventReportDrag ,control()); + + if(!mData->mOperation) + { + mIsLongTapObserverSet = ETrue; + mData->mLongTapPos = aPntrEvent->PointerEvent().iParentPosition; + mData->mLongTapStarted = true; + control().processEvent(TAlfEvent(EEventScrollBarTouchDown)); + mLongTapTimer->Start(); + } + + // Pointer down on track + if (isScrollbarTrackVisual(focusvisual)) + { + mData->mLongTapStarted = true; + return trackVisualHit(focusvisual); + } + + // Pointer down on thumb + else if (isScrollbarThumbVisual(focusvisual)) + { + if(!mData->mOperation) + { + initializeThumbDragData( aPntrEvent->PointerEvent().iParentPosition); + AlfScrollBarControl& slbrcntrl = static_cast(control()); + slbrcntrl.TactileEffectOnTouchandHold(); + } + result = EEventHandled; + } + } + return result; + } + +// --------------------------------------------------------------------------- +// Sends drag Up or Down event, according to the hit position +// on track +// --------------------------------------------------------------------------- +// +AlfEventStatus AlfScrollBarDefaultBaseElement::trackVisualHit(CAlfVisual * /*aHitVisual*/) + { + //Get Co-Ordinates of the click event + //Find the thumb Anchor Layout. + TAlfTimedPoint thumbVisPos = mData->mThumbLayout->Pos(); + TAlfTimedPoint thumbVisSize =mData->mThumbLayout->Size(); + TAlfRealRect rct= mData->mTrackLayout->DisplayRect() ; + //Check if click was above/below of thumb + if (mData->mLongTapPos.iY - rct.iTl.iY < thumbVisPos.iY.ValueNow()) + { + if(mData->mLongTapStarted) + { + //control().processEvent(TAlfEvent(EEventScrollBarDrag)); + control().processEvent(TAlfEvent (EEventScrollPageUp)); + } + } + else if (mData->mLongTapPos.iY - rct.iTl.iY > (thumbVisPos.iY.ValueNow() + + thumbVisSize.iY.ValueNow()) ) + { + if(mData->mLongTapStarted) + { + //control().processEvent(TAlfEvent(EEventScrollBarDrag)); + control().processEvent(TAlfEvent(EEventScrollPageDown)); + } + } + else + { + if(mIsLongTapObserverSet) + { + // Stop the long tap timer + mLongTapTimer->Stop(); + mData->mLongTapStarted = false; + //mIsLongTapObserverSet = EFalse; + } + else + { + //Do Nothing. + } + } + return EEventHandled; + } + +// --------------------------------------------------------------------------- +// handles the pointerUp event +// +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::handlePointerUpEvent() + { + // if thumb or track is clicked, change the graphics + if(mData->mCurrentState == ETrackPressed || mData->mCurrentState == EThumbPressed) + { + mData->mCurrentState = EReleased; + changeGraphics(); + } + + if(mData->mOperation) + { + //Somehow missed the Up event + stopDrag(NULL,0); + AlfScrollBarControl& slbrcntrl = static_cast(control()); + slbrcntrl.TactileEffectOnRelease(); + } + if(mIsLongTapObserverSet) + { + // Stop the long tap timer + mLongTapTimer->Stop(); + + // Un-register with the roster for long tap events + control().Display()->Roster().SetPointerEventObservers(0, + control()); + mIsLongTapObserverSet = EFalse; + } + } + +AlfEventStatus AlfScrollBarDefaultBaseElement::handleLongTapEvent() + { + AlfEventStatus ret= EEventNotHandled; + + if (isScrollbarTrackVisual(mData->mVisual)) + { + mData->mLongTapStarted = true; + ret = trackVisualHit(mData->mVisual); + // Long tap Tactile feedback + AlfScrollBarControl& slbrcntrl = static_cast(control()); + slbrcntrl.TactileEffectOnTouchandHold(); + } + return ret; + } + +//-------------------------------------------------------------------------- +//Overriden Apis from IAlfWidgetEventHandlers +//-------------------------------------------------------------------------- +// + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::accept( + CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) const + { + // Scrollbar baseElement handles only EEventScrollBarClicked + // and EEventScrollBarClicked cusbtom events + // EEventScrollBarClicked event come from scrollbar control and + // EEventScrollBarModelChanged event comes from scrollable widget + if (aEvent.CustomParameter() == EEventScrollBarClicked || + aEvent.CustomParameter() == EEventScrollBarModelChanged) + { + return true; + } + return false; + } + +IAlfWidgetEventHandler::AlfEventHandlerType AlfScrollBarDefaultBaseElement::eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfScrollBarDefaultBaseElement::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + +AlfEventStatus AlfScrollBarDefaultBaseElement::offerEvent( + CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) + { + AlfEventStatus ret= EEventNotHandled; + // Dont do event handling incase widget & thumb opacity is zero + if(mData->mWidgetOpacity && mData->mThumbOpacity ) + { + if (aEvent.IsCustomEvent()) + { + switch(aEvent.CustomParameter()) + { + // The event is coming from scrollbale widget + case EEventScrollBarModelChanged: + { + if( mData->mScrollbarModel) + { + ScrollModelChangedEventData* scrollEventData = + (ScrollModelChangedEventData*)aEvent.CustomEventData(); + + // Change the model which intern will update visualization + mData->mScrollbarModel->changeData( + scrollEventData->mSpan, + scrollEventData->mViewLength, + scrollEventData->mViewStartPos); + ret=EEventHandled; + } + } + break; + + case EEventMissedPointerUp: + { + mData->mLongTapStarted = false; + ret=EEventHandled; + handlePointerUpEvent(); + } + break; + + case EEventScrollBarClicked: + { + ret = handleScrollBarClickedEvent(aEvent); + } + break; + + default: + break; + } + } + } + return ret; + } + + AlfEventStatus AlfScrollBarDefaultBaseElement::handleScrollBarClickedEvent( + const TAlfEvent& aEvent ) + { + AlfEventStatus ret= EEventNotHandled; + TAlfEvent * pntrEvent=(TAlfEvent *)aEvent.CustomEventData(); + if(pntrEvent) + { + // Get the hit visual + CAlfVisual *focusvisual = pntrEvent->Visual(); + if(focusvisual && + pntrEvent->PointerEvent().iType == TPointerEvent::EButton1Down) + { + // check if the click is made on thumb + if (isScrollbarThumbVisual(focusvisual)) + { + mData->mCurrentState = EThumbPressed; + // Change the graphics to pressed one + changeGraphics(); + } + else if (isScrollbarTrackVisual(focusvisual)) + { + mData->mCurrentState = ETrackPressed; + // Change the graphics to pressed one + changeGraphics(); + } + } + // Blocking event processing in case of maxthumblength, + // case 1 : revert back the graphics change incase of maxscrollbar length + if(pntrEvent->PointerUp() && mData->mScrollbarModel->getViewLength() >= mData->mScrollbarModel->getTotalLength()) + { + handlePointerUpEvent(); + } + // case 2 : process the event in all other case except max length + else if( mData->mScrollbarModel->getViewLength() != mData->mScrollbarModel->getTotalLength()) + { + processPointerEvent(pntrEvent); + } + // case2 : do nothing incase of maxscrollbar length + else + { + // do nothing + } + ret = EEventHandled; + } + else + { + ret = EEventNotHandled; + } + + return ret; + } + +void AlfScrollBarDefaultBaseElement::setActiveStates( + unsigned int /*aStates*/) + { + //do nothing + } + +// --------------------------------------------------------------------------- +// From class IAlfScrollBarBaseElementInternal. +// --------------------------------------------------------------------------- +// + +// --------------------------------------------------------------------------- +// initializes scrollbar layout +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::initializeLayout() + { + setThumbMinMaxLength(); + calculateStepSizeAndThumbLength(); + initializeTrackLayout(); + initializeThumbLayout(); + } + +// --------------------------------------------------------------------------- +// initializes scrollbar Track layout +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::initializeTrackLayout() + { + + TAknWindowLineLayout ExtendedTrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aid_size_touch_aascroll_bar(0).LayoutLine(); + // negative offset for the extended active area layout. + // Width values based on LCT data for extended touch + mData->mExtendedTouch = - (ExtendedTrackLayoutHandle.iW - + mData->mRootLayout->Size().iX.ValueNow()); + + // Create Track Visuals + if(mData->mTrackLayout) + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: hc_scroll_bg_pane(0).LayoutLine(); + + // Root layout rect, parent rect for track and thumb layout + TRect rootLayoutRect(0, + 0, + mData->mRootLayout->Size().iX.ValueNow(), + mData->mRootLayout->Size().iY.ValueNow()); + + TAknLayoutRect TracklayoutRect; + TracklayoutRect.LayoutRect(rootLayoutRect, TrackLayoutHandle); + mData->mTrackLayout->SetRect(TracklayoutRect.Rect(),0.0); + + // set position and size for extended track layout + setPositionAndSize(mData->mExtendedTrackLayout, + mData->mExtendedTouch,0 , + mData->mExtendedTouch, + mData->mTrackLayout->Size().iY.ValueNow()); + + if(mData->mTrackTopImage && + mData->mTrackMiddleImage && + mData->mTrackEndImage) + { + // parent rect for track images + TRect Trackrect(0, + 0, + mData->mTrackLayout->Size().iX.ValueNow(), + mData->mTrackLayout->Size().iY.ValueNow()); + + TAknWindowLineLayout TrackTopHandle = + AknLayoutScalable_UiAccel::hc_scroll_bg_pane_g1(0).LayoutLine(); + setLCTData(Trackrect,TrackTopHandle,mData->mTrackTopImage); + + TAknWindowLineLayout TrackMiddleHandle = + AknLayoutScalable_UiAccel::hc_scroll_bg_pane_g2(0).LayoutLine(); + setLCTData(Trackrect,TrackMiddleHandle,mData->mTrackMiddleImage); + + TAknWindowLineLayout TrackEndHandle = + AknLayoutScalable_UiAccel::hc_scroll_bg_pane_g3(0).LayoutLine(); + setLCTData(Trackrect,TrackEndHandle,mData->mTrackEndImage); + } + } + } + +// --------------------------------------------------------------------------- +// initializes scrollbar Thumb layout +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::initializeThumbLayout() + { + // Create Track Visuals + if(mData->mTrackLayout) + { + if(mData->mThumbLayout) + { + // Get thumb WindowLine Layout + TAknWindowLineLayout ThumbLayoutHandle = + AknLayoutScalable_UiAccel::hc_scroll_handle_pane(0).LayoutLine(); + + // Root layout rect, parent rect for track and thumb layout + TRect rootLayoutRect(0, + 0, + mData->mRootLayout->Size().iX.ValueNow(), + mData->mRootLayout->Size().iY.ValueNow()); + + TAknLayoutRect ThumblayoutRect; + ThumblayoutRect.LayoutRect(rootLayoutRect, ThumbLayoutHandle); + + // set thumb height and thumb start position from model + mLCTData->height = mData->mThumbLength; + + mLCTData->top = + ceil(mData->mStepSize * mData->mScrollbarModel->getViewStartPosition()); + + setPositionAndSize(mData->mThumbLayout, + ThumblayoutRect.Rect().iTl.iX, + mLCTData->top, + ThumblayoutRect.Rect().Size().iWidth, + mLCTData->height); + // Setting position and size for extended thumb layout + setPositionAndSize(mData->mExtendedThumbLayout , + mData->mExtendedTouch , + 0, + mData->mExtendedTouch, + mLCTData->height); + + if(mData->mThumbTopImage && + mData->mThumbMiddleImage && + mData->mThumbEndImage) + { + // parent rect for thumb images + TRect ThumbRect(0, + 0, + mData->mThumbLayout->Size().iX.ValueNow(), + mData->mThumbLayout->Size().iY.ValueNow()); + + TAknWindowLineLayout ThumbTopHandle = + AknLayoutScalable_UiAccel::hc_scroll_handle_pane_g1(0).LayoutLine(); + setLCTData(ThumbRect,ThumbTopHandle,mData->mThumbTopImage); + + TAknWindowLineLayout ThumbMiddleHandle = + AknLayoutScalable_UiAccel::hc_scroll_handle_pane_g2(0).LayoutLine(); + setLCTData(ThumbRect,ThumbMiddleHandle,mData->mThumbMiddleImage); + + TAknWindowLineLayout ThumbEndHandle = + AknLayoutScalable_UiAccel::hc_scroll_handle_pane_g3(0).LayoutLine(); + setLCTData(ThumbRect,ThumbEndHandle,mData->mThumbEndImage); + } + } + } + } + +// --------------------------------------------------------------------------- +// sets LCT Data (position and size) for the visual +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setLCTData(const TRect& aRect , + TAknWindowLineLayout& aWindowLineLayout, + CAlfVisual * aVisual) + { + TAknLayoutRect layoutRect; + layoutRect.LayoutRect(aRect, aWindowLineLayout); + + setPositionAndSize(aVisual,layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY, + layoutRect.Rect().Size().iWidth,layoutRect.Rect().Size().iHeight); + } + +// --------------------------------------------------------------------------- +// sets position and size for the visual +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setPositionAndSize(CAlfVisual * aVisual, + int aXVal,int aYVal, + int aWidth,int aHeight) + { + TAlfRealPoint trackTopPnt(aXVal,aYVal); + TAlfRealSize trackTopSize(aWidth,aHeight); + aVisual->SetPos(trackTopPnt,0); + aVisual->SetSize(trackTopSize,0); + } + +// --------------------------------------------------------------------------- +// initializes scrollbar model pointer for further reference +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::initializeScrollModel() + { + // Store the ScrollBar Model Pointer; + IAlfWidgetFactory& widgetFactory =AlfWidgetEnvExtension::widgetFactory(control().Env()); + AlfScrollBarWidget* wdgt = static_cast(widgetFactory.findWidget(control().widget()->widgetName())); + //Get model pointer + IAlfScrollBarModel* model = static_cast(wdgt->model()); + mData->mScrollbarModel = static_cast(model); + } + + +// --------------------------------------------------------------------------- +// Set images for the track +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setTrackImage() + { + TInt flags = EAlfTextureFlagSkinContent; + flags |= EAlfTextureFlagAutoSize; + + // Create skin Image + TAlfImage trackTopImage(KAknsIIDQsnCpScrollBgTop,TSize(0,0), + EAspectRatioNotPreserved,NULL, + -1,-1,0.f,0.f,1.f,1.f, + (TAlfTextureFlags)flags); + TAlfImage trackMiddleImage(KAknsIIDQsnCpScrollBgMiddle, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage trackEndImage(KAknsIIDQsnCpScrollBgBottom, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage trackTopPressedImage(KAknsIIDQsnCpScrollBgTopPressed,TSize(0,0), + EAspectRatioNotPreserved,NULL, + -1,-1,0.f,0.f,1.f,1.f, + (TAlfTextureFlags)flags); + TAlfImage trackMiddlePressedImage(KAknsIIDQsnCpScrollBgMiddlePressed, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage trackEndPressedImage(KAknsIIDQsnCpScrollBgBottomPressed, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + + // Set Image on visuals + mData->mTrackTopImage->SetImage(trackTopImage); + mData->mTrackMiddleImage->SetImage(trackMiddleImage); + mData->mTrackEndImage->SetImage(trackEndImage); + mData->mTrackTopImage->SetSecondaryImage(trackTopPressedImage); + mData->mTrackMiddleImage->SetSecondaryImage(trackMiddlePressedImage); + mData->mTrackEndImage->SetSecondaryImage(trackEndPressedImage); + }//End of setImage + +// --------------------------------------------------------------------------- +// Set images for the thumb +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setThumbImage() + { + TInt flags = EAlfTextureFlagSkinContent; + flags |= EAlfTextureFlagAutoSize; + + TAlfImage thumbTopImage(KAknsIIDQsnCpScrollHandleTop,TSize(0,0), + EAspectRatioNotPreserved,NULL, + -1,-1,0.f,0.f,1.f,1.f, + (TAlfTextureFlags)flags); + TAlfImage thumbMiddleImage(KAknsIIDQsnCpScrollHandleMiddle, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage thumbEndImage(KAknsIIDQsnCpScrollHandleBottom, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage thumbTopPressedImage(KAknsIIDQsnCpScrollHandleTopPressed,TSize(0,0), + EAspectRatioNotPreserved,NULL, + -1,-1,0.f,0.f,1.f,1.f, + (TAlfTextureFlags)flags); + TAlfImage thumbMiddlePressedImage(KAknsIIDQsnCpScrollHandleMiddlePressed, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + TAlfImage thumbEndPressedImage(KAknsIIDQsnCpScrollHandleBottomPressed, TSize(0,0), + EAspectRatioNotPreserved, NULL, + -1, -1, 0.f, 0.f, 1.f, 1.f, + (TAlfTextureFlags)flags); + + mData->mThumbTopImage->SetImage(thumbTopImage); + mData->mThumbMiddleImage->SetImage(thumbMiddleImage); + mData->mThumbEndImage->SetImage(thumbEndImage); + mData->mThumbTopImage->SetSecondaryImage(thumbTopPressedImage); + mData->mThumbMiddleImage->SetSecondaryImage(thumbMiddlePressedImage); + mData->mThumbEndImage->SetSecondaryImage(thumbEndPressedImage); + + }//End of setImage +// --------------------------------------------------------------------------- +// change images for the track +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::changeTrackImage(bool aPressed) + { + if(aPressed) + { + TAlfTimedValue alpha(1.0, 0.0); + mData->mTrackTopImage->SetSecondaryAlpha(alpha); + mData->mTrackMiddleImage->SetSecondaryAlpha(alpha); + mData->mTrackEndImage->SetSecondaryAlpha(alpha); + } + else + { + TAlfTimedValue alpha(0.0, 0.0); + mData->mTrackTopImage->SetSecondaryAlpha(alpha); + mData->mTrackMiddleImage->SetSecondaryAlpha(alpha); + mData->mTrackEndImage->SetSecondaryAlpha(alpha); + + } + } +// --------------------------------------------------------------------------- +// change images for the thumb +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::changeThumbImage(bool aPressed) + { + if(aPressed) + { + TAlfTimedValue alpha(1.0,0.0); + mData->mThumbTopImage->SetSecondaryAlpha(alpha); + mData->mThumbMiddleImage->SetSecondaryAlpha(alpha); + mData->mThumbEndImage->SetSecondaryAlpha(alpha); + } + else + { + TAlfTimedValue alpha(0.0,0.0); + mData->mThumbTopImage->SetSecondaryAlpha(alpha); + mData->mThumbMiddleImage->SetSecondaryAlpha(alpha); + mData->mThumbEndImage->SetSecondaryAlpha(alpha); + } + } +// --------------------------------------------------------------------------- +// calculates Step size and Thumb length +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::calculateStepSizeAndThumbLength() + { + int totalLength = mData->mScrollbarModel->getTotalLength(); + int viewLength = mData->mScrollbarModel->getViewLength(); + int viewStartPos = mData->mScrollbarModel->getViewStartPosition(); + + TAlfTimedPoint size = mData->mRootLayout->Size(); + mData->mThumbLength = ((float)viewLength / + (float)totalLength) * size.iY.ValueNow(); + + if(mData->mThumbMinLength != 0) + { + if(mData->mThumbLengthmThumbMinLength) + { + mData->mThumbLength = mData->mThumbMinLength; + } + else if(mData->mThumbLength>mData->mThumbMaxLength) + { + mData->mThumbLength = mData->mThumbMaxLength; + } + else + { + + } + } + else + { + + } + + if(totalLength != viewLength) + { + mData->mStepSize = (size.iY.ValueNow() - mData->mThumbLength) / + (totalLength - viewLength); + } + else + { + mData->mStepSize = 0.0; + } + } +// --------------------------------------------------------------------------- +// set maximum and minimum thumblength value from LCT data +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::setThumbMinMaxLength() + { + TAknWindowLineLayout ThumbMinLengthHandle = + AknLayoutScalable_UiAccel:: + aid_size_min_handle_cp002(0).LayoutLine(); + + TAknWindowLineLayout ThumbMaxLengthHandle = + AknLayoutScalable_UiAccel:: + aid_hc_size_max_handle(0).LayoutLine(); + + // Since LCT data corresponding to this is very small (20), + // we are hardcoding the value as 30,this has to be removed + // once if we get the correct LCT data + // mData->mThumbMinLength = 30; + mData->mThumbMinLength = ThumbMinLengthHandle.iH; + mData->mThumbMaxLength = mData->mRootLayout->Size().iY.ValueNow() - + ThumbMaxLengthHandle.ib; + } + +// --------------------------------------------------------------------------- +// createDefaultBaseElement, initializes class member variables +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::createDefaultBaseElement() + { + + mData = new (EMM) ScrollBarBaseElementData(); + mData->mOperation = ENop; + mData->mVisual = NULL; + mData->mDragPoint = TPoint(0,0); + mData->mLongTapPos = TPoint(0,0); + mData->mDragStartStep = 0; + mData->mViewLength = 0; + mData->mThumbLength = 0; + mData->mThumbMinLength = 0; + mData->mThumbMaxLength = 0; + mData->mStepSize = 0; + mData->mThumbSizeChanged = false; + mData->mWidgetOpacity = 1.0; + mData->mThumbOpacity = 1.0; + mData->mLongTapStarted = false; + mData->mCurrentState = EReleased; + mData->mTrackLayout = NULL; + mData->mTrackTopImage = NULL ; + mData->mTrackMiddleImage = NULL ; + mData->mTrackEndImage = NULL ; + mData->mThumbLayout = NULL ; + mData->mThumbTopImage = NULL ; + mData->mThumbMiddleImage = NULL ; + mData->mThumbEndImage = NULL ; + mData->mExtendedTouch = 0; + mData->mScrollbarModel = NULL; + mData->mThumbAnimationTime = 0; + + mLCTData = new ( EMM ) ScrollbarThumbLCTData(); + mLCTData->left=0; + mLCTData->top=0; + mLCTData->right=0; + mLCTData->bottom=0; + mLCTData->height=0; + mLCTData->width=0; + + }//End of createDefaultBaseElement + +// --------------------------------------------------------------------------- +// initializeThumbDragData +// +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::initializeThumbDragData( const TPoint& aPointerPos ) + { + if(mData->mVisual ) + { + mData->mOperation = EMoveItem; + mData->mDragPoint = aPointerPos; + mData->mDragStartStep = mData->mScrollbarModel->getViewStartPosition(); + } + else + { + // Do Nothing + } + return ETrue; + } + + +// --------------------------------------------------------------------------- +// stopDrag +// Stop Dragging +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::stopDrag( CAlfVisual* /*aHitVisual*/, + TInt /*aAnimTime*/) + { + TRAPD(err, + control().Display()->Roster().SetPointerEventObservers( + 0, + control())); + + if(err == KErrNone) + { + if(mData->mVisual) + { + mData->mVisual = NULL; + } + mData->mOperation = ENop; + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// changeGraphics +// change the skin image graphics based on the pressedState +// --------------------------------------------------------------------------- +// +void AlfScrollBarDefaultBaseElement::changeGraphics() + { + if(mData->mCurrentState == EReleased) // Normal graphics + { + changeTrackImage(false); + changeThumbImage(false); + } + else if(mData->mCurrentState == EThumbPressed || mData->mCurrentState == ETrackPressed) // Pressed graphics + { + if(mData->mCurrentState == EThumbPressed) + { + // set the index for pressed graphics (thumb and track) + changeTrackImage(true); + changeThumbImage(true); + } + else if (mData->mCurrentState == ETrackPressed) + { + // set the index for pressed graphics (track) + changeTrackImage(true); + } + } + } + +// --------------------------------------------------------------------------- +// isScrollbarTrackVisual +// checks whether the visual is scrollbar track visual or not +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::isScrollbarTrackVisual(CAlfVisual *aVisual) + { + if(aVisual == mData->mExtendedTrackLayout || + aVisual == mData->mTrackTopImage || + aVisual == mData->mTrackMiddleImage || + aVisual == mData->mTrackEndImage) + { + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// isScrollbarThumbVisual +// checks whether the visual is scrollbar thumb visual or not +// --------------------------------------------------------------------------- +// +bool AlfScrollBarDefaultBaseElement::isScrollbarThumbVisual(CAlfVisual *aVisual) + { + if(aVisual == mData->mExtendedThumbLayout || + aVisual == mData->mThumbTopImage || + aVisual == mData->mThumbMiddleImage || + aVisual == mData->mThumbEndImage) + { + return true; + } + return false; + } + + }//namespace Alf + +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbarlongtaptimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbarlongtaptimer.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 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: Timer for creating longtap event +* +*/ +#include "alfscrollbarlongtaptimer.h" +#include +#include "ialfscrollbarbaseelementinternal.h" + +const int KInitialTimeInterval = 200000; +const int KTimeInterval = 100000; + +namespace Alf + { + +//--------------------------------------------------------------------------- +// Constructor +//--------------------------------------------------------------------------- +// +AlfScrollBarLongTapTimer::AlfScrollBarLongTapTimer( + IAlfScrollBarDefaultBaseElement* aBaseElement):CActive(EPriorityStandard) + { + iTimer.CreateLocal(); + iBaseElement = aBaseElement; + CActiveScheduler::Add(this); + iState = EStopped; + } + +//--------------------------------------------------------------------------- +// Destructor +//--------------------------------------------------------------------------- +// +AlfScrollBarLongTapTimer::~AlfScrollBarLongTapTimer() + { + Stop(); + iTimer.Close(); + } +//--------------------------------------------------------------------------- +// Activates the timer. +//--------------------------------------------------------------------------- +// +void AlfScrollBarLongTapTimer::Start() + { + if (iState == ERunning) + return; + if (!IsActive()) + { + iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KInitialTimeInterval)); + SetActive(); + } + iState = ERunning; + } +//--------------------------------------------------------------------------- +// stops the timer. +//--------------------------------------------------------------------------- +// +void AlfScrollBarLongTapTimer::Stop() + { + Cancel(); + iState = EStopped; + } +//--------------------------------------------------------------------------- +// Handles an active object's request completion event. +//--------------------------------------------------------------------------- +// +void AlfScrollBarLongTapTimer::RunL() + { + IAlfScrollBarBaseElementInternal* elementInternal = + static_cast ( + iBaseElement->makeInterface(IAlfScrollBarBaseElementInternal::type())); + + if (iState == ERunning) + { + iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KTimeInterval)); + SetActive(); + } + if(elementInternal) + { + elementInternal->handleLongTapEvent(); + } + } + +//--------------------------------------------------------------------------- +// Implements cancellation of an outstanding request. +//--------------------------------------------------------------------------- +// +void AlfScrollBarLongTapTimer::DoCancel() + { + iTimer.Cancel(); + } + + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbarmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbarmodel.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,554 @@ +/* +* Copyright (c) 2007, 2008 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: Model implementation with utilities for scrollbar widget. +* +*/ +//User Includes +#include "alfscrollbarmodel.h" +#include "alfscrollbarwidget.h" + +//Widget includes +#include +#include "ialfscrollbarbaseelementinternal.h" +#include "alfscrollbardefaultbaseelement.h" + +#include +#include +#include + +namespace Alf + { + +/* + * To store data required in the model class + */ +struct ScrollbarModelDataImpl + { + int mTotalLength; + int mViewLength; + int mViewStartPosition; + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarModel::AlfScrollBarModel(IAlfVariantType* aDataSource): + mModel ( NULL ) + { + construct ( aDataSource ); + + // Create an instance of model specific data + mModelData = new (EMM) ScrollbarModelDataImpl(); + + // Initialise model data with default values + mModelData->mTotalLength = 0; + mModelData->mViewLength = 0; + mModelData->mViewStartPosition = 0; + + mScrollWidget = NULL; + }//End of AlfScrollBarModel function. + + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarModel::~AlfScrollBarModel() + { + if(mModelData) + delete mModelData; + + delete mModel; + }//End of ~AlfScrollBarModel function. + + +// --------------------------------------------------------------------------- +// Second Phase Constructor. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::construct ( IAlfVariantType* /*aDataSource */) + { + + }//End of construct function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Add a new observer to be notified of any changes in the model. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::addModelChangeObserver( + IAlfModelChangeObserver& /*aObserver*/) + { + + }//End of addModelChangeObserver function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Add a new observer to be notified of any changes in the model. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::removeModelChangeObserver( + IAlfModelChangeObserver& /*aObserver*/ ) + { + + }//End of function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Api to change the model completely at one short. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::setData ( IAlfVariantType* /*aData*/ ) + { + + }//End of removeModelChangeObserver function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Change a given of data fields in the model. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::updateData( + TInt /*aNumContainerIndices*/, + TInt* /*aContainerIndices*/, + IAlfVariantType* /*aData*/) + { + ALF_THROW(AlfException,EInvalidArgument,"updateData") + }//End of updateData function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Add a number of data fields in the model data. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::addData( + TInt /*aNumContainerIndices*/, + TInt* /*aContainerIndices*/, + IAlfVariantType* /*aData*/) + { + ALF_THROW(AlfException,EInvalidArgument,"addData") + }//End of addData function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Remove a number of data fields in the model data. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::removeData( + TInt /*aNumContainerIndices*/, + TInt* /*aContainerIndices*/ ) + { + ALF_THROW(AlfException,EInvalidArgument,"removeData") + }//End of removeData function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Api for executing batch operations. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::executeOperations( + AlfPtrVector& /*aOperationsArray*/) + { + ALF_THROW(AlfException,EInvalidArgument,"executeOperations") + }//End of executeOperations function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Api for executing one operation at a Time. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::executeOperation(AlfModelOperation* /*aOperation*/) + { + ALF_THROW(AlfException,EInvalidArgument,"executeOperation") + }//End of executeOperation function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Clears the Model. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::clearModel() + { + + }//End of clearModel function. + + +// --------------------------------------------------------------------------- +// From class IAlfModel. +// Get the root data object of this model. +// --------------------------------------------------------------------------- +// +IAlfVariantType* AlfScrollBarModel::data() const + { + return NULL; + }//End of data function. + + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the scrollbar model. +// --------------------------------------------------------------------------- +IAlfInterfaceBase* AlfScrollBarModel::makeInterface(const IfId& aType) + { + IAlfInterfaceBase* ret ( 0 ); + UString param ( aType.mImplementationId ); + + if ( param == IAlfScrollBarModel::type().mImplementationId ) + { + ret = static_cast(this); + } + else if ( param == IAlfModel::type().mImplementationId ) + { + ret = static_cast(this); + } + else + { + //do nothing + } + + return ret; + }//End of makeInterface function. + +// --------------------------------------------------------------------------- +// From class IAlfScrollBarModel. +// Create the default data structure for a ScrollBar widget. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::initializeData( + int aTotalLength, + int aViewLengthInSteps, + int aViewStartPosition) + { + + validateAllData(aTotalLength, + aViewLengthInSteps, + aViewStartPosition); + + // Initialise model with the data provided + mModelData->mTotalLength = aTotalLength; + mModelData->mViewLength = aViewLengthInSteps; + mModelData->mViewStartPosition = aViewStartPosition; + + changeData( + mModelData->mTotalLength, + mModelData->mViewLength, + mModelData->mViewStartPosition); + + }//End of function. + +// --------------------------------------------------------------------------- +// Set Total Length . +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::setTotalLength(int aTotalLength) + { + int viewLength = getViewLength(); + int viewStartPos = getViewStartPosition(); + + if (validateAllData(aTotalLength, + viewLength, + viewStartPos)) + { + updateScrollBarModel(aTotalLength, -1, -1 ); + } + else + { + updateScrollBarModel(aTotalLength, viewLength, viewStartPos); + } + }//End of setTotalLength function. + +// --------------------------------------------------------------------------- +// Set ViewLength. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::setViewLength(int aViewLengthInSteps) + { + validateViewLength(aViewLengthInSteps); + updateScrollBarModel ( -1, aViewLengthInSteps, -1); + + }//End of setViewLength function. + + +// --------------------------------------------------------------------------- +// Set Thumb Position. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::setViewStartPosition ( int aViewStartPosition ) + { + validateViewStartPos(aViewStartPosition); + updateScrollBarModel (-1, -1, aViewStartPosition); + }//End of setViewStartPosition function. + +// --------------------------------------------------------------------------- +// Changes all the data of model with new values. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::changeData( + int aTotalLength, + int aViewLength, + int aViewStartPosition ) + { + + validateAllData(aTotalLength, + aViewLength, + aViewStartPosition); + + if(getViewStartPosition() == aViewStartPosition && + getTotalLength() == aTotalLength && + getViewLength() == aViewLength) + { + // nothing is changed + return ; + } + else + { + updateScrollBarModel( + aTotalLength, + aViewLength, + aViewStartPosition); + } + + + }//End of changeData function. + +// --------------------------------------------------------------------------- +// getTotalLength. +// --------------------------------------------------------------------------- +// +int AlfScrollBarModel::getTotalLength() const + { + return mModelData->mTotalLength; + }//End of getTotalLength function. + + +// --------------------------------------------------------------------------- +// Returns ViewLength. +// --------------------------------------------------------------------------- +// +int AlfScrollBarModel::getViewLength() const + { + + return mModelData->mViewLength; + }//End of getViewLength function. + + +// --------------------------------------------------------------------------- +// Returns ViewStartPosition. +// --------------------------------------------------------------------------- +// +int AlfScrollBarModel::getViewStartPosition() const + { + return mModelData->mViewStartPosition; + }//End of getViewStartPosition function. + +// --------------------------------------------------------------------------- +// Updates the ScrollBar visualization +// according to the model data. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::updateScrollBarVisualization() + { + //updateVisualization with new model + IAlfElement* element = (mScrollWidget)->control()->findElement("BaseElement"); + IAlfScrollBarDefaultBaseElement* defaultLCTBaseElement = static_cast ( + element->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) ); + AlfScrollBarDefaultBaseElement* baseElement = (AlfScrollBarDefaultBaseElement*)defaultLCTBaseElement; + + baseElement->updateVisualization(); + } + +// --------------------------------------------------------------------------- +// Updates the ScrollBar model according to the parameters. +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::updateScrollBarModel( + int aTotalLength, + int aViewLength, + int aViewStartPosition) + { + //change only if the parameters are non negative . + + if(aTotalLength!=-1) + { + mModelData->mTotalLength = aTotalLength; + } + else + { + // Do Nothing + } + + if(aViewLength!=-1) + { + mModelData->mViewLength = aViewLength; + } + else + { + // Do Nothing + } + + + if(aViewStartPosition!=-1) + { + mModelData->mViewStartPosition = aViewStartPosition; + } + else + { + // Do Nothing + } + + //updateVisualization with new model + updateScrollBarVisualization(); + }//End of updateScrollBarModel function. + +// --------------------------------------------------------------------------- +// validateViewLength +// --------------------------------------------------------------------------- +// +bool AlfScrollBarModel::validateViewLength(int & aViewLength) + { + bool ret = true; + + if (aViewLength <= 0) + { + // Minimum view length + aViewLength = 1; + ret = false; + } + else + { + int totalLength = getTotalLength(); + if (aViewLength > totalLength) + { + aViewLength = totalLength; + ret = false; + } + else + { + // do nothing + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// validateViewStartPos +// --------------------------------------------------------------------------- +// +bool AlfScrollBarModel::validateViewStartPos(int & aViewStartPos) + { + bool ret = true; + + if (aViewStartPos < 0) + { + aViewStartPos = 0; + ret = false; + } + else + { + int totalLength = getTotalLength(); + int viewLength = getViewLength(); + if (aViewStartPos > (totalLength-viewLength)) + { + // Maximum value + aViewStartPos = totalLength-viewLength; + ret = false; + } + else + { + // do nothing + } + } + return ret; + } + +// --------------------------------------------------------------------------- +// validateAllData +// --------------------------------------------------------------------------- +// +bool AlfScrollBarModel::validateAllData(int & aTotalLength, + int & aViewLength, + int & aViewStartPos) + { + bool ret = true; + if (aTotalLength <= 0) + { + aTotalLength = 1; + ret = false; + } + else + { + // do nothing + } + + // validate view length + if (aViewLength <= 0) + { + aViewLength = 1; + ret = false; + } + else if (aViewLength > aTotalLength) + { + // Setting maximum possible value of View Length + aViewLength = aTotalLength; + ret = false; + } + else + { + // do nothing + } + + // validate view start pos + if (aViewStartPos < 0) + { + aViewStartPos = 0; + ret = false; + } + else if (aViewStartPos > (aTotalLength-aViewLength) ) + { + // Setting maximum possible value of View Length + aViewStartPos = aTotalLength-aViewLength; + ret = false; + } + else + { + // do nothing + } + + // No need to validate aFocusPos for now + return ret; + } + +// --------------------------------------------------------------------------- +// StoreWidget +// --------------------------------------------------------------------------- +// +void AlfScrollBarModel::storeWidget(AlfScrollBarWidget* aWidget) + { + mScrollWidget = aWidget; + } +}//Namespace Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbarwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbarwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2007, 2008 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: Implementation for scrollbar widget. + * +*/ + + +// Alfred Client includes +#include + +// Widget Model includes +#include "alf/alfelement.h" +#include + +// Widget Includes +#include +#include +// Internal includes + +#include "alfscrollbardefaultbaseelement.h" +#include "alfscrollbarwidget.h" +#include "alfscrollbarmodel.h" +#include "alfscrollbarcontrol.h" +#include +using namespace alfscrollbarwidget; + +using Alf::CommonWidgetEvent; +namespace Alf + { + +// --------------------------------------------------------------------------- +// Creator Method. +// --------------------------------------------------------------------------- +// +AlfScrollBarWidget* AlfScrollBarWidget :: create( + CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + DuiNode *aNode, + const char *aFilePath, + AlfCustomInitDataBase* aCustomData) + { + return (new( EMM ) AlfScrollBarWidget(aEnv, + aContainer, aWidgetId, aNode, aFilePath, aCustomData)); + } + + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarWidget::~AlfScrollBarWidget() + { + if(mScrollModel) + { + delete mScrollModel; + } + else + { + + } + } + + + +// --------------------------------------------------------------------------- +// From class IAlfWidget. +// Getter for the parent container. The ownership not passed. +// --------------------------------------------------------------------------- +// +IAlfContainerWidget* AlfScrollBarWidget::parent() const + { + return mWidget->parent(); + } + + +// From class MAlfInterfaceBase. + +// --------------------------------------------------------------------------- +// Getter for interfaces provided by the scrollbar widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfScrollBarWidget :: makeInterface(const IfId& aType) + { + UString param ( aType.mImplementationId ); + + if (param == IAlfScrollBarWidget::type().mImplementationId) + { + return static_cast(this); + } + else if (param == IAlfWidget::type().mImplementationId) + { + return static_cast(this); + } + else + { + //do nothing + } + + return mWidget->makeInterface(aType); + } + + +// From class IAlfWidget. + +// --------------------------------------------------------------------------- +// Getter for the control. The ownership is not passed. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl* AlfScrollBarWidget :: control() const + { + return mWidget->control(); + } + + +// --------------------------------------------------------------------------- +// Setter for the control. The control is owned by the Alfred environment. +// --------------------------------------------------------------------------- +// +void AlfScrollBarWidget :: setControl( + CAlfWidgetControl* aControl, bool /*aDeletePreviousControl*/ ) + { + mScrollControl = aControl; + mWidget->setControl(aControl); + } + + +// --------------------------------------------------------------------------- +// Getter for the model. The ownership is not passed. +// --------------------------------------------------------------------------- +// +IAlfModel* AlfScrollBarWidget :: model() + { + return mScrollModel; + } + + +// --------------------------------------------------------------------------- +// Setter for the model. Ownership is passed and the old model is released. +// --------------------------------------------------------------------------- +// +void AlfScrollBarWidget :: setModel( IAlfModel* aModel, bool /*aTakeOwnerShip*/) + { + IAlfElement* baseelement = control()->findElement ("BaseElement"); + if(baseelement) + { + IAlfScrollBarBaseElementInternal* elementInternal = + static_cast ( + baseelement->makeInterface( + IAlfScrollBarBaseElementInternal::type())); + + if(aModel==NULL) + { + if(elementInternal) + { + elementInternal->destroyVisualization(); + } + delete mScrollModel; + mScrollModel = NULL; + } + else + { + if(mScrollModel) + { + delete mScrollModel; + mScrollModel = NULL; + + mScrollModel = static_cast( aModel->makeInterface( + IAlfScrollBarModel::type())); + AlfScrollBarModel* scrollBarModel = (AlfScrollBarModel*)mScrollModel; + // Store the widget pointer in model + scrollBarModel->storeWidget(this); + + if(mScrollModel && elementInternal) + { + elementInternal->initializeScrollModel(); + elementInternal->updateVisualization(); + } + } + else + { + mScrollModel =static_cast( aModel->makeInterface( + IAlfScrollBarModel::type())); + AlfScrollBarModel* scrollBarModel = (AlfScrollBarModel*)mScrollModel; + scrollBarModel->storeWidget(this); + + if(mScrollModel && elementInternal) + { + elementInternal->createVisualization(); + } + } + + } + } + } + + +// --------------------------------------------------------------------------- +// Get the name of the widget instance. +// --------------------------------------------------------------------------- +// +const char* AlfScrollBarWidget :: widgetName() const + { + return mWidget->widgetName(); + } + + +// --------------------------------------------------------------------------- +// Sets/Releases the Focus from child widget of container. +// --------------------------------------------------------------------------- +// +void AlfScrollBarWidget :: setChildFocus(bool /*aFocus*/) + { + } + + +//--------------------------------------------------------------------------- +// Creates the presentation for the widget from XML. Destroys any existing +// presentation. +//--------------------------------------------------------------------------- +// +void AlfScrollBarWidget :: setPresentation(const char* /*aFilePath*/) + { + } + + + +// --------------------------------------------------------------------------- +// C++ default constructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarWidget :: AlfScrollBarWidget( + CAlfEnv& aEnv, IAlfContainerWidget& aContainer, + const char* aWidgetId, DuiNode * /*aNode*/, + const char * /*aFilePath*/, + AlfCustomInitDataBase* /*aCustomData*/) + { + mScrollModel = NULL; + mWidget.reset(new(EMM) AlfWidget(aWidgetId,aContainer,aEnv)); + // Default Imperative Construction + constructDefault(aEnv); + + } + + +// --------------------------------------------------------------------------- +// Constructs default Visualization for widget. +// --------------------------------------------------------------------------- +// +void AlfScrollBarWidget :: constructDefault(CAlfEnv& aEnv) + { + const char* mBaseElementLoadId=KScrollBarDefaultBaseElement; + + // Create Control + CAlfWidgetControl* ctrl = constructDefaultControl(aEnv); + setControl(ctrl); + + // Create Element + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(control()->Env()); + + widgetFactory.createElement(mBaseElementLoadId, + baseElementName(), + *control()); + } + +// --------------------------------------------------------------------------- +// Construct and returns Scrollbar Control. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl *AlfScrollBarWidget :: constructDefaultControl(CAlfEnv& aEnv) + { + return(new(EMM) AlfScrollBarControl(aEnv) ); + } + +// --------------------------------------------------------------------------- +// Enables tactile feedback based on the flag state +// --------------------------------------------------------------------------- +// +void AlfScrollBarWidget ::enableTactile(bool aFlag) + { + AlfScrollBarControl* scrollControl = (AlfScrollBarControl*)control(); + scrollControl->EnableTactileFeedback(aFlag); + } + +// --------------------------------------------------------------------------- +// Getter for tactile feedback state +// --------------------------------------------------------------------------- +// +bool AlfScrollBarWidget ::IsTactileEnabled() + { + AlfScrollBarControl* scrollControl = (AlfScrollBarControl*)control(); + return scrollControl->IsTactileFeedbackEnabled(); + } + + }//End of Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfscrollbarwidget/src/alfscrollbarwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfscrollbarwidget/src/alfscrollbarwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,299 @@ +/* +* 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 scrollbar widget. +* +*/ + +// WidgetModel Includes +#include "alf/alfwidget.h" +#include + +// Symbian Includes +#include + +// OpenC Includes +#include + +// Widget Includes +#include +#include + +//Internal includes +#include "alfscrollbarwidgetfactoryplugin.h" +#include "alfscrollbarwidget.h" +#include "alfscrollbarmodel.h" +#include "alfscrollbardefaultbaseelement.h" + +using namespace osncore; + +namespace Alf + { +const TInt KScrollBarWidgetFactoryPluginUid = {0x20010106}; +const int KProductCount = 3; + + +// --------------------------------------------------------------------------- +// Two-phased Symbian constructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarWidgetFactoryPlugin* AlfScrollBarWidgetFactoryPlugin::NewL() + { + return new (EMM) AlfScrollBarWidgetFactoryPlugin; + } + + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfScrollBarWidgetFactoryPlugin::~AlfScrollBarWidgetFactoryPlugin() + { + + } + + +// --------------------------------------------------------------------------- +// Creates either a scrollbar widget or a scrollbar model. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfScrollBarWidgetFactoryPlugin::createProduct( + const char* aProduct, + void* aInitData) + { + IAlfInterfaceBase* ret (0); + if (aProduct == NULL) + { + // do nothing + } + else if (!strcmp(aProduct, KScrollBarWidget)) + { + AlfWidgetInitData* initData = (AlfWidgetInitData*)aInitData; + + if (initData == 0) + { + // Throw exception if init data is null + ALF_THROW( + AlfException, + ECommonError, + "Scrollbar widget initialization data was NULL."); + } + else + { + // Do Nothing + } + + if (initData->mWidgetId == 0) + { + // Assert that widget id in the initialization data is correct. + ALF_THROW( + AlfException, + ECommonError, + "Widget ID was NULL."); + } + else + { + // Do Nothing + } + + if (initData->mEnv == 0) + { + // Assert that the UI Accelerator Toolkit Environment + // in the initialization data is correct. + ALF_THROW( + AlfException, + ECommonError, + "Environment instance was NULL."); + } + else + { + // Do Nothing + } + + if (initData->mContainerWidget == 0) + { + // Assert that container widget pointer in the + // initialization data is correct. + ALF_THROW( + AlfException, + ECommonError, + "Container widget instance was NULL."); + } + else + { + // Do Nothing + } + + auto_ptr widget(AlfScrollBarWidget::create( + *initData->mEnv, + *initData->mContainerWidget, + initData->mWidgetId, + initData->mNode, + initData->mFilePath, + initData->mCustomData)); + + ret = widget->makeInterface (IAlfScrollBarWidget::type()); + widget.release(); + } + else if (!strcmp(aProduct, KScrollBarModel)) + { + auto_ptr model(new(EMM) AlfScrollBarModel(NULL)); + ret = model->makeInterface (IAlfScrollBarModel::type()); + model.release(); + } + else if (!strcmp(aProduct, KScrollBarDefaultBaseElement)) + { + AlfElementInitData* initData = (AlfElementInitData*) aInitData; + // TBD: Need to change the exceptions to scrollbar specific exceptions. + // Throw exception if init data is null + if (initData == 0) + { + ALF_THROW( + AlfException, + ECommonError, + "Scrollbar widget initialization data was NULL."); + } + else + { + // Do Nothing + } + + if (initData->mElementId == 0) + { + // Assert that element id in the initialization data is correct. + ALF_THROW( + AlfException, + ECommonError, + "Element ID was NULL."); + } + else + { + // Do Nothing + } + + if (initData->mControl == 0) + { + // Assert that the widget control is correct. + ALF_THROW( + AlfException, + ECommonError, + "Environment instance was NULL."); + } + else + { + // Do Nothing + } + + auto_ptr element( + new(EMM) AlfScrollBarDefaultBaseElement( + (CAlfWidgetControl&)(*initData->mControl), + initData->mElementId, + initData->mNode,initData->mCustomData)); + + ret = element->makeInterface(IAlfScrollBarDefaultBaseElement::type()); + element.release(); + } + else + { + // Do Nothing + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// From IAlfInterfaceBase. +// Creates interface based on the given type. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfScrollBarWidgetFactoryPlugin::makeInterface( + const IfId& /*aType*/) + { + return NULL; + } + + +// --------------------------------------------------------------------------- +// Returns the amount of products this factory can produce. +// --------------------------------------------------------------------------- +// +int AlfScrollBarWidgetFactoryPlugin::productCount() const + { + return KProductCount; + } + + +// --------------------------------------------------------------------------- +// Returns product information. +// --------------------------------------------------------------------------- +// +const char* AlfScrollBarWidgetFactoryPlugin::productInfo (int aIndex) const + { + switch (aIndex) + { + case 0: + { + return KScrollBarWidget; + } + + case 1: + { + return KScrollBarModel; + } + + case 2: + { + return KScrollBarDefaultBaseElement; + } + + + default: + break; + + } + + return 0; + } + + }// NameSpace + + +// --------------------------------------------------------------------------- +// OTHER EXPORTED FUNCTIONS. +// --------------------------------------------------------------------------- +// + +using namespace Alf; +const TImplementationProxy ImplementationTable[] = + { +#ifdef __EABI__ + IMPLEMENTATION_PROXY_ENTRY ( + KScrollBarWidgetFactoryPluginUid, + AlfScrollBarWidgetFactoryPlugin::NewL) +#else + { + {KScrollBarWidgetFactoryPluginUid}, + AlfScrollBarWidgetFactoryPlugin::NewL} +#endif + }; + +OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount = sizeof (ImplementationTable) / sizeof (TImplementationProxy); + + return ImplementationTable; + } + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/group/alfviewwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/group/alfviewwidget.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ + +#include + + + +TARGET alfviewwidget.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x20010103 + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE alfviewwidgetfactoryplugin.cpp +SOURCE alfviewwidget.cpp +SOURCE alfviewcontrol.cpp +SOURCE alfviewwidgetexception.cpp + + +USERINCLUDE ../../../inc +USERINCLUDE ../inc + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY eikcore.lib +LIBRARY cone.lib +LIBRARY gdi.lib +LIBRARY fbscli.lib +LIBRARY alfclient.lib +LIBRARY alfwidgetmodel.lib +LIBRARY alfwidgetutils.lib +LIBRARY osncore.lib +LIBRARY charconv.lib +LIBRARY libc.lib + + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY aknicon.lib +LIBRARY cdlengine.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib + +LIBRARY eikcoctl.lib + LIBRARY libstdcpp.lib +#define ALF_LINK_STDCPP_DLL +// following include must be after definition +LIBRARY libpthread.lib +LANG SC +START RESOURCE 20010103.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET alfviewwidget.rsc +#endif +END diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,31 @@ +/* +* 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: Build information file for project ?myapp +* +*/ + + +#include + + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_MMPFILES +alfviewwidget.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/inc/alfviewcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/inc/alfviewcontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007 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: View Widget control Class Header. +* +*/ + + +#ifndef ALFVIEWCONTROL_H_ +#define ALFVIEWCONTROL_H_ + +#include + +namespace Alf + { +class AlfViewWidget; + +/** + * Control class of the view widget. + * + * This class implements logic of the view widget. + * + * View widget automatically creates an CAlfViewControl object + * for it's control. + */ +class CAlfViewControl : public CAlfWidgetControl + { +public: + + /** + * Default constructor + * + * @param aEnv UI Accelerator Toolkit environment where this view widget + * is created. + * @param aViewWidget The view widget with which this control is associated with. + */ + CAlfViewControl(CAlfEnv& aEnv, AlfViewWidget& aViewWidget); + + /** + * Default destructor + */ + virtual ~CAlfViewControl(); + + // From base class CAlfWidgetControl + + /** + * Handles events sent to widget control. + * + * @since S60 ?S60_version + * @param aEvent The event to be handled. + * @return see AlfEventStatus. + */ + virtual AlfEventStatus handleEvent(const TAlfEvent& aEvent); + +// New methods + + /** + * Returns the view widget associated with this control. + * The widget() method returns the AlfWidget implementation class + * object that is used as an adapter in the AlfViewWidget object. + */ + AlfViewWidget& viewWidget(); + +private: + + /** View widget in which this control is used */ + AlfViewWidget& mViewWidget; + + }; + + } + +#endif /*ALFVIEWCONTROL_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/inc/alfviewwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/inc/alfviewwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,550 @@ +/* +* Copyright (c) 2007 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: Widget class header. +* +*/ + + +#ifndef ALFVIEWWIDGET_H +#define ALFVIEWWIDGET_H + +#include "alf/alfwidget.h" +#include +#include +#include +#include + +#include +#include +// Forward declarations +class CAlfControlGroup; + +namespace dui + { + class DuiNode; + } + +namespace Alf +{ + +class AlfWidget; +class AlfViewWidgetZOrderChangedObserver; + +/** + * View widget implementation. + * + * View widget can be used to contain other widgets in an arbitrary layout. + * + * View widget creates a control group with ID passed in its constructor and + * stores it's control in it. + */ +class AlfViewWidget : public IAlfViewWidget, public MAlfActionObserver,MAlfEventHandler +{ +public: + + /** + * Default constructor. + * + * Use AlfViewWidgetFactoryPlugin::CreateProduct() to instantiate a view + * widget. View widget will create a new control group from the ID passed to this + * constructor and append the view control into the control group. + * + * @exception AlfException Error code EInvalidArgument is thrown if a control group already + * exists with the given ID. + * @exception AlfViewWidgetException with Symbian Error code if the view + * is unable to register itself as an action observer in the + * Alfred Environment. + * + * @param aWidgetName Name of the constructed view widget. + * @param aControlGroupId ID of the control group to append the view widget control into. + * @param aEnv UI Accelerator Toolkit environment in which this widget is defined. + * @param aDisplay Display in which this widget is defined. + */ + AlfViewWidget(const char* aWidgetName, int aControlGroupId, CAlfEnv& aEnv, + CAlfDisplay& aDisplay, DuiNode* aNode=NULL, const char *aFilePath=NULL); + + /** + * Default destructor. + */ + virtual ~AlfViewWidget(); + + // From Alf::IAlfWidget base class + + /** + * Getter for the control. The ownership is not passed. + * + * @since S60 5.0 + * @return The control of this widget, or NULL if the control is not specified. + */ + virtual CAlfWidgetControl* control() const; + + /** + * getter for the parent container. The ownership is not passed. + * @return the parent container or NULL if the widget is the root-widget. + */ + virtual IAlfContainerWidget* parent() const; + + /** + * Setter for the control. The control is owned by the Alfred environment. + * The previously set control can be destroyed when new control is set. + * + * The set control is added to the control group of this view widget. + * The set control is removed from it's previous control group. + * + * @since S60 5.0 + * @param aControl The control for this widget. + * @param aDeletePreviousControl A boolean to indicate whether the previously set control + * is to be destroyed when this method is called. + */ + virtual void setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl = true); + + /** + * Getter for the model. The ownership is not passed. + * + * @since S60 5.0 + * @return The model of this widget, or NULL if the model is not specified. + */ + virtual IAlfModel* model(); + + /** + * Setter for the model. Ownership is passed and the old model is released. + * + * @since S60 5.0 + * @param aModel The model for this widget. + * @param aTakeOwnership Whether takes ownership of model or not + */ + virtual void setModel(IAlfModel* aModel, bool aTakeOwnership = true); + + /** + * Get the name of the widget instance. + * + * @since S60 5.0 + * @return Widget name + */ + virtual const char* widgetName() const; + + /** + * Sets/Releases the Focus from child widget of view. + * Does not set the actual focused status in roster. + * + * @since S60 5.0 + * @param aFocus boolean value for focused status + */ + virtual void setChildFocus(bool aFocus); + + // From Alf::IAlfContainerWidget base class + + /** + * Returns total number of widgets contained by this view. + * + * @return int Total number of widgets. + */ + virtual int widgetCount() const; + + /** + * Adds a child widget to the view. + * + * Ownership of the widget is transferred to this view + * object. + * + * @param aWidget Child widget to be added to view. + */ + virtual void addWidget(IAlfWidget& aWidget); + + /** + * Returns child widget at given index. + * + * If index is not found returns null. + * + * @param aIndex Index of widget to be returned. + * @return Widget at given index or null if not found. + */ + virtual IAlfWidget* getWidget(int aIndex) const; + + /** + * Returns the child index, when given the child widget. + * + * @param aWidget child widget, which index is returned + * @return the index of the child widget, or -1, if widget is not child of this container. + */ + virtual int getWidgetIndex(IAlfWidget& aWidget) const; + + /** + * Removes the child widget from given index. + * + * This will destroy the widget object at the given index. + * + * @param aIndex Index from which widget has to be removed. + */ + virtual void removeWidget(int aIndex); + + /** + * Sets the base layout of view widget. + * + * @param aLayout New base layout of view widegt. + */ + virtual void applyLayout(IAlfLayoutManager& aLayout); + + /** + * Sets the presentation for the widget using presentation XML file. + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + virtual void setPresentation(const char* aFilePath); + + + //--------------------------------------------------------------------------------------// + /* From IAlfViewWidget*/ + //--------------------------------------------------------------------------------------// + + + /** + * API to show the view widget. + * @param aShow true if the view is to be shown, else false + * The view is not shown, till this api is called + * with true parameter. + * @since S60 ?S60_version + */ + virtual void show(bool aShow = true); + + + /** + * API to make the view widget accept events. + * + * @param aAccept true if the view is to accept inputs, else false + * default value is true + * @since S60 ?S60_version + */ + virtual void acceptEvents(bool aAccept = true); + + /** + * API to hide/show Avkon status pane. + * If the AlfDisplay bound to the view widget does not occupy the + * entire client rectangle, this API has no effect. + * + * @param aEnable true to enable the status pane, else false + * the default value is true. + * @since S60 ?S60_version + */ + virtual void enableStatusPane(bool aEnable = true); + + /** + * API to hide/show Avkon control pane + * If the AlfDisplay bound to the view widget does not occupy the + * entire client rectangle, this API has no effect. + * + * @param aEnable true to enable the control pane, else false + * the default value is true. + * @since S60 ?S60_version + */ + virtual void enableControlPane(bool aEnable = true); + + /** + * API to enable/disable Avkon Skin to be used as view widget's background. + * + * @param aSkinBackground true if the view has to use Avkon Skin as background. + * false otherwise. + * @since S60 ?S60_version + */ + virtual void useSkinBackground(bool aSkinBackground = true); + + /** + * API to use Skin with the given ID to be used as view widget's background. + * Also enables skin background. See IAlfViewWidget::useSkinBackground() + * + * @param aID Skin id of the graphics to be used in the texture. + * + * @since S60 ?S60_version + */ + virtual void setSkinBackground(TAknsItemID aSkinID); + + /** + * API to check whether the view is shown + * + * @return true if the view is shown, else false + * + * @since S60 ?S60_version + */ + virtual bool shown(); + + /** + * Returns the position of the view on the view stack. + * This tells the view Z-coordinate position relative to other views. + * Top-most view returns zero. Views under that have a growing + * number of position. If the view is hidden -1 is returned. + * Only view widgets are taken into consideration in the position calculation. + * Other control groups in the display roster are ignored. For example, + * position zero doesn't mean that the control group of this view would be + * top-most. + * + * Only top-most view is activate while all other views are being deactivate. + * + * @return Position of the view, -1 if view is hidden. + */ + virtual int getViewStackPosition() const; + + /** + * API to check whether the view accepts events + * + * @return true if the view accepts events, else false + * + * @since S60 ?S60_version + */ + virtual bool eventsAccepted(); + + /** + * API to check whether the status pane is enabled + * + * @return true if the status pane is enabled, else false + * + * @since S60 ?S60_version + */ + virtual bool statusPaneEnabled(); + + /** + * API to check whether the control pane is enabled + * + * @return true if the control pane is enabled, else false + * + * @since S60 ?S60_version + */ + virtual bool controlPaneEnabled(); + + /** + * API to check whether skin info is being used for background + * or not + * + * @return true if the skin info is being used, else false + * + * @since S60 ?S60_version + */ + virtual bool usingSkinBackground(); + + /** + * API to get the Avkon Skin ID being used as view widget's background. + * Use IAlfViewWidget::usingSkinBackground() to check if this is + * being used. + * + * @return Avkon Skin ID being used for view's background. + * Returns an ID with major and minor fields=-1 if + * this info was never set. + * See IAlfViewWidget::setSkinBackground() + * + * @since S60 ?S60_version + */ + virtual TAknsItemID skinBackground(); + + // From Alf::IAlfInterfaceBase base class + + /** + * Interface getter. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 5.0 + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + + // New methods + + /** + * Called to notify the view of view activation (view becoming top most in + * z-order) or deactivation. The view can be deactivated multiple times + * in a row without being reactivated. + * + * This method is called internally by the view widget itself. + * + * @see getViewStackPosition() + * + * @param aIsActivated Indicates whether view widget is activated or not + */ + void notifyViewActivated(bool aIsActivated); + + //From MAlfActionObserver + /** + * @see MAlfActionObserver + */ + void HandleActionL(const TAlfActionCommand& aActionCommand); + + /** + * API to Set the display area of the view widget. + * This will set the alfdisplay area with param passed + * Client need to call this api with screen/apprect to make + * view full screen or application rect + * + * @param aDisplayRect: the area in which view widget should be + * displayed + * + * @since S60 ?S60_version + */ + void setRect(const TRect& aDisplayRect); + + /** + * Updates the array which contains the name of all the children widgets + * + * @param aChildName the name of a child widget + */ + void setChildNameToDelete( UString aChildName ); + +private: + + /** + * Constructs widget from declaration. + * + * @param aEnv The environment for the widget. + * @param aNode declaration node. + */ + void constructComponentsFromNode(CAlfEnv& aEnv); + + /** + * Constructs widget using the presentation XML. + * + * @param aEnv The environment for the widget. + * @param aFilePath Path to XML file describing the presentation of the widget. + */ + void constructFromPresentationXML(CAlfEnv& aEnv, const char *aFilePath); + + /** + * Constructs default widget + * + * @param aEnv The environment for the widget. + */ + void constructDefault(CAlfEnv& aEnv, bool aCreateLM = true); + + /** + * Sets default layout mgr. + */ + void setDefaultLayoutManager(); + + /** + * Utility function + */ + void updateBackGroundImage(); + + /** + * Updates the status pane according to the view settings. + */ + void updateStatusPane(); + + /** + * Updates the control pane according to the view settings. + */ + void updateControlPane(); + + /** + * Finds the focused control of this view. + */ + CAlfControl* focusedControl(); + + /** + * from MAlfEventHandler + */ + TBool OfferEventL(const TAlfEvent& aEvent); + +private: + + /** + * AlfWidget instance, owned. + */ + auto_ptr mWidget; + + /** + * UI Accelerator Environment where this widget is used. + * Not owned. + */ + CAlfEnv* mEnv; + + /** + * Display to be associated with the view. + * Not owned. + */ + CAlfDisplay* mDisplay; + + /** + * Control group to contain the view widget control in. + * Not owned. + */ + CAlfControlGroup* mControlGroup; + + /** + * Control group order changed observer object used to activate + * this view when necessary. + * Owned. + */ + auto_ptr mZOrderChangedObserver; + + /** + * Control group resource ID. + */ + TInt mControlGroupResourceId; + + /** + * Flag to indicate if the view is being shown or not. + */ + bool mShown; + + /** + * Flag to indicate if the Avkon Control Pane is shown or not. + */ + bool mControlPaneEnabled; + + /** + * Flag to indicate if the Avkon Status Pane is shown or not. + */ + bool mStatusPaneEnabled; + + /** + * Flag to indicate if the view uses skin background or not. + */ + bool mSkinEnabled; + + /** + * ID for skin related information to be used for background. + */ + TAknsItemID mSkinId; + + /** + * Cache for ID of the child widget that is currently focused. + * This is used to restore focus to the correct child when the view + * is shown and to remember the focused child when the view is hidden. + */ + std::string mFocusedChildWidgetID; + + TRect mDisplayRect; + + /** + * Stores the naame of all the children widgets + */ + AlfPtrVector mChildWidgetName; + + /** + * Flag to indicate whether AcquireFocus() has been called on one + * of the controls. + */ + TBool mHasFocus; + }; + + } + +#endif /*ALFVIEWWIDGET_H*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/inc/alfviewwidgetexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/inc/alfviewwidgetexception.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2007 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: View widget exception class. +* +*/ + + +#ifndef ALFVIEWWIDGETEXCEPTION_H +#define ALFVIEWWIDGETEXCEPTION_H + +// INCLUDES +#include +#include + +namespace Alf + { + +/** + * Error codes used with AlfViewWidgetException. + * + * There is an offset in AlfViewWidgetException error codes, so that + * AlfViewWidget specific exceptions can be separated from + * osncore::AlfException base exceptions and exceptions of other widgets. + */ +enum TAlfViewWidgetErrorCode + { + /** + * Error occured in construction or initialization of the view + * widget. + */ + EInitializationError = 600, + + /** + * Handle to status pane not found + */ + EStatusPaneError, + + /** + * Handle to control pane not found + */ + EControlPaneError, + + /** + * Control group id specified in the viewwidget constructor + * already reserved. + */ + EControlGroupAlreadyExists + }; + +/** + * AlfViewWidgetException is a base class for all view widget + * exceptions. + * + */ +class AlfViewWidgetException : public osncore::AlfException + { +public: + // Constructors and destructor + + /** + * Constructor with AlfViewWidget specific error code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + */ + AlfViewWidgetException(int aError) throw(); + + /** + * Constructor with AlfViewWidget specific error code + * and additional information. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + */ + AlfViewWidgetException(int aError, const char* aInfo) throw(); + + /** + * Constructor with AlfViewWidget specific error code, + * additional information, source file and line of code. + * + * Error code has to be one of the error codes specified in + * Alf::TAlfViewWidgetErrorCode or a system-wide error code + * represented by negative integer. + * + * @see osncore::AlfException::errorCode() + * + * @param aError Error code to describe the occured exception. + * @param aInfo Optional additional information or NULL. + * @param aFileAndLine Optional file and line information or NULL. + */ + AlfViewWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw(); + + /** + * Default destructor. + */ + virtual ~AlfViewWidgetException() throw(); + + /** + * Returns the description of the exception. + * @ret The description of the exception. + */ + const char* what() const throw(); + +private: + + /** + * Error description + */ + osncore::UString mDescription; + + }; + + } // Namespace Alf + +#endif // ALFVIEWWIDGETEXCEPTION_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/inc/alfviewwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/inc/alfviewwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 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: View Widget factory plugin header. +* +*/ + + +#ifndef ALFVIEWWIDGETFACTORYPLUGIN_H +#define ALFVIEWWIDGETFACTORYPLUGIN_H + +#include + +namespace Alf +{ + +/** + * AlfViewWidgetFactoryPlugin is a widget factory plugin implementation + * that can be used to create view widgets. + * + * Can be used to create view widgets and associated products. + */ +class AlfViewWidgetFactoryPlugin : public IAlfFactoryPlugin + { +public: + // Constructors and destructor + + /** + * Default Symbian constructor to create the factory plugin. + */ + static AlfViewWidgetFactoryPlugin* newL(); + + // From base class IAlfPluginFactory + + /** + * Create view widget factory product. + * @since Series 60 5.0 + * @param aProduct Product to create. + * @param aInitData Initialization data for product + * @return Instance or NULL + */ + IAlfInterfaceBase* createProduct( const char* aProduct, void* aInitData ); + + /** + * Count available products this factory can produce. + * + * @since S60 5.0 + * @return Product count + */ + int productCount() const; + + /** + * Fetch product info by index + * + * @param aIndex List index + * @since S60 5.0 + * @return Descriptor describing product + */ + const char* productInfo(int aIndex) const; + + // From base class IAlfInterfaceBase + + /** + * Creates interface based on the given type. + * + * @since Series 60 5.0 + * @param aType Interface type to create. + * @return Requested interface. + */ + IAlfInterfaceBase* makeInterface(const IfId& aType); + + }; + + } // Namespace Alf + +#endif // ALFVIEWWIDGETFACTORYPLUGIN_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/src/20010103.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/src/20010103.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,47 @@ +/* +* 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: View widget rss file. +* +*/ +#include +#include "alf/alfecompluginfactoryuid.rh" + +//#define DUIEXAMPLE + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x20010103; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20010104; + version_no = 1; + display_name = ""; +#ifndef DUIEXAMPLE + default_data = "viewwidget"; +#else + default_data = "viewwidget"; +#endif + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/src/alfviewcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/src/alfviewcontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + + +// Local Includes +#include "alfviewcontrol.h" +#include "alfviewwidget.h" + +// AlfClient Includes +#include + +// Widget Model +#include + +using namespace Alf; + +CAlfViewControl::CAlfViewControl(CAlfEnv& aEnv, AlfViewWidget& aViewWidget) + : CAlfWidgetControl(aEnv), mViewWidget(aViewWidget) + { + } + +CAlfViewControl::~CAlfViewControl() + { + while(mViewWidget.widgetCount()) + { + mViewWidget.setChildNameToDelete(UString(mViewWidget.getWidget(0)->widgetName())); + mViewWidget.removeWidget(0); + } + } + +AlfEventStatus CAlfViewControl::handleEvent(const TAlfEvent& aEvent) + { + AlfEventStatus ret = CAlfWidgetControl::handleEvent(aEvent); + if(ret == EEventNotHandled && aEvent.IsKeyEvent()) + { + if(aEvent.KeyEvent().iScanCode == EStdKeyRightArrow || + aEvent.KeyEvent().iScanCode == EStdKeyDownArrow ) + { + if(aEvent.Code() == EEventKey) + { + TAlfEvent focusNext(EEventFocusNextWidget); + return CAlfWidgetControl::processEvent(focusNext); + } + } + else if(aEvent.KeyEvent().iScanCode == EStdKeyLeftArrow || + aEvent.KeyEvent().iScanCode == EStdKeyUpArrow) + { + if(aEvent.Code() == EEventKey) + { + TAlfEvent focusPrevious(EEventFocusPreviousWidget); + return CAlfWidgetControl::processEvent(focusPrevious); + } + } + } + return ret; + } + +AlfViewWidget& CAlfViewControl::viewWidget() + { + return mViewWidget; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/src/alfviewwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/src/alfviewwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,738 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + + + +#include "alfviewwidget.h" +#include "alfviewcontrol.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include +#include +#include + +#include + +#include "alfviewwidgetexception.h" + +#include +#include +#include + +namespace Alf + { + +/** + * Observer class to observe changes in the relative order of control groups in associated + * roster object and to notify view object about possible view activation (view coming + * top-most) and deactivation. + * + * This class is a Symbian - specific implementation class. + */ +class AlfViewWidgetZOrderChangedObserver : public MAlfControlGroupOrderChangedObserver + { + public: + + /** + * Default constructor + */ + AlfViewWidgetZOrderChangedObserver(CAlfDisplay& aDisplay, AlfViewWidget& aView) + : iDisplay(aDisplay), iView(aView) + { + aDisplay.Roster().AddControlGroupOrderChangedObserverL(*this); + } + + /** + * Default destructor + */ + ~AlfViewWidgetZOrderChangedObserver() + { + int index = CAlfEnv::Static()->FindDisplayIndex(iDisplay); + if(index != -1) + { + iDisplay.Roster().RemoveControlGroupOrderChangedObserver(*this); + } + } + + /** + * Callback method called by roster when control group order changes. + */ + void NotifyControlGroupOrderChanged() + { + // If the associated view is on top, notify it about view activation + // and the view below it about view deactivation. + if(iView.getViewStackPosition() == 0) + { + AlfViewWidget* viewBelow = getViewFromStack(1); + if(viewBelow) + { + viewBelow->notifyViewActivated(false); + } + + iView.notifyViewActivated(true); + } + } + + private: + + /** + * Utility method to return view from specified z-position on the view stack. + * Returns 0 if the index is out of bounds. + */ + AlfViewWidget* getViewFromStack(int index) + { + int zPos = 0; + + // Iterate through the control groups in the roster + for(int i = (iDisplay.Roster().Count() - 1); i >= 0; --i) + { + CAlfControlGroup& group = iDisplay.Roster().ControlGroup(i); + + // Investigate whether this is a control group of a view widget + if(group.Count() > 0) + { + CAlfControl& control = group.Control(0); + CAlfViewControl* viewControl = dynamic_cast(&control); + if(viewControl != 0) + { + // View widget found from the roster + if(zPos == index) + { + return &viewControl->viewWidget(); + } + zPos++; + } + } + } + + return 0; + } + + /** Roster to which this callback object is added to. */ + CAlfDisplay& iDisplay; + + /** View widget that this observer notifies. */ + AlfViewWidget& iView; + + }; + + +AlfViewWidget::AlfViewWidget(const char* aWidgetName, int aControlGroupId, CAlfEnv& aEnv, + CAlfDisplay& aDisplay, DuiNode* aNode, const char *aFilePath) : + mEnv(&aEnv), mDisplay(&aDisplay), mControlGroup(0), + mZOrderChangedObserver(0), + mControlGroupResourceId(aControlGroupId), + mShown(false), mControlPaneEnabled(true), mStatusPaneEnabled(true), + mSkinEnabled(false), mSkinId(KAknsIIDQsnBgScreen), mHasFocus(false) + { + mChildWidgetName.setAutoDelete(true); + mWidget.reset(new (EMM) AlfWidget(aWidgetName)); + + TRAPD(err,aEnv.AddActionObserverL(this)); + if(err!=KErrNone) + { + ALF_THROW(AlfViewWidgetException, err, + "CAlfEnv::AddActionObserverL() - failed."); + } + + // By default, we use ClientRect() as the area of the view widget + TRect rect = ((CAknAppUi*)CEikonEnv::Static()->AppUi())->ClientRect(); + mDisplayRect = TRect(rect); + + mZOrderChangedObserver.reset(new (EMM) AlfViewWidgetZOrderChangedObserver(aDisplay, *this)); + + constructDefault(aEnv); + + } + +AlfViewWidget::~AlfViewWidget() + { + //If the view widget is deleted before the AlfEnv is deleted, + //the control group needs to be destroyed. + if(mEnv->FindControlGroup(mControlGroupResourceId)) + { + mEnv->DeleteControlGroup(mControlGroup->ResourceId()); + } + + mEnv->RemoveActionObserver(this); + + IAlfWidget* childWidget = NULL; + + IAlfWidgetFactory& factory = AlfWidgetEnvExtension::widgetFactory(*(CAlfEnv::Static())); + for(int i =0 ;i < mChildWidgetName.count();i++) + { + childWidget = factory.findWidget(mChildWidgetName.at(i)->getUtf8()); + if(childWidget) + { + factory.destroyWidget(childWidget); + childWidget = NULL; + } + } + mChildWidgetName.clear(); + } + +CAlfWidgetControl* AlfViewWidget::control() const + { + return mWidget->control(); + } + +IAlfContainerWidget* AlfViewWidget::parent() const + { + return mWidget->parent(); + } + +void AlfViewWidget::setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl) + { + CAlfWidgetControl* prevControl = mWidget->control(); + + // Set new control to the widget implementation. + // Never delete the previous control in this phase, so that we can + // still remove it from the control group if this call is succesfull. + mWidget->setControl(aControl, false); + + // Remove the previous control from control group. + if(prevControl != 0) + { + assert(prevControl->ControlGroup() == mControlGroup); + if(aDeletePreviousControl) + { + mControlGroup->Remove(prevControl); + delete prevControl; + } + } + + // Append the new control into the control group. + if(aControl) + { + TRAPD(err, mControlGroup->AppendL(aControl)); + if(err != KErrNone) + { + mWidget->setControl(0, false); + ALF_THROW(AlfViewWidgetException, err, "CAlfControlGroup::AppendL() - failed."); + } + } + } + +void AlfViewWidget::setChildNameToDelete( UString aChildName ) + { + UString* childName = new(EMM)UString(aChildName.getUtf8()); + mChildWidgetName.resize(mChildWidgetName.count()+1); + mChildWidgetName.insert(mChildWidgetName.count(),childName); + } + +IAlfModel* AlfViewWidget::model() + { + return 0; + } + +void AlfViewWidget::setModel(IAlfModel* /*aModel*/, bool /*aTakeOwnership*/) + { + //Do nothing. + } + +const char* AlfViewWidget::widgetName() const + { + return mWidget->widgetName(); + } + +void AlfViewWidget::setChildFocus(bool /*aFocus*/) + { + + } + +//--------------------------------------------------------------------------- +// Creates the presentation for the widget from XML. Destroys any existing +// presentation. +//--------------------------------------------------------------------------- +// +void AlfViewWidget::setPresentation (const char* aFilePath) + { + if(mWidget.get()) + { + mWidget->setPresentation(aFilePath); + } + } + +int AlfViewWidget::widgetCount() const + { + return mWidget->widgetCount(); + } + +void AlfViewWidget::addWidget(IAlfWidget& aWidget) + { + mWidget->addWidget(aWidget); + } + +IAlfWidget* AlfViewWidget::getWidget(int aIndex) const + { + return mWidget->getWidget(aIndex); + } + +int AlfViewWidget::getWidgetIndex(IAlfWidget& aWidget) const + { + return mWidget->getWidgetIndex(aWidget); + } + +void AlfViewWidget::removeWidget(int aIndex) + { + mWidget->removeWidget(aIndex); + } + +void AlfViewWidget::applyLayout(IAlfLayoutManager& aLayout) + { + mWidget->applyLayout(aLayout); + } + +IAlfInterfaceBase* AlfViewWidget::makeInterface(const IfId& aType) + { + // Type cast to IAlfWidget + if(!strcmp(aType.mImplementationId, IAlfWidget::type().mImplementationId)) + { + return static_cast(this); + } + + // Type cast to IAlfContainerWidget + if (!strcmp(aType.mImplementationId, IAlfContainerWidget::type().mImplementationId)) + { + return static_cast(this); + } + + // Type cast to IAlfViewWidget + if(!strcmp(aType.mImplementationId, IAlfViewWidget::type().mImplementationId)) + { + return static_cast(this); + } + + return mWidget->makeInterface(aType); + } + +void AlfViewWidget::notifyViewActivated(bool aIsActivated) + { + if(aIsActivated) + { + // Update control pane, status pane and background according to state of the view. + updateStatusPane(); + updateControlPane(); + // When a view is activated, it sets the size of the display to full screen + // This is done so that the view widget gets pointer events in the entire screen + TRect screenRect(TPoint(0,0), TSize(AlfUtil::ScreenSize())); + control()->Env().PrimaryDisplay().SetVisibleArea(screenRect); + setRect(mDisplayRect); + + // Restore the focus here + IAlfWidget* focusedWidget = 0; + focusedWidget = AlfWidgetEnvExtension::widgetFactory(*mEnv).findWidget(mFocusedChildWidgetID.c_str()); + if(focusedWidget == 0 && widgetCount() > 0) + { + focusedWidget = getWidget(0); + } + if(!mHasFocus) + { + mHasFocus = true; + if(focusedWidget != 0) + { + focusedWidget->control()->AcquireFocus(); + } + else + { + control()->AcquireFocus(); + } + } + } + else + { + // Cache and release the focus here + // FocusedControl function is not exported from the toolkit + CAlfControl* focusedCtrl = focusedControl(); + if(focusedCtrl) + { + CAlfWidgetControl* focusedWidgetControl = dynamic_cast(focusedCtrl); + if(focusedWidgetControl != 0) + { + mFocusedChildWidgetID = focusedWidgetControl->widget()->widgetName(); + } + focusedCtrl->RelinquishFocus(); + } + mHasFocus = false; + } + } + +CAlfControl* AlfViewWidget::focusedControl() + { + CAlfControl* focusedconnection = control(); + + // Iterate through the focused connections and return the control + // that has the focus. + while(focusedconnection != 0) + { + if(focusedconnection->Focus()) + { + // There should be no connections leading outside from the control + // group of the view. + assert(focusedconnection->ControlGroup() == mControlGroup); + return focusedconnection; + } + focusedconnection = focusedconnection->FocusedConnection(); + } + + return 0; + } + +void AlfViewWidget::show(bool aShow) + { + mShown = aShow; + if (aShow) + { + TRAPD(err, mDisplay->Roster().ShowL(*mControlGroup)); + if (err != KErrNone) + { + ALF_THROW(AlfViewWidgetException, err, "AlfViewWidget::show(): View Widget Show failed"); + } + } + else + { + // Notify this view that it is being deactivated. + notifyViewActivated(false); + + // Hide the control group + mDisplay->Roster().Hide(*mControlGroup); + } + } + +void AlfViewWidget::acceptEvents(bool aAccept) + { + assert(mControlGroup); + mControlGroup->SetAcceptInput(aAccept); + } + +void AlfViewWidget::enableStatusPane(bool aEnable) + { + if(aEnable != mStatusPaneEnabled) + { + mStatusPaneEnabled = aEnable; + + // Update status pane and background image state if this view is active. + if(getViewStackPosition() == 0) + { + updateStatusPane(); + } + } + } + +void AlfViewWidget::enableControlPane(bool aEnable) + { + if (aEnable != mControlPaneEnabled) + { + mControlPaneEnabled=aEnable; + + // Update control pane and background image state if this view is active. + if(getViewStackPosition() == 0) + { + updateControlPane(); + } + } + } + +void AlfViewWidget::useSkinBackground(bool aSkinBackground) + { + if(mSkinEnabled != aSkinBackground) + { + mSkinEnabled = aSkinBackground; + updateBackGroundImage(); + } + + } + +void AlfViewWidget::setSkinBackground(TAknsItemID aSkinID) + { + mSkinEnabled = true; + mSkinId = aSkinID; + updateBackGroundImage(); + } + +bool AlfViewWidget::shown() + { + return mShown; + } + +int AlfViewWidget::getViewStackPosition() const + { + int ret = 0; + const CAlfRoster& roster = mDisplay->Roster(); + + // Iterate through the control groups in the roster + for(int i = (roster.Count() - 1); i >= 0; --i) + { + CAlfControlGroup& group = roster.ControlGroup(i); + + // Compare the control group with this view's control group + if(mControlGroup == &group) + { + return ret; + } + + // Investigate whether this is a control group of a view widget + if(group.Count() > 0) + { + CAlfControl& control = group.Control(0); + if(dynamic_cast(&control) != 0) + { + ret++; + } + } + } + + return -1; + } + +bool AlfViewWidget::eventsAccepted() + { + assert(mControlGroup); + return mControlGroup->AcceptInput(); + } + +bool AlfViewWidget::statusPaneEnabled() + { + return mStatusPaneEnabled; + } + +bool AlfViewWidget::controlPaneEnabled() + { + return mControlPaneEnabled; + } + +bool AlfViewWidget::usingSkinBackground() + { + return mSkinEnabled; + } + +TAknsItemID AlfViewWidget::skinBackground() + { + return mSkinId; + } + +// --------------------------------------------------------------------------- +// Constructs components from node +// --------------------------------------------------------------------------- +// +void AlfViewWidget::constructComponentsFromNode(CAlfEnv& aEnv) + { + constructDefault(aEnv, false); + + //check, if the layoutmanager is already set. + IAlfLayoutManager* layoutManager = + IAlfInterfaceBase::makeInterface(control()); + if (!layoutManager) + { + setDefaultLayoutManager(); + } + } + +//--------------------------------------------------------------------------- +// Constructs widget using the presentation XML. Other widget parts +// are default. +//--------------------------------------------------------------------------- +// +void AlfViewWidget::constructFromPresentationXML(CAlfEnv& aEnv, const char* /**aFilePath*/) + { + constructDefault(aEnv, true); + } + +// --------------------------------------------------------------------------- +// Imperative construction +// --------------------------------------------------------------------------- +// +void AlfViewWidget::constructDefault(CAlfEnv& aEnv, bool aCreateLM) + { + TRAPD( err, + mControlGroup = &aEnv.NewControlGroupL(mControlGroupResourceId); + ); + + if(err != KErrNone) + { + if (err == KErrAlreadyExists) + { + ALF_THROW(AlfViewWidgetException, + EControlGroupAlreadyExists, "AlfViewWidget::AlfViewWidget() - Tried to create a control group with already existing ID."); + } + else + { + ALF_THROW(AlfViewWidgetException, + err, "AlfViewWidget::AlfViewWidget() - Control group creation failed."); + } + } + + // Create control for the view widget + auto_ptr control( new (EMM) CAlfViewControl(aEnv, *this) ); + setControl(control.get()); + control.release(); + + if (aCreateLM) + { + setDefaultLayoutManager(); + } + } + +// --------------------------------------------------------------------------- +// Imperative createDefaultLayoutManager +// --------------------------------------------------------------------------- +// +void AlfViewWidget::setDefaultLayoutManager() + { + // A root layout covering the entire display is created to grab all pointer events in the screen + // Note that this layout is just dummy and does not do any actual layouting + CAlfControl* ctrl = (CAlfControl*)control(); + CAlfLayout* fullDisplayLayout = CAlfLayout::AddNewL(*ctrl); + + // Default layout manager provided by the view widget + auto_ptr layoutManager(new (EMM) AlfAnchorLayoutManager()); + this->applyLayout(*layoutManager.get()); + + layoutManager.release(); + } + +void AlfViewWidget::updateStatusPane() + { + /*CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + if(sp) + { + sp->MakeVisible(mStatusPaneEnabled); +// mDisplay->SetVisibleArea(CEikonEnv::Static()->AppUiFactory()->ClientRect()); + }*/ + } + +void AlfViewWidget::updateControlPane() + { + /*CEikButtonGroupContainer* cba= CEikonEnv::Static()->AppUiFactory()->Cba(); + if(cba) + { + cba->MakeVisible(mControlPaneEnabled); +// mDisplay->SetVisibleArea(CEikonEnv::Static()->AppUiFactory()->ClientRect()); + }*/ + + } + +void AlfViewWidget::updateBackGroundImage() + { + TAknsItemID skinId=KAknsIIDQsnBgScreen; + // Do background related stuff only if the view is showing + if(mSkinEnabled ) + { + skinId=mSkinId; + } + if(mShown) + { + TAlfDisplayBackgroundItem bgItem(mDisplay->VisibleArea(),skinId); + RArray bgItemArray; + bgItemArray.Append(bgItem); + TRAPD(err,mDisplay->SetBackgroundItemsL(bgItemArray)); + if(err!=KErrNone) + { + ALF_THROW(AlfViewWidgetException, err,"Skin Background could not be set"); + } + bgItemArray.Reset(); + } + + } + + +void AlfViewWidget::HandleActionL(const TAlfActionCommand& aActionCommand) + { + if(KAlfActionIdDeviceLayoutChanged == aActionCommand.Id()) + { + TAlfCustomEventCommand command(KAlfActionIdDeviceLayoutChanged); + control()->Env().Send(command,0); + if(mShown && getViewStackPosition() == 0) + { + TRect screenRect(TPoint(0,0), TSize(AlfUtil::ScreenSize())); + + // SetVisibleArea() only have an effect if the application is on foreground! + control()->Env().PrimaryDisplay().SetVisibleArea(screenRect); + } + + } + + else if(KAlfActionIdForegroundGained == aActionCommand.Id()) + { + + TRect screenRect(TPoint(0,0), TSize(AlfUtil::ScreenSize())); + + // SetVisibleArea() only have an effect if the application is on foreground! + + control()->Env().PrimaryDisplay().SetVisibleArea(screenRect); + + + } + + } + +TBool AlfViewWidget::OfferEventL(const TAlfEvent& /*aEvent*/) + { +/* if(aEvent.IsCustomEvent() && aEvent.CustomParameter() == KAlfActionIdDeviceLayoutChanged) + { + if(mShown && getViewStackPosition() == 0) + { + //need to do this to overwrite the displayrect done by menuApp + // TRect rect= control()->Env().PrimaryDisplay().VisibleArea(); + // control()->Env().PrimaryDisplay().SetVisibleArea(mDisplayRect); + updateBackGroundImage(); + } + return ETrue; + } + */ return EFalse; + } + +void AlfViewWidget::setRect(const TRect& aRect) + { + mDisplayRect = aRect; + + IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface(control()); + if (layoutManager) + { + // Set the area of the root layout of the view widget to the one specified + CAlfLayout& layout = layoutManager->getLayout(); + layout.SetFlag(EAlfVisualFlagManualLayout); + TAlfRealRect rect(mDisplayRect); + layout.SetRect(rect); + } + + TRect visibleRect = control()->Env().PrimaryDisplay().VisibleArea(); + TRect screenRect(TPoint(0,0), TSize(AlfUtil::ScreenSize())); + + if(visibleRect != screenRect && getViewStackPosition() == 0) + { + // the display area is required to be full screen, for the pointer grab to work + // check here whether the display area is full screen. If not, set it to full screen + control()->Env().PrimaryDisplay().SetVisibleArea(screenRect); + } + } + + } //Alf + + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/src/alfviewwidgetexception.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/src/alfviewwidgetexception.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 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: View widget exception class. +* +*/ + + +#include "alfviewwidgetexception.h" + +using namespace Alf; + +AlfViewWidgetException::AlfViewWidgetException(int aError) throw() + : osncore::AlfException(aError) + { + } + +AlfViewWidgetException::AlfViewWidgetException(int aError, const char* aInfo) throw() + : osncore::AlfException(aError, aInfo) + { + mDescription = osncore::UString(aInfo); + } + +AlfViewWidgetException::AlfViewWidgetException(int aError, const char* aInfo, const char* aFileAndLine) throw() + : osncore::AlfException(aError, aInfo, aFileAndLine) + { + mDescription = osncore::UString(aInfo); + mDescription.append(aFileAndLine); + } + +AlfViewWidgetException::~AlfViewWidgetException() throw() + { + } + +const char* AlfViewWidgetException::what() const throw() + { + return mDescription.getUtf8(); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/alfviewwidget/src/alfviewwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/alfviewwidget/src/alfviewwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,122 @@ +/* +* 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: view widget factory pluging implementation. +* +*/ + + +#include +#include +#include +#include +#include "alfviewwidget.h" +#include "alfviewwidgetexception.h" +#include "alfviewwidgetfactoryplugin.h" + +using namespace Alf; + +// UID of the view widget factory plugin. +const TInt KViewWidgetFactoryPluginUid = {0x20010104}; + +// Amount of products produced by this factory. +const int KProductCount = 1; + +AlfViewWidgetFactoryPlugin* AlfViewWidgetFactoryPlugin::newL() + { + return new (EMM) AlfViewWidgetFactoryPlugin(); + } + +IAlfInterfaceBase* AlfViewWidgetFactoryPlugin::createProduct(const char* aProduct, void* aInitData) + { + AlfViewWidget* ret(0); + + if(!strcmp(aProduct, IAlfViewWidget::type().mImplementationId)) + { + // Typecast the initialization data + AlfViewWidgetInitData* initData = (AlfViewWidgetInitData*) aInitData; + + // Throw exception if init data is null + if(initData == 0) + { + ALF_THROW(AlfViewWidgetException, EInitializationError, "View widget initialization data was NULL."); + } + + // Assert that the UI Accelerator Toolkit Environment in the initialization data is correct. + if(initData->mEnv == 0) + { + ALF_THROW(AlfViewWidgetException, EInitializationError, "Environment instance in view widget initialization data was NULL."); + } + + // Assert that widget id in the initialization data is correct. + if(initData->mWidgetId == 0) + { + ALF_THROW(AlfViewWidgetException, EInitializationError, "Widget ID in view widget initialization data was NULL."); + } + + + // Assert that display pointer in the initialization data is correct. + if(initData->mDisplay == 0) + { + ALF_THROW(AlfViewWidgetException, EInitializationError, "Display instance in view widget initialization data was NULL."); + } + + // Create container widget + ret = new (EMM) AlfViewWidget(initData->mWidgetId, initData->mControlGroupId, *initData->mEnv, + *initData->mDisplay, initData->mNode, initData->mFilePath); + } + + return static_cast(ret); + } + +int AlfViewWidgetFactoryPlugin::productCount() const + { + return KProductCount; + } + +const char* AlfViewWidgetFactoryPlugin::productInfo(int aIndex) const + { + switch(aIndex) + { + case 0: return alfviewwidget::ident.mImplementationId; + default: break; + } + + return 0; + } + +IAlfInterfaceBase* AlfViewWidgetFactoryPlugin::makeInterface(const IfId& aType) + { + if(!strcmp(aType.mImplementationId, IAlfFactoryPlugin::type().mImplementationId)) + { + return static_cast(this); + } + + return 0; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KViewWidgetFactoryPluginUid, + AlfViewWidgetFactoryPlugin::newL ) + }; + +// Entry point for ECom architecture to resolve the instantiation method pointer +// for a given implementation UID. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/bwins/mulutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/bwins/mulutilityu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,17 @@ +EXPORTS + ?IsLandscape@MulUtility@Alf@@SA_NXZ @ 1 NONAME ; bool Alf::MulUtility::IsLandscape(void) + ?IsQwerty@MulUtility@Alf@@SA_NXZ @ 2 NONAME ; bool Alf::MulUtility::IsQwerty(void) + ??0MulVisualUtility@Alf@@QAE@XZ @ 3 NONAME ; Alf::MulVisualUtility::MulVisualUtility(void) + ?IsSVGImage@MulImageVisualAttributeSetter@Alf@@QAE_NABVUString@osncore@@@Z @ 4 NONAME ; bool Alf::MulImageVisualAttributeSetter::IsSVGImage(class osncore::UString const &) + ?LoadImageFromSvg@MulImageVisualAttributeSetter@Alf@@QAEXABVUString@osncore@@AAVCAlfImageVisual@@@Z @ 5 NONAME ; void Alf::MulImageVisualAttributeSetter::LoadImageFromSvg(class osncore::UString const &, class CAlfImageVisual &) + ?parseLCTInfo@MulVisualUtility@Alf@@QAEXABULCTPair@2@PAVCAlfLayout@@@Z @ 6 NONAME ; void Alf::MulVisualUtility::parseLCTInfo(struct Alf::LCTPair const &, class CAlfLayout *) + ?AbsolutePath@MulUtility@Alf@@SA_NAAVUString@osncore@@@Z @ 7 NONAME ; bool Alf::MulUtility::AbsolutePath(class osncore::UString &) + ?data@MulVisualUtility@Alf@@QBEABULCTData@2@XZ @ 8 NONAME ; struct Alf::LCTData const & Alf::MulVisualUtility::data(void) const + ??0MulImageVisualAttributeSetter@Alf@@QAE@XZ @ 9 NONAME ; Alf::MulImageVisualAttributeSetter::MulImageVisualAttributeSetter(void) + ?IsPoolResource@MulUtility@Alf@@SA_NABVUString@osncore@@@Z @ 10 NONAME ; bool Alf::MulUtility::IsPoolResource(class osncore::UString const &) + ?LoadImageFromTexture@MulImageVisualAttributeSetter@Alf@@QAEXHAAVCAlfImageVisual@@@Z @ 11 NONAME ; void Alf::MulImageVisualAttributeSetter::LoadImageFromTexture(int, class CAlfImageVisual &) + ??1MulImageVisualAttributeSetter@Alf@@UAE@XZ @ 12 NONAME ; Alf::MulImageVisualAttributeSetter::~MulImageVisualAttributeSetter(void) + ??1MulVisualUtility@Alf@@QAE@XZ @ 13 NONAME ; Alf::MulVisualUtility::~MulVisualUtility(void) + ?setAttributeValue@MulImageVisualAttributeSetter@Alf@@EAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 14 NONAME ; void Alf::MulImageVisualAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?parseLCTTextInfo@MulVisualUtility@Alf@@QAEXXZ @ 15 NONAME ; void Alf::MulVisualUtility::parseLCTTextInfo(void) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/eabi/mulutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/eabi/mulutilityu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +EXPORTS + _ZN3Alf10MulUtility11IsLandscapeEv @ 1 NONAME + _ZN3Alf10MulUtility12AbsolutePathERN7osncore7UStringE @ 2 NONAME + _ZN3Alf10MulUtility14IsPoolResourceERKN7osncore7UStringE @ 3 NONAME + _ZN3Alf10MulUtility8IsQwertyEv @ 4 NONAME + _ZN3Alf16MulVisualUtility12parseLCTInfoERKNS_7LCTPairEP10CAlfLayout @ 5 NONAME + _ZN3Alf16MulVisualUtility16parseLCTTextInfoEv @ 6 NONAME + _ZN3Alf16MulVisualUtilityC1Ev @ 7 NONAME + _ZN3Alf16MulVisualUtilityC2Ev @ 8 NONAME + _ZN3Alf16MulVisualUtilityD1Ev @ 9 NONAME + _ZN3Alf16MulVisualUtilityD2Ev @ 10 NONAME + _ZN3Alf29MulImageVisualAttributeSetter10IsSVGImageERKN7osncore7UStringE @ 11 NONAME + _ZN3Alf29MulImageVisualAttributeSetter16LoadImageFromSvgERKN7osncore7UStringER15CAlfImageVisual @ 12 NONAME + _ZN3Alf29MulImageVisualAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 13 NONAME + _ZN3Alf29MulImageVisualAttributeSetter20LoadImageFromTextureEiR15CAlfImageVisual @ 14 NONAME + _ZN3Alf29MulImageVisualAttributeSetterC1Ev @ 15 NONAME + _ZN3Alf29MulImageVisualAttributeSetterC2Ev @ 16 NONAME + _ZN3Alf29MulImageVisualAttributeSetterD0Ev @ 17 NONAME + _ZN3Alf29MulImageVisualAttributeSetterD1Ev @ 18 NONAME + _ZN3Alf29MulImageVisualAttributeSetterD2Ev @ 19 NONAME + _ZNK3Alf16MulVisualUtility4dataEv @ 20 NONAME + _ZTI16CKeyBoardUtility @ 21 NONAME ; ## + _ZTI17CQwertySubscriber @ 22 NONAME ; ## + _ZTIN3Alf29MulImageVisualAttributeSetterE @ 23 NONAME ; ## + _ZTV16CKeyBoardUtility @ 24 NONAME ; ## + _ZTV17CQwertySubscriber @ 25 NONAME ; ## + _ZTVN3Alf29MulImageVisualAttributeSetterE @ 26 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,38 @@ +/* +* 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: Build information file for project ?myapp +* +*/ + + +#include + +PRJ_PLATFORMS + +ARMV5 WINSCW +PRJ_EXPORTS + +../rom/mulutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mulutility.iby) + + +PRJ_MMPFILES + +mulxmlutility.mmp + + +PRJ_TESTMMPFILES + + + +PRJ_TESTEXPORTS diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/group/mulxmlutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/group/mulxmlutility.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ + + +#include +//#include "../../../group/stdinc.mmh" //for STL includes + +TARGET mulutility.dll +TARGETTYPE dll +UID 0x1000008D 0x2000FA83 + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE mulimagevisualattributesetter.cpp +SOURCE mulutility.cpp +SOURCE mulkeyboardutility.cpp +SOURCE mulvisualutility.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../mullogging/inc +USERINCLUDE ../../../inc + + +MW_LAYER_SYSTEMINCLUDE + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +// Alf Libraries +LIBRARY alfclient.lib +LIBRARY alfwidgetmodel.lib +LIBRARY alfwidgetutils.lib + + +// Osn Libraries +LIBRARY osncore.lib + +// STL Libraries +LIBRARY libstdcpp.lib + + +// System Libraries +LIBRARY aknskins.lib +LIBRARY charconv.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknlayout2hierarchy.lib +LIBRARY cdlengine.lib + +LIBRARY libc.lib +LIBRARY libpthread.lib +LIBRARY estor.lib +LIBRARY mulmodelutility.lib +LIBRARY mullogging.lib +LIBRARY alfresourcepool.lib //for resource pool + +LIBRARY efsrv.lib // for rfile,rfs + +LANG SC + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/imulembedablewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/imulembedablewidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 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: Interface for embedabld widget +* +*/ + + +#ifndef I_MULEMBEDABLEWIDGET_H +#define I_MULEMBEDABLEWIDGET_H +#include +#include +namespace Alf + { + +/** @class IMulEmbedableWidget + * @brief Interface for Embedable widget. + * + * Every widget that can be embeded need to implement this interface. + * Parent widget will use this interface to access embeded widget. + */ +class IMulEmbedableWidget + { +public: + + /** + * Set/Update data of Embeded widget. + * Parent widget will provides its own visual item as parameter + * embeded widget will have to construct new visual item from provided visual item + * and remove unwanted attributes and call update on singel item model. + * + * @param aItem Parent widget's data in visual item format + */ + virtual void SetData(const MulVisualItem& aItem) = 0; + + + /** + * Return data in format of visual item. + * Parent will used this api to update its own data model. + * + * @return Data of embeded widget + */ + virtual const MulVisualItem& Data() = 0; + + /** + * Add as eventhandler for embeded widget. + * Parent will use this api to add itself and client as event handler of child widget. + * + * @param aHandler Event handler + */ + virtual void AddEventHandler( IAlfWidgetEventHandler& aHandler ) = 0; + + /** + * Remove as eventhandler form embeded widget. + * Parent can remvoe itself and client as event handler using this api + * + * @param aHandler Event handler + */ + virtual void RemoveEventHandler( IAlfWidgetEventHandler& aHandler ) = 0; + + /** + * Return container layout of embeded widget + * Parent can use this api to show or hide widget and position child widget. + * + * @return Layout of embeded widget. + */ + virtual const CAlfLayout& ContainerLayout() = 0; + + }; + + + } // namespace Alf + +#endif // I_MULEMBEDABLEWIDGET_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/imulmodelobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/imulmodelobserver.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of model interface + * +*/ + + +#ifndef I_MULMODEOBSERVER_H +#define I_MULMODEOBSERVER_H + +#include + +namespace Alf + { + +//Forward Declaration +class IMulVariantType; + +/** + * Observer interface to provide notification about model state change. + * Widget needs to implement this interface to get highlight or marking change event. + */ +class IMulModelObserver //: public IAlfModelChangeObserver + { + +public: //enum + + /** + *Changed state of model + */ + enum TMulChangedState + { + EHighlightChanged = 1, + EMarkingChanged, + EDataWindowUpdated, + EItemsInserted, + EItemsRemoved, + EItemUpdated, + ETemplateChanged, + EModelRefreshed + }; + +public: //method + + /** + * Notify observer about IMulModel state change. + * Observer will be notified when highlight or marking is changed from model. + * + * @param aState Highlight or making changed + * @param aData Index of new highlight or Index of marked or unmarked item. + * ( Item is marked or not should be checked using IMulModelAccessor interface) + */ + virtual void ModelStateChanged( TMulChangedState aState, IMulVariantType& aData ) = 0; + + }; + + } // Namespace Alf + +#endif //I_MULMODEOBSERVER_H + +//End of file + \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulassert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulassert.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007-2008 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: Implementation for Assert Macros +* +*/ + + +#ifndef MULASSERT_H_ +#define MULASSERT_H_ + +#include +#include + +/** + * Assert macro. + * It checks expression if expression is evaluated false then panic with specified code. + * + * @param x Result after expression is evaluated + * @param y Error code for Assertion fail + */ +#define __MUL_ASSERT(x,y) __ASSERT_ALWAYS(x,User::Panic(y,0)) + + + +/** + * Assert Macro for debug version. + * It checks expression if expression is evaluated false then panic with specified code. + * + * @param x bool result after expression is evaluated + * @param y Error code for Assertion fail + */ +#define __MUL_ASSERT_DEBUG(x,y) __ASSERT_DEBUG(x,User::Panic(y,0)) + +namespace Alf + { + +/** +* Assert function. +* It takes tamplate argument that is used kind of expceton that need to be thrown. +* It checks expression if expression is evaluated false then it throws logic exception. +* +* @param aExpression bool result after expression is evaluated +* @param aExceptionString description of error +*/ +template +static void MUL_ASSERT(bool aExpression, const char* aExceptionString) + { + if( !aExpression ) + { + throw X(aExceptionString); + } + } + + + +/** + * Assert function for debug version. + * It takes tamplate argument that is used kind of expceton that need to be thrown. + * It checks expression if expression is evaluated false then it throws logic exception. + * + * @param aExpression bool result after expression is evaluated + * @param aExceptionString description of error + */ +template +static void MUL_ASSERT_DEBUG(bool aExpression, const char* aExceptionString) + { +#ifdef _DEBUG + + if( !aExpression ) + { + throw X( aExceptionString ); + } + +#endif // _DEBUG + } + + + + } // namespace Alf + +#endif // MULASSERT_H_ + +// End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulimagevisualattributesetter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulimagevisualattributesetter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2007 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: Custmized image attribute setter for MulWidgets + * +*/ + + +#ifndef MULIMAGEVISUALATTRIBUTESETTER_H +#define MULIMAGEVISUALATTRIBUTESETTER_H + +#include +#include "alf/alfimagevisualattributesetter.h" + +namespace Alf + { + +class MulImageVisualAttributeSetterImpl; +/** + * The implementation of the attribute setter. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class MulImageVisualAttributeSetter : public AlfImageVisualAttributeSetter + { +public: + + /** + * Constructor. + * + * @param aType Type of the attribute setter. + */ + OSN_IMPORT MulImageVisualAttributeSetter(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~MulImageVisualAttributeSetter(); + +private: // from AlfImageVisualAttributeSetter + + void handleStaticDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData); + + void handleStaticAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + + void setAttributeValue ( CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ); + + void handleDynamicDataAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData); + + void handleDynamicAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer); + +public: //new method + + /** + * Checks the given file path is of SVG image or not + * + * @param aImagePath Path of the image file,which need to be checked for SVG file format. + */ + OSN_IMPORT bool IsSVGImage(const UString& aImagePath); + + /** + * Load Image visual with image provided from file path + * + * @param aSvgFilePath path of Image + * @param aImageVisual visual on with image to be loaded + */ + OSN_IMPORT void LoadImageFromSvg(const UString& aSvgFilePath,CAlfImageVisual& aImageVisual ); + + /** + * Apply texture on Image visual + * + * @param aTextureId Texture id + * @param aImageVisual visual on with image to be loaded + */ + OSN_IMPORT void LoadImageFromTexture( int aTextureId,CAlfImageVisual& aImageVisual ); + +private: // data + + auto_ptr mImpl; + auto_ptr mImageAttrSetter; + IAlfMap* mData; + }; + +} // namespace Alf + +#endif // MULIMAGEVISUALATTRIBUTESETTER_H + +//end of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulitemdefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulitemdefinitions.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007-2008 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: header for defining all the common variables +* +*/ + + + + +#ifndef __MULITEMDEFINITIONS_H__ +#define __MULITEMDEFINITIONS_H__ + +namespace Alf + { + + // Defines the values for visual for states highlight/non-highlight. + // portrait / landscape + enum MulItemType + { + ENonHighlight = 0, + EHighlight + }; + + } //namespace Alf + +#endif //MULITEMDEFINITIONS + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulkeyboardutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulkeyboardutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for keyboard handling + * +*/ + + +#ifndef MULKEYBOARDUTILITY_H_ +#define MULKEYBOARDUTILITY_H_ + +#include +#include +#include +#include +#include +#include // KAknQwertyInputModeActive +#include + + class CQwertySubscriber : public CActive + { + public: + CQwertySubscriber(TCallBack aCallBack, RProperty& aProperty); + ~CQwertySubscriber(); + + public: // New functions + + void SubscribeL(); + void StopSubscribe(); + + private: // from CActive + + void RunL(); + void DoCancel(); + + private: + TCallBack iCallBack; + RProperty& iProperty; + }; + +class CKeyBoardUtility: public CCoeStatic +{ + public: + static CKeyBoardUtility* NewL(); + private: + static TInt QwertyModeChangeNotification(TAny* aObj); + private: + ~CKeyBoardUtility(); + CKeyBoardUtility(); + bool bQwerty; + /** Qwerty Notification */ + CQwertySubscriber* iQwertyModeStatusSubscriber; + RProperty iQwertyModeStatusProperty; + void HandleQwertyModeChangeNotification(); + public: + bool IsQwerty(); +}; +#endif //MULKEYBOARDUTILITY_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulleave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulleave.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007-2008 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: Implementation for Leave to Throw macro +* +*/ + + +#ifndef MULLEAVE_H +#define MULLEAVE_H + +#include + +namespace Alf + { + +static const char* const KLeaveError = "Leave occured"; + +class MulLeave + { + +public: + + static void ThrowOnError( int aError ) + { + switch ( aError ) + { + case KErrNone: + { + // do nothing + break; + } + + case KErrNoMemory: + { + throw std::bad_alloc(); + } + + // add other errors here if specific exception need to throw + case KErrGeneral: // fall through + default: + { + throw std::logic_error( KLeaveError ); + } + } + } + }; + + } // namespace Alf + +#define THROW_IF_LEAVES(code) TRAPD( _leave_error, { code; } ); \ + Alf::MulLeave::ThrowOnError( _leave_error ); + +#endif // MULLEAVE_H + +// End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/multemplateinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/multemplateinterface.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 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: xml parser header +* +*/ + + +#ifndef MULTEMPLATEINTERFACE_H +#define MULTEMPLATEINTERFACE_H + +#include +#include +#include +#include + +//#include "mulplaintexteditor.h" + +namespace duiuimodel + { + class DuiNode; + } +using namespace duiuimodel; + +namespace Alf + { + +//Forward declarations +class MulXmlUtility; +class IAlfMap; + +class MulTemplateInterface + { + +public: + + /** + * Display Area. + * + * @returns the display are of the control. + */ + virtual TRect Displayarea() = 0; + + /** + * Data for the item. + * + * @aItemIndex index of the item. + * @returns data map of the item at the index. + */ + virtual IAlfMap* RootData(int aItemIndex) = 0; + + /** + * Get the xml utility. + * + * @returns MulXmlUtility. + */ + virtual MulXmlUtility& GetMulXmlUtlity() = 0; + + /** + * Get the path where the xmls are stored. + * + * @returns the path. + */ + virtual UString ResourcePath() = 0; + + /** + * Gets the template Attribute Name. + */ + virtual UString TemplateAttribute() = 0; + + /** + * Gets the embedded widget load name. + */ + virtual UString EmbedWidgetName() = 0; + + /** + * Checks if the visual passed as argument belongs to the highlighted item + * + * @param aVisual The visual to be checked if it belongs to the highlighted item. + * @returns True: If aVisual corresponds to highlight item. otherwise, False. + */ + virtual bool IsHighlightVisual(CAlfVisual& aVisual) = 0; + + /** + * Return image scale mode + * + * @return Scale mode + */ + virtual CAlfImageVisual::TScaleMode ScaleMode() = 0; + + /** + * Return images should be scaled or not + * + * @return true if scaling should be applied, else false + */ + virtual bool ApplyScaleMode() = 0; + + /** + * Gets the plain text editor control + * + * @return MulPlainTextEditor wraped in layout. + */ + //virtual MulPlainTextEditor* PlainTextEditor() = 0; + + /** + * Gets the root node of the current template. + * + * @return DuiNode pointer. + */ + virtual DuiNode* TemplateRootNode() = 0; + + virtual bool IsHomogeneous() = 0; + + + /** + * To Get the background is transparent or not. + */ + virtual bool BackGroundTransparency() = 0; + + + }; //class + + } // namespace + +#endif + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mului.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mului.hrh Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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: Defines flags to enable debug macros +* +*/ + + +#ifndef MULUI_HRH +#define MULUI_HRH + +//Enable performance logs +#undef MUL_DEBUG_PERFORMANCE +//#define MUL_DEBUG_PERFORMANCE + + +#endif //MULUI_HRH diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007-2008 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: Implementation for utility class +* +*/ + + +#ifndef MULUTILITY_H_ +#define MULUTILITY_H_ + +#include +#include +#include +#include +#include "mulkeyboardutility.h" + +namespace osncore + { + class UString; + } + +using namespace osncore; + +namespace Alf + { + +static void MUL_ASSERT(bool aExpression, const char* aExceptionString) + { + if( aExpression ) + { + throw std::logic_error(aExceptionString); + } + } + +class MulUtility + { +public: + /** + * Converts the relative path to the absolute path. + * + * @param aRelativePath Which needs to be changed to the absolutepath. + * @return true , if aRelativepath changed to Absoulte path or else false + */ + OSN_IMPORT static bool AbsolutePath(UString& aRelativePath); + + /** + * Checks which orienatation the application is in and returns true if it is in + * Landscape orientation otherwise returns false + * + */ + OSN_IMPORT static bool IsLandscape(); + + /** + * Checks if the given string tag is a pool resource or not + * + * @param aImageTag Path of the image file,which needs to be checked for resource tag format. + */ + OSN_IMPORT static bool IsPoolResource(const UString& aImageTag); + + /** + * Checks if current KeyBoard is QWERTY + * @return true if KeyBoard is QWERTY else false. + */ + OSN_IMPORT static bool IsQwerty(); + +private: + /** + * Checks the file for its existence + * + * @param afilePath File to be checked. + * @return true, In case file exists or else false. + */ + static bool IsFileExists(/*const char* afilePath*/const TDesC& aFilePath); + + + + }; + + } // namespace Alf + +#endif // MULUTILITY_H_ + +// End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/inc/mulvisualutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/inc/mulvisualutility.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,728 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for widgets visualization in terms of LCT data +* +*/ + + +#ifndef MULVISUALUTILITY_H_ +#define MULVISUALUTILITY_H_ + +#include +#include + +// Avkon Includes +#include +#include +#include + +// OpenC Includes +#include +#include + +#include +using namespace osncore; + +namespace Alf + { + +enum TMulCurrentOrientation + { + EMulPortrait, + EMulLandScape + }; +/** + * Different visual types + */ +enum TMulLCTVisualType + { + EVisualImage = 0, + EVisualText + }; + +/** + * Different attribute types + */ +enum TMulCustomAttributeType + { + EAttributeNone, + EAttributeCategory, + EAttributeOpacity, + EAttributeStyle, + EAttributeFontthemecolor, + EAttributeHAlign, + EAttributeVAlign + }; + +/** + * Different Category types + */ +enum TMulAttributeCategoryType + { + ECategoryInvalid, + ECategoryData, + ECategoryStaticData + }; + +/** + * Co-ordinate data + */ +struct LCTData + { + int mPosX; + int mPosY; + int mWidth; + int mHeight; + int mFontId; + }; + +/** + * LCT Id and variety + */ +struct LCTPair + { + UString mLctId; + int mVariety; + }; + +// --------------------------------------------------------------------------- +// Class to hold attributes name and value +// --------------------------------------------------------------------------- +// +class CustomAttributeStructure + { +public: + + /** + * Constructor + * + * @param aName Name of the Attribute + * @param aTargetVal Value the Attribute + * @param aAttributeType Name of the Attribute + * @param aCategoryType Name of the Attribute + * + * + */ + CustomAttributeStructure(const UString& aName, const UString& aTargetVal, + TMulCustomAttributeType aAttributeType = EAttributeNone, + TMulAttributeCategoryType aCategoryType = ECategoryInvalid): + mName(aName), + mTargetVal(aTargetVal), + mAttributeType(aAttributeType), + mCategoryType(aCategoryType) + + { + mLctPair.mLctId = UString(""); + mLctPair.mVariety = -1; + } + + /** + * Constructor + * + * @param aName Name of the Attribute + * @param aLctInfo LCT information of the custom attribute + * @param aAttributeType Name of the Attribute + * @param aCategoryType Name of the Attribute + * + * + */ + CustomAttributeStructure(const UString& aName, const LCTPair& aLctInfo, + TMulCustomAttributeType aAttributeType = EAttributeNone, + TMulAttributeCategoryType aCategoryType = ECategoryInvalid): + mName(aName), + mTargetVal(""), + mAttributeType(aAttributeType), + mCategoryType(aCategoryType) + + { + mLctPair.mLctId = aLctInfo.mLctId; + mLctPair.mVariety = aLctInfo.mVariety; + } + + /** + * Sets the name of the custom attribute + * + * @param aName Name of the custom attribute + * @return nothing + * + */ + void SetName(const UString& aName) {mName = aName;} + + /** + * Sets the value the custom attribute + * + * @param aTarget Value of the custom attribute + * @return nothing + * + */ + void SetTargetValue(const UString& aTarget) {mTargetVal = aTarget; } + + /** + * Get the name of attribute + * + * + * @return Name of the attribute + * + */ + const UString GetName() const {return mName; } + + /** + * Get the value of the attribute + * + * + * @return Value of the attribute + * + */ + const UString GetTargetvalue() const {return mTargetVal;} + + /** + * Sets the attribute type the custom attribute + * + * @param aAttributeType Attribute type of the custom attribute + * @return nothing + * + */ + void SetAttributeType(TMulCustomAttributeType aAttributeType) {mAttributeType = aAttributeType;} + + /** + * Sets the Category type the custom attribute + * + * @param aCategoryType Category type of the custom attribute + * @return nothing + * + */ + void SetCategoryType(TMulAttributeCategoryType aCategoryType) {mCategoryType = aCategoryType;} + + /** + * Get the attribute type of the attribute + * + * + * @return TMulCustomAttributeType + * + */ + TMulCustomAttributeType AttributeType() const {return mAttributeType;} + + /** + * Get the category type of the attribute + * + * + * @return TMulAttributeCategoryType + * + */ + TMulAttributeCategoryType CategoryType()const {return mCategoryType;} + + /** + * Get the LCT information of attribute + * + * + * @return LCTPair + * + */ + const LCTPair& GetLctPair() + { + return mLctPair; + } + +private: + + /** + * Attribute name + */ + UString mName; + + /** + * Attribute value + */ + UString mTargetVal; + + /** + * Attribute type + */ + TMulCustomAttributeType mAttributeType; + + /** + * Attribute Category type + */ + TMulAttributeCategoryType mCategoryType; + + /** + * LCT Id and variety + */ + LCTPair mLctPair; + }; + + +// --------------------------------------------------------------------------- +// Class to hold a visual's attributes +// --------------------------------------------------------------------------- +// +class LCTVisualStructure + { +public: + + /** + * Default Constructor + * + */ + LCTVisualStructure() + { + + } + + /** + * Destructor + * + */ + ~LCTVisualStructure() + { + for(int i =0; i < mAttributeStructure.size(); i++) + { + delete mAttributeStructure[i]; + } + mAttributeStructure.clear(); + } + + /** + * Sets the LCT Id of the visual Structure (part of LCT information of Visual Structure) + * + * @param aId LCT Id of Visual Structure + * @return nothing + * + */ + void SetLCTId(const UString& aId) {mLctPair.mLctId = aId;} + + /** + * Sets the Variety Id of the visual Structure (part of LCT information of Visual Structure) + * + * @param aId Variety Id of Visual Structure + * @return nothing + * + */ + void SetVarietyId(int aId) {mLctPair.mVariety = aId;} + + /** + * Gets the LCT Id of the visual Structure (part of LCT information of Visual Structure) + * + * @return nothing + * + */ + const UString GetLCTId() const {return mLctPair.mLctId; } + + /** + * Gets the Variety Id of the visual Structure (part of LCT information of Visual Structure) + * + * @return nothing + * + */ + const int GetVarietyId() const {return mLctPair.mVariety;} + + /** + * Sets the type of visual this structure contains (can be either image/text) + * + * @param aVisualType EVisualImage/EVisualText + * @return nothing + * + */ + void SetVisualType(const TMulLCTVisualType aVisualType) {mVisualType = aVisualType; } + + /** + * Gets the visual type of the visual Structure + * + * @return TMulLCTVisualType + * + */ + TMulLCTVisualType VisualType()const { return mVisualType;} + + /** + * Adds a Custom attribute structure to this visual structure + * + * @param aAttr Custom Attribute structure to be added + * + * + */ + void AddAttribute(CustomAttributeStructure* aAttr) + { + if(aAttr) + mAttributeStructure.push_back(aAttr); + } + + /** + * Gets a Custom attribute structure at a specified index in this visual structure + * + * @param aIndex Index at which the attribute struct desired + * @return CustomAttributeStructure, NULL if no attribute is found + * + */ + const CustomAttributeStructure* GetAttribute(int aIndex) const + { + if(aIndex >=0 && aIndex < mAttributeStructure.size()) + return mAttributeStructure[aIndex]; + else + return NULL; + } + + /** + * Gets a Custom attribute structure by name in this visual structure + * + * @param aAttrName Name of the attribute struct desired + * @return CustomAttributeStructure, NULL if no attribute is found + * + * + */ + const CustomAttributeStructure* GetAttributeByName(const UString& aAttrName) const + { + for (vector::const_iterator it = mAttributeStructure.begin(); + it!=mAttributeStructure.end(); ++it) + { + if(!strcmp(((*it)->GetName()).getUtf8(),aAttrName.getUtf8())) + return *it; + } + return NULL; + } + + /** + * Gets the current attribute count + * + * @return total number of attributes + * + */ + int AttributeCount() const + { + return mAttributeStructure.size(); + } + + /** + * Sets the Id of the visual Structure + * + * @param aId Identifier of Visual Structure + * @return nothing + * + */ + void SetId(const UString& aId) {mId = aId;} + + /** + * Gets the Id of the visual Structure + * + * @return Identifier of the visual structure + * + */ + UString GetId() const { return mId; } + + void SetPositions(int x,int y) + { + mX = x; + mY = y; + } + void SetDimensions(int width,int height) + { + mW = width; + mH = height; + } + int PositionX() const {return mX;} + int PositionY() const {return mY;} + int Width() const {return mW;} + int Height() const {return mH;} + /** + * Gets the LCT Information of the visual Structure + * + * @return LCTPair + * + */ + const LCTPair& GetLctPair() + { + return mLctPair; + } + + +private: + + /** + * Class to hold attributes name and value + * + */ + UString mId; + + /** + * LCT Id and variety + */ + LCTPair mLctPair; + + /** + * Type of Visual + */ + TMulLCTVisualType mVisualType; + + /** + * Array of attribute structures (owned) + * + */ + std::vector mAttributeStructure; + int mX,mY,mW,mH; + }; + +// --------------------------------------------------------------------------- +// Custom data type to hold information about different visuals +// --------------------------------------------------------------------------- +// +class LCTElementStructure + { +public: + + /** + * Destructor + * + */ + ~LCTElementStructure() + { + for(int i =0; i < mVS.size(); ++i) + { + delete mVS[i]; + } + mVS.clear(); + } + + /** + * Adds a Visual structure to this Element structure + * + * @param aVStructure VisualStructure to be added + * @return nothing + * + */ + void AddVisualStructure(LCTVisualStructure* aVStructure) + { + if(aVStructure) + mVS.push_back(aVStructure); + } + + /** + * Gets a Visual structure at a specified index in this visual structure + * + * @param aIndex Index at which the attribute struct desired + * @return LCTVisualStructure, NULL if no structure is found + * + */ + const LCTVisualStructure* GetVisualStruture(int aIndex) + { + if(aIndex >=0 && aIndex < mVS.size()) + return mVS[aIndex]; + else + return NULL; + } + + /** + * Gets a Visual structure with specified name + * + * @param aVisualName name of the visual structure + * @return LCTVisualStructure, NULL if no structure is found + * + */ + const LCTVisualStructure* GetVisualStrutureByName(const UString& aVisualName) const + { + for (vector::const_iterator it = mVS.begin(); + it!=mVS.end(); ++it) + { + if(!strcmp(((*it)->GetId()).getUtf8(),aVisualName.getUtf8())) + return *it; + } + //if attribute by this name is not found + return NULL; + } + + /** + * Gets a Visual structure count + * + * @param nothing + * @return int visual structure count + * + */ + int VisualCount() + { + return mVS.size(); + } + + /** + * Sets the visual structure Id + * + * @param aId + * @return nothing + * + */ + void SetId(const UString& aId) {mId = aId;} + + /** + * Gets the visual structure Id + * + * @param nothing + * @return UString + * + */ + UString GetId() const { return mId; } + + void SetPositions(int x,int y) + { + mX = x; + mY = y; + } + void SetDimensions(int width,int height) + { + mW = width; + mH = height; + } + int PositionX() const {return mX;} + int PositionY() const {return mY;} + int Width() const {return mW;} + int Height() const {return mH;} + /** + * Sets the LCT Id + * + * @param aId + * @return nothing + * + */ + void SetLCTId(const UString& aId) {mLctPair.mLctId = aId;} + + /** + * Sets the Variety Id + * + * @param aId + * @return nothing + * + */ + void SetVarietyId(int aId) {mLctPair.mVariety = aId;} + + /** + * Returns the LCT Id + * + * @param nothing + * @return UString + * + */ + const UString GetLCTId() const {return mLctPair.mLctId; } + + /** + * Returns the Variety Id + * + * @param nothing + * @return int + * + */ + const int GetVarietyId() const {return mLctPair.mVariety;} + + /** + * Returns the LCT Pair structure + * + * @param nothing + * @return LCTPair + * + */ + const LCTPair& GetLctPair() + { + return mLctPair; + } + +private: + /** + * Identifier for the element structure + */ + UString mId; + + /** + * LCT information of element + */ + LCTPair mLctPair; + + /** + * Array of children visual structure (owned) + */ + vector mVS; + + int mX,mY,mW,mH; + }; + + + +class MulVisualUtility + { + public: + /** + * Default Constructor + */ + OSN_IMPORT MulVisualUtility(); + + /** + * Destructor + */ + OSN_IMPORT ~MulVisualUtility(); + + /** + * Accessor function for the LCT data + * + * @return LCTData internal data that contains the coordinate information + */ + OSN_IMPORT const LCTData& data() const ; + + /** + * Uses the passed LCTPair and populates the LCT related information + * as its internal Data. + * + * @param aPair LCTPair to be parsed + * @param aParentLayout ParentLayout wit respect to which the + * coordinate calculation has to be made + * @return nothing + */ + OSN_IMPORT void parseLCTInfo(const LCTPair& aPair, CAlfLayout* aParentLayout= NULL); + + /** + * Uses the passed LCTPair and populates the LCT related information + * as its internal Data. + * + * @ :: yet to implement + * @return nothing + */ + OSN_IMPORT void parseLCTTextInfo(); + + private: + /** + * Internal function to concert LCT IDs into absolute data + */ + void readLCTData(); + + /** + * Internal function to concert LCT IDs into absolute data for text + */ + void readLCTTextData(); + + bool isParentRelative(int aVal) const; + + private: + /** + * LCT data, Owned + */ + auto_ptr mData; + + /** + * LCT id + */ + UString mLCTId; + + /** + * Variety id + */ + int mVarietyId; + }; + + } + //namespace Alf + +#endif /*MULVISUALUTILITY_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/rom/mulutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/rom/mulutility.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2007-2008 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: Single item Data model iby file. +* +*/ + + +#ifndef __MULUTILITY_IBY__ +#define __MULUTILITY_IBY__ + +file=EPOCROOT##epoc32\release\armv5\urel\mulutility.dll \sys\bin\mulutility.dll +#endif // __MULUTILITY_IBY__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/src/mulimagevisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/src/mulimagevisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,360 @@ +/* +* Copyright (c) 2007 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: Attribute setter implementation for mulimage visual. + * +*/ + + +// Class header +#include "../inc/mulimagevisualattributesetter.h" + +// Alf headers +#include "alf/alfattribute.h" +#include +#include +#include "alf/alfattributecontainer.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //for resource pooling +#include //for resource pooling +// Osn headers +#include +#include +//#include +// Std headers +#include +#include +// DUI headers +#include "alf/attrproperty.h" + +//for logs +#include "mullog.h" +#include "mulutility.h" + +using namespace osncore; + +using namespace duiuimodel::imagevisualattributes; +using namespace duiuimodel::commonvisualattributes; +using namespace duiuimodel::layoutattributes; + +namespace Alf + { + +class MulImageVisualAttributeSetterImpl + { +public: + MulImageVisualAttributeSetterImpl(); + ~MulImageVisualAttributeSetterImpl(); +public: + //Keep track of loaded texture for imagevisuals. + //Texture manager doesn't unload the texture from memory untill Env is deleted. + //Hence need to unload them once attribute setter is deleted. + AlfPtrVector mLoadedTextures; + //Env needed to access TextureManager while unloading textures. + CAlfEnv* mEnv; + }; + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +MulImageVisualAttributeSetterImpl::MulImageVisualAttributeSetterImpl() + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetterImpl::MulImageVisualAttributeSetterImpl"); + //Do not delete textures here as they may be in use by the visuals that have not been deleted. + mLoadedTextures.setAutoDelete (false); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulImageVisualAttributeSetterImpl::~MulImageVisualAttributeSetterImpl() + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetterImpl::~MulImageVisualAttributeSetterImpl"); + //Unload all loaded textures created by this attributesetter to free up the memory. + for (int i =0; iTextureManager().UnloadTexture (texture->Id ()); + } + mLoadedTextures.clear (); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// + OSN_EXPORT MulImageVisualAttributeSetter::MulImageVisualAttributeSetter() + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::MulImageVisualAttributeSetter"); + mImpl.reset(new (EMM) MulImageVisualAttributeSetterImpl()); + mImageAttrSetter.reset(new (EMM) AlfImageVisualAttributeSetter()); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulImageVisualAttributeSetter::~MulImageVisualAttributeSetter() + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::~MulImageVisualAttributeSetter"); + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulImageVisualAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::setAttributeValue"); + mData = aData; + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if (!imageVisual) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfImageVisualAttributeSetter") + } + AlfCommonVisualAttributeSetter::setAttributeValue(aVisual,aContainer, aData); + } +// --------------------------------------------------------------------------- +// HandleStaticDataAttribute +// --------------------------------------------------------------------------- +// +void MulImageVisualAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::handleStaticDataAttribute"); + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if ( !imageVisual) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "CAlfImageVisualAttributeSetter") + } + + if ( !aData) ALF_THROW ( AlfDataException, EInvalidVariantDataType, "CAlfTextVisualAttributeSetter" ) + + const char* dataField = aAttr.getDataField (); + if ( !dataField) ALF_THROW ( AlfDataException, EInvalidAttribute, "CAlfTextVisualAttributeSetter" ) + + IAlfVariantType* data = aData->item (UString( dataField )); + const char* attrName = aAttr.name (); + if ( data) + { + if( !strcmp(attrName, KImagePath)) + { + if ( data->type ()== IAlfVariantType::EString) + { + if ( IsSVGImage (data->string ())) + { + LoadImageFromSvg(data->string (),*imageVisual); + } + else if (MulUtility::IsPoolResource(data->string ())) + { + //using resource pooling mechanism for image visual + ResourcePool& pool = AlfWidgetEnvExtension::resourcePool(imageVisual->Env()); + imageVisual->SetImage(pool.getImageResource((data->string ().getUtf8()))); + } + else + { + //AlfImageVisualAttributeSetter::handleStaticDataAttribute(aVisual,aAttr,aContainer,aData); + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,aData); + } + } + else if ( data->type ()== IAlfVariantType::EInt) + { + LoadImageFromTexture(data->integer(),*imageVisual); + } + } + else if( !strcmp(attrName, KSecondaryImagePath)) + { + if ( data->type ()== IAlfVariantType::EString) + { + if ( IsSVGImage (data->string ())) + { + LoadImageFromSvg(data->string (),*imageVisual); + } + else if (MulUtility::IsPoolResource(data->string ())) + { + //using resource pooling mechanism for image visual + ResourcePool& pool1 = AlfWidgetEnvExtension::resourcePool(imageVisual->Env()); + imageVisual->SetImage(pool1.getImageResource((data->string ().getUtf8()))); + } + else + { + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,aData); + } + } + else if ( data->type ()== IAlfVariantType::EInt) + { + LoadImageFromTexture(data->integer(),*imageVisual); + } + } + else + { + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,aData); + } + } + } + +// --------------------------------------------------------------------------- +// handleStaticAttribute +// --------------------------------------------------------------------------- +// +void MulImageVisualAttributeSetter::handleStaticAttribute( CAlfVisual& aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer ) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::handleStaticAttribute"); + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if ( !imageVisual) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfImageVisualAttributeSetter") + } + + const char* attrName = aAttr.name (); + if( !strcmp(attrName, KImagePath)) + { + if ( IsSVGImage ( aAttr.stringValue())) + { + LoadImageFromSvg( aAttr.stringValue(),*imageVisual); + } + + else + { + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,mData); + } + } + else if( !strcmp(attrName, KSecondaryImagePath)) + { + if ( IsSVGImage (aAttr.stringValue())) + { + LoadImageFromSvg(aAttr.stringValue(),*imageVisual); + } + + else + { + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,mData); + } + } + else + { + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,mData); + } + } + +// --------------------------------------------------------------------------- +// handleDynamicDataAttribute +// --------------------------------------------------------------------------- +// +void MulImageVisualAttributeSetter::handleDynamicDataAttribute(CAlfVisual &aVisual, + AlfAttribute& /*aAttr*/, + AlfAttributeContainer& aContainer, + IAlfMap* aData) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::handleDynamicDataAttribute"); + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,aData); + } + +// --------------------------------------------------------------------------- +// handleDynamicDataAttribute +// --------------------------------------------------------------------------- +// +void MulImageVisualAttributeSetter::handleDynamicAttribute(CAlfVisual &aVisual, + AlfAttribute& /*aAttr*/, + AlfAttributeContainer& aContainer) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::handleDynamicAttribute"); + mImageAttrSetter->setAttributeValue(aVisual,&aContainer,mData); + } + +// --------------------------------------------------------------------------- +// IsSVGImage +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool MulImageVisualAttributeSetter::IsSVGImage(const UString& aImagePath) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::IsSVGImage"); + TPtrC8 src((TUint8*)aImagePath.getUtf8()); + HBufC* srcBuf = HBufC::NewLC(src.Length()); + + srcBuf->Des().Copy(src); + srcBuf->Des().LowerCase(); + + _LIT(KSvgFile,".svg"); + + bool retval = ( KErrNotFound != srcBuf->FindC(KSvgFile)); + + CleanupStack::PopAndDestroy( srcBuf ); + + return retval; + } + +// --------------------------------------------------------------------------- +// LoadImageFromSvg +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulImageVisualAttributeSetter::LoadImageFromSvg(const UString& aSvgFilePath, + CAlfImageVisual& aImageVisual ) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::LoadImageFromSvg"); + TPtrC8 src((TUint8*)aSvgFilePath.getUtf8()); + HBufC* imagePath = CnvUtfConverter::ConvertToUnicodeFromUtf8L (src); + CleanupStack::PushL( imagePath ); + + CAlfImageLoaderUtil imgLoaderUtil; + imgLoaderUtil.SetSize (TSize (50, 50)); + + MAlfBitmapProvider* iSvgBitMapProv= imgLoaderUtil.CreateSVGImageLoaderL (*imagePath); + CAlfTexture &texture = aImageVisual.Env().TextureManager().CreateTextureL ( + KAlfAutoGeneratedTextureId, + iSvgBitMapProv, + EAlfTextureFlagDefault); + + aImageVisual.SetScaleMode (CAlfImageVisual::EScaleFit); + aImageVisual.SetImage (TAlfImage (texture)); + + CleanupStack::PopAndDestroy(imagePath); + } + +// --------------------------------------------------------------------------- +// LoadImageFromTexture +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulImageVisualAttributeSetter::LoadImageFromTexture( int aTextureId, + CAlfImageVisual& aImageVisual ) + { + MUL_LOG_INFO("aakash::CMulImageVisualAttributeSetter::LoadImageFromTexture"); + //Seems like the Env's Texture Manager is not returning a copy. And When Env gets deleted the texture is destroyed + //So ownership is not with the client + const CAlfTexture* texture = aImageVisual.Env().TextureManager().Texture (aTextureId); + if(!texture) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter" ) + } + aImageVisual.SetImage (TAlfImage (*texture)); + } + + +}// Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/src/mulkeyboardutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/src/mulkeyboardutility.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for keyboard handling + * +*/ + + +// includes +#include +#include +#include +#include + +#include "mulkeyboardutility.h" + +const TUid KUidKeyBoardUtility = {0x02D811B8} ; + +CQwertySubscriber::CQwertySubscriber(TCallBack aCallBack, RProperty& aProperty) + : CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty) +{ + CActiveScheduler::Add(this); +} + + CQwertySubscriber::~CQwertySubscriber() +{ + Cancel(); +} + + void CQwertySubscriber::SubscribeL() +{ + if (!IsActive()) + { + iProperty.Subscribe(iStatus); + SetActive(); + } +} + +void CQwertySubscriber::StopSubscribe() +{ + Cancel(); +} + +void CQwertySubscriber::RunL() +{ + if (iStatus.Int() == KErrNone) + { + iCallBack.CallBack(); + SubscribeL(); + } +} + +void CQwertySubscriber::DoCancel() +{ + iProperty.Cancel(); +} + +CKeyBoardUtility* CKeyBoardUtility:: NewL() +{ + CKeyBoardUtility* self = static_cast( CCoeEnv::Static( KUidKeyBoardUtility ) ) ; + if(!self) + { + self = new( ELeave ) CKeyBoardUtility() ; + } + return self ; +} + + +CKeyBoardUtility::CKeyBoardUtility():CCoeStatic(KUidKeyBoardUtility, CCoeStatic::EThread /*or EApp*/ ) +{ + bQwerty = EFalse; + User::LeaveIfError(iQwertyModeStatusProperty.Attach(KCRUidAvkon, KAknQwertyInputModeActive)); + iQwertyModeStatusSubscriber = new (ELeave) CQwertySubscriber(TCallBack(QwertyModeChangeNotification, this), iQwertyModeStatusProperty); + iQwertyModeStatusSubscriber->SubscribeL(); +} + +CKeyBoardUtility::~CKeyBoardUtility() +{ + + // Qwerty Notify clean-up + if (iQwertyModeStatusSubscriber) + { + iQwertyModeStatusSubscriber->StopSubscribe(); + } + iQwertyModeStatusProperty.Close(); + delete iQwertyModeStatusSubscriber; +} + +TInt CKeyBoardUtility::QwertyModeChangeNotification(TAny* aObj) +{ + if (aObj != NULL) + { + static_cast(aObj)->HandleQwertyModeChangeNotification(); + return KErrNone; + } + else + { + return KErrArgument; + } +} + +void CKeyBoardUtility::HandleQwertyModeChangeNotification() +{ + TInt value = 0; + iQwertyModeStatusProperty.Get(value); + if(value > 0) + { + bQwerty = ETrue; + } + else + { + bQwerty = EFalse; + } +} + +bool CKeyBoardUtility::IsQwerty() +{ + TInt value = 0; + iQwertyModeStatusProperty.Get(value); + if(value > 0) + { + bQwerty = true; + } + else + { + bQwerty = false; + } + return bQwerty; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/src/mulutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/src/mulutility.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2007-2008 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: Implementation for utility class +* +*/ + +// Includes + +// Class header +#include "mulutility.h" + +#include "mul/mulmodelutility.h" +#include "mulassert.h" +#include +#include +#include +#include +#include + +// Local includes +#include "mulassert.h" +//for logs +#include "mullog.h" +namespace Alf + { + +//----------------------------------------------------------------------------- +// AbsolutePath +//----------------------------------------------------------------------------- +// +OSN_EXPORT bool MulUtility::AbsolutePath(UString& aRelativePath) + { + MUL_LOG_INFO("aakash::MulUtility::AbsolutePath"); + bool result = false; + aRelativePath.insert(0,"c:"); + HBufC* relBuffer =NULL; + + TRAPD(err, relBuffer = HBufC::NewL(aRelativePath.getCharLength())) + __MUL_ASSERT(err == KErrNone ,_L("Bad Alloc")); + + try + { + TPtr ptr = relBuffer->Des() ; + MulModelUtility::ConvertUStringToTDes(aRelativePath,ptr); + + if(IsFileExists(*relBuffer)) + { + result = true; + } + else + { + aRelativePath.replace(0,"z"); + MulModelUtility::ConvertUStringToTDes(aRelativePath,ptr); + if(IsFileExists(*relBuffer)) + { + result = true; + } + else + { + aRelativePath.erase(0,2); + } + } + + } + catch(...) + { + + } + delete relBuffer; + return result; + } + +//----------------------------------------------------------------------------- +// IsLandscape +//----------------------------------------------------------------------------- +// +OSN_EXPORT bool MulUtility::IsLandscape() + { + MUL_LOG_INFO("aakash::MulUtility::IsLandscape"); + CAknAppUiBase::TAppUiOrientation + orientation = static_cast((CEikonEnv::Static()->EikAppUi()))->Orientation(); + + + if (orientation == CAknAppUiBase::EAppUiOrientationLandscape) + { + return true; + + } + + else if (orientation == CAknAppUiBase::EAppUiOrientationUnspecified ) + { + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + if ( (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) || + (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) ) + { + //landscape + return true; + } + else + { + // Portrait + return false; + } + } + return false; + + } + +//----------------------------------------------------------------------------- +// IsFileExists +//----------------------------------------------------------------------------- +// +bool MulUtility::IsFileExists(/*const char* afilePath*/const TDesC& aFilePath) + { + MUL_LOG_INFO("aakash::MulUtility::IsFileExists"); + bool result(false); + + + RFs fSession; + TInt fsError = fSession.Connect(); + __MUL_ASSERT(fsError == KErrNone,_L("File Session unable to connect")); + + RFile chkFile; + TInt errCode = chkFile.Open(fSession,aFilePath,EFileRead); + if(KErrPathNotFound != errCode) + { + result = true; + } + chkFile.Close(); + fSession.Close(); + return result; + } + +// --------------------------------------------------------------------------- +// IsPoolResource +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool MulUtility::IsPoolResource(const UString& aImageTag) + { + TPtrC8 src((TUint8*)aImageTag.getUtf8()); + _LIT8(KMulTag,"MUL_RP"); + + return ( KErrNotFound != src.FindC(KMulTag)); + } +//---------------------------------------------------------------------------- +//IsQwerty +//---------------------------------------------------------------------------- +OSN_EXPORT bool MulUtility::IsQwerty() + { + CKeyBoardUtility* iKBUtility = CKeyBoardUtility::NewL(); + if(iKBUtility) + { + return iKBUtility->IsQwerty(); + } + return false; + } + + } // namespace ends + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/common/src/mulvisualutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/common/src/mulvisualutility.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for widgets visualization in terms of LCT data + * +*/ + + +// includes +// Class header +#include "mulvisualutility.h" + +// Alf headers +#include "alf/alfanchorlayoutattributesetter.h" +#include "alf/alfattribute.h" +#include "alf/alfattributecontainer.h" +#include +#include "alf/alftextvisualattributesetter.h" +#include "alf/alfvisualtemplate.h" +#include + +// DUI headers for xml parser + +#include "alf/attrproperty.h" + +#include + +// Local headers +#include "mulimagevisualattributesetter.h" +#include "mulassert.h" +#include "mulutility.h" +#include "mullog.h" //for logs +using namespace duiuimodel; + + +namespace Alf +{ + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVisualUtility::MulVisualUtility() + { + mData.reset(new (EMM) LCTData); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVisualUtility::~MulVisualUtility() + { + // Nothing to destroy + } + + +// --------------------------------------------------------------------------- +// parseLCTInfo +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulVisualUtility::parseLCTInfo(const LCTPair& aPair, CAlfLayout* aParentLayout) + { + TAknWindowLineLayout componentLayout; + TAknLayoutRect layoutRect; + UString lctId = aPair.mLctId; + TSize parentSize (0,0) ; + if(aParentLayout ) + { + parentSize = aParentLayout->Size().Target().AsSize(); + } + else + { + TSize size = AlfUtil::ScreenSize(); + TAknWindowLineLayout parentLayout; + TAknLayoutRect layout; + bool isLandscape = MulUtility::IsLandscape(); + if(!isLandscape) + { + parentLayout = AknLayoutScalable_UiAccel::main_pane(5).LayoutLine(); + } + else + { + parentLayout = AknLayoutScalable_UiAccel::main_pane(6).LayoutLine(); + } + + layout.LayoutRect( TRect(size), parentLayout ); + parentSize.iWidth = layout.Rect().Width(); + parentSize.iHeight = layout.Rect().Height(); + } + + if(!lctId.compare(UString("uiaccel_main_aa_gridscroll_pane"))) + { + componentLayout = AknLayoutScalable_UiAccel::main_aa_gridscroll_pane(aPair.mVariety).LayoutLine(); + + } + if(!lctId.compare(UString("uiaccel_aagrid_gene_pane"))) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_gene_pane(aPair.mVariety).LayoutLine(); + + + } + if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane"))) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane(aPair.mVariety, 0, 0 ).LayoutLine(); + + } + if(!lctId.compare(UString("uiaccel_aa_scroll_pane_cp001"))) + { + componentLayout = AknLayoutScalable_UiAccel::aa_scroll_pane_cp001(aPair.mVariety).LayoutLine(); + + } + + if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g1")) ) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g1(aPair.mVariety).LayoutLine(); + } + + if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g2")) ) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g2(aPair.mVariety).LayoutLine(); + } + + if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g3")) ) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g3(aPair.mVariety).LayoutLine(); + } + + if(!lctId.compare(UString("uiaccel_aagrid_cell_image_pane_g4")) ) + { + componentLayout = AknLayoutScalable_UiAccel::aagrid_cell_image_pane_g4(aPair.mVariety).LayoutLine(); + } + + + layoutRect.LayoutRect( TRect(parentSize), componentLayout ); + + mData->mPosX = layoutRect.Rect().iTl.iX; + mData->mPosY = layoutRect.Rect().iTl.iY; + mData->mWidth = layoutRect.Rect().Width(); + mData->mHeight = layoutRect.Rect().Height(); + + } + +// --------------------------------------------------------------------------- +// parseLCTInfo +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulVisualUtility::parseLCTTextInfo() + { + + } + +// --------------------------------------------------------------------------- +// Returns the structure containing width, height etc info +// --------------------------------------------------------------------------- +// +OSN_EXPORT const LCTData& MulVisualUtility::data() const + { + return *(mData.get()); + } + +// --------------------------------------------------------------------------- +// Internal function to convert LCT IDs into absolute data for text +// --------------------------------------------------------------------------- +// +void MulVisualUtility::readLCTTextData() + { + + } + +// --------------------------------------------------------------------------- +// Internal function to concert LCT IDs into absolute data +// --------------------------------------------------------------------------- +// +void MulVisualUtility::readLCTData() + { + + } + +// --------------------------------------------------------------------------- +// Internal function +// --------------------------------------------------------------------------- +// +bool MulVisualUtility::isParentRelative(int /*aVal*/) const + { + return false; + } + +} // namespace Alf + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/bwins/gesturehelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/bwins/gesturehelperu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,23 @@ +EXPORTS + ??0CGestureControl@GestureHelper@@IAE@XZ @ 1 NONAME ; GestureHelper::CGestureControl::CGestureControl(void) + ??1CGestureControl@GestureHelper@@UAE@XZ @ 2 NONAME ; GestureHelper::CGestureControl::~CGestureControl(void) + ??1CGestureHelper@GestureHelper@@UAE@XZ @ 3 NONAME ; GestureHelper::CGestureHelper::~CGestureHelper(void) + ?Cancel@CGestureHelper@GestureHelper@@QAEXXZ @ 4 NONAME ; void GestureHelper::CGestureHelper::Cancel(void) + ?ConstructL@CGestureControl@GestureHelper@@IAEXAAVMGestureObserver@2@AAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 5 NONAME ; void GestureHelper::CGestureControl::ConstructL(class GestureHelper::MGestureObserver &, class CAlfEnv &, class CAlfDisplay &, int) + ?HandlePointerEventL@CGestureHelper@GestureHelper@@QAEHABUTPointerEvent@@@Z @ 6 NONAME ; int GestureHelper::CGestureHelper::HandlePointerEventL(struct TPointerEvent const &) + ?InitAlfredPointerCaptureL@CGestureHelper@GestureHelper@@QAEXAAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 7 NONAME ; void GestureHelper::CGestureHelper::InitAlfredPointerCaptureL(class CAlfEnv &, class CAlfDisplay &, int) + ?IsHoldingEnabled@CGestureControl@GestureHelper@@QBEHXZ @ 8 NONAME ; int GestureHelper::CGestureControl::IsHoldingEnabled(void) const + ?IsHoldingEnabled@CGestureHelper@GestureHelper@@QBEHXZ @ 9 NONAME ; int GestureHelper::CGestureHelper::IsHoldingEnabled(void) const + ?NewL@CGestureHelper@GestureHelper@@SAPAV12@AAVMGestureObserver@2@@Z @ 10 NONAME ; class GestureHelper::CGestureHelper * GestureHelper::CGestureHelper::NewL(class GestureHelper::MGestureObserver &) + ?NewLC@CGestureControl@GestureHelper@@SAPAV12@AAVMGestureObserver@2@AAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 11 NONAME ; class GestureHelper::CGestureControl * GestureHelper::CGestureControl::NewLC(class GestureHelper::MGestureObserver &, class CAlfEnv &, class CAlfDisplay &, int) + ?OfferEventL@CGestureControl@GestureHelper@@UAEHABVTAlfEvent@@@Z @ 12 NONAME ; int GestureHelper::CGestureControl::OfferEventL(class TAlfEvent const &) + ?OfferEventL@CGestureHelper@GestureHelper@@QAEHABVTAlfEvent@@@Z @ 13 NONAME ; int GestureHelper::CGestureHelper::OfferEventL(class TAlfEvent const &) + ?SetHoldingEnabled@CGestureControl@GestureHelper@@QAEXH@Z @ 14 NONAME ; void GestureHelper::CGestureControl::SetHoldingEnabled(int) + ?SetHoldingEnabled@CGestureHelper@GestureHelper@@QAEXH@Z @ 15 NONAME ; void GestureHelper::CGestureHelper::SetHoldingEnabled(int) + ?VisualByCoordinates@HitTest@GestureHelper@@SAPAVCAlfVisual@@ABVCAlfControl@@ABVTPoint@@@Z @ 16 NONAME ; class CAlfVisual * GestureHelper::HitTest::VisualByCoordinates(class CAlfControl const &, class TPoint const &) + ?IsDoubleTapEnabled@CGestureControl@GestureHelper@@QBEHXZ @ 17 NONAME ; int GestureHelper::CGestureControl::IsDoubleTapEnabled(void) const + ?IsDoubleTapEnabled@CGestureHelper@GestureHelper@@QBEHXZ @ 18 NONAME ; int GestureHelper::CGestureHelper::IsDoubleTapEnabled(void) const + ?SetDoubleTapEnabled@CGestureControl@GestureHelper@@QAEXH@Z @ 19 NONAME ; void GestureHelper::CGestureControl::SetDoubleTapEnabled(int) + ?SetDoubleTapEnabled@CGestureHelper@GestureHelper@@QAEXH@Z @ 20 NONAME ; void GestureHelper::CGestureHelper::SetDoubleTapEnabled(int) + ?AddObserver@CGestureHelper@GestureHelper@@QAEXPAVMGestureObserver@2@@Z @ 21 NONAME ; void GestureHelper::CGestureHelper::AddObserver(class GestureHelper::MGestureObserver *) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/eabi/gesturehelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/eabi/gesturehelperu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,31 @@ +EXPORTS + _ZN13GestureHelper14CGestureHelper11OfferEventLERK9TAlfEvent @ 1 NONAME + _ZN13GestureHelper14CGestureHelper17SetHoldingEnabledEi @ 2 NONAME + _ZN13GestureHelper14CGestureHelper19HandlePointerEventLERK13TPointerEvent @ 3 NONAME + _ZN13GestureHelper14CGestureHelper25InitAlfredPointerCaptureLER7CAlfEnvR11CAlfDisplayi @ 4 NONAME + _ZN13GestureHelper14CGestureHelper4NewLERNS_16MGestureObserverE @ 5 NONAME + _ZN13GestureHelper14CGestureHelper6CancelEv @ 6 NONAME + _ZN13GestureHelper14CGestureHelperD0Ev @ 7 NONAME + _ZN13GestureHelper14CGestureHelperD1Ev @ 8 NONAME + _ZN13GestureHelper14CGestureHelperD2Ev @ 9 NONAME + _ZN13GestureHelper15CGestureControl10ConstructLERNS_16MGestureObserverER7CAlfEnvR11CAlfDisplayi @ 10 NONAME + _ZN13GestureHelper15CGestureControl11OfferEventLERK9TAlfEvent @ 11 NONAME + _ZN13GestureHelper15CGestureControl17SetHoldingEnabledEi @ 12 NONAME + _ZN13GestureHelper15CGestureControl5NewLCERNS_16MGestureObserverER7CAlfEnvR11CAlfDisplayi @ 13 NONAME + _ZN13GestureHelper15CGestureControlC1Ev @ 14 NONAME + _ZN13GestureHelper15CGestureControlC2Ev @ 15 NONAME + _ZN13GestureHelper15CGestureControlD0Ev @ 16 NONAME + _ZN13GestureHelper15CGestureControlD1Ev @ 17 NONAME + _ZN13GestureHelper15CGestureControlD2Ev @ 18 NONAME + _ZN13GestureHelper7HitTest19VisualByCoordinatesERK11CAlfControlRK6TPoint @ 19 NONAME + _ZNK13GestureHelper14CGestureHelper16IsHoldingEnabledEv @ 20 NONAME + _ZNK13GestureHelper15CGestureControl16IsHoldingEnabledEv @ 21 NONAME + _ZTIN13GestureHelper15CGestureControlE @ 22 NONAME ; ## + _ZTVN13GestureHelper15CGestureControlE @ 23 NONAME ; ## + _ZThn32_N13GestureHelper15CGestureControl11OfferEventLERK9TAlfEvent @ 24 NONAME ; ## + _ZN13GestureHelper14CGestureHelper19SetDoubleTapEnabledEi @ 25 NONAME + _ZN13GestureHelper15CGestureControl19SetDoubleTapEnabledEi @ 26 NONAME + _ZNK13GestureHelper14CGestureHelper18IsDoubleTapEnabledEv @ 27 NONAME + _ZNK13GestureHelper15CGestureControl18IsDoubleTapEnabledEv @ 28 NONAME + _ZN13GestureHelper14CGestureHelper11AddObserverEPNS_16MGestureObserverE @ 29 NONAME + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/all.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/all.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,20 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for building gesturehelper for winscw and armv5 platforms +rem + +call wins +call twins +call arm +call tarm diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/arm.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/arm.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for building gesturehelper for armv5 platform +rem + +call bldmake bldfiles +call abld build armv5 urel \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008 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: Build information +* +*/ + +#include +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../rom/gesturehelper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(gesturehelper.iby) +PRJ_MMPFILES +gesturehelper.mmp + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/clean.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/clean.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file to clean gesturehelper build for winscw and armv5 platform +rem + +call abld reallyclean +call abld test reallyclean diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/freeze.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/freeze.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for freezing def files +rem + +call clean +call wins +call arm +call attrib -r ..\bwins\*.def +call attrib -r ..\eabi\*.def +call abld freeze winscw +call abld freeze armv5 +call clean +call all diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/gesturehelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/gesturehelper.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008 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: Project definition file +* +*/ + +#include + +TARGET gesturehelper.dll +TARGETTYPE dll +UID 0x0 0x20010978 + + +CAPABILITY CAP_CLIENT_DLL +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +SYSTEMINCLUDE ../inc // public includes use other gesture helper headers as system include + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE gesture.cpp +SOURCE gesturecontrol.cpp +SOURCE gesturehelper.cpp +SOURCE gesturehelperimpl.cpp +SOURCE gesturerecogniser.cpp +SOURCE hittest.cpp +SOURCE pointarray.cpp +SOURCE pointercapturer.cpp +SOURCE utils.cpp + +LIBRARY alfclient.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY ws32.lib +LIBRARY euser.lib diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/tarm.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/tarm.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for gesturehelper test build for armv5 platform +rem + +call bldmake bldfiles +call abld test build armv5 urel \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/twins.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/twins.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for gesturehelper test build for winscw platform +rem + +call bldmake bldfiles +call abld test build winscw udeb +call move /y \epoc32\release\winscw\udeb\t_gesture*.dll \epoc32\release\winscw\udeb\z\sys\bin\ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/group/wins.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/group/wins.cmd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Command file for building gesturehelper for winscw platform +rem + +call bldmake bldfiles +call abld build winscw udeb diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/rom/gesturehelper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/rom/gesturehelper.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008-2008 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: Gesture helper iby file +* +*/ + +#ifndef _GESTUREHELPER_IBY_ +#define _GESTUREHELPER_IBY_ + +#include + +file=ABI_DIR\BUILD_DIR\gesturehelper.dll SHARED_LIB_DIR\gesturehelper.dll + +#endif // _GESTUREHELPER_IBY_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesture.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesture.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,930 @@ +/* +* Copyright (c) 2008-2008 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: Gesture class +* +*/ + +#include "gesture.h" + +#include + +#include "gesturedefs.h" +#include "utils.h" + +using namespace GestureHelper; + +/** + * Point array for which only x axis is relevant + */ +class TXAxisPointArray : public TPointArray + { +public: + TXAxisPointArray( const RArray< TPointEntry >& aPoints ) + : TPointArray( aPoints ) {} + + // from TPointArray + TPoint operator[]( TInt aIndex ) const + { + return TPoint( Raw( aIndex ).iX, 0 ); + } + }; + +/** + * Point array for which only y axis is relevant + */ +class TYAxisPointArray : public TPointArray + { +public: + TYAxisPointArray( const RArray< TPointEntry >& aPoints ) + : TPointArray( aPoints ) {} + + // from TPointArray + TPoint operator[]( TInt aIndex ) const + { + return TPoint( 0, Raw( aIndex ).iY ); + } + }; + +namespace + { + /** @return the current time */ + TTime CurrentTime() + { + TTime time; + time.UniversalTime(); + return time; + } + + /** + * @param aRelevantAxis See @ref MGestureEvent::Code + * @return gesture code by analysing the sequence of points + */ + TGestureCode CodeFromPoints( const RArray< TPointEntry >& aPoints, + MGestureEvent::TAxis aRelevantAxis ) + { + // select the correct filter based on aRelevantAxis + // these filter_ objects are array decorators that will eliminate either + // x, y or neither coordinate of each point + TXAxisPointArray filterY( aPoints ); + TYAxisPointArray filterX( aPoints ); + TPointArray filterNone( aPoints ); + TPointArray& filter = + aRelevantAxis == MGestureEvent::EAxisHorizontal ? static_cast< TPointArray& >( filterY ) : + aRelevantAxis == MGestureEvent::EAxisVertical ? static_cast< TPointArray& >( filterX ) : + /* otherwise EAxisBoth */ filterNone; + + // currently the gesture recogniser does not have any state, so it is fast + // to instantiate. The call is not static however, to allow the recogniser + // to be replaced by a more complicated implementation that has state. + // then it may make sense to make the recogniser a member variable. + return TGestureRecogniser().GestureCode( filter, aRelevantAxis ); + } + + /** + * @param aPoints Sequence of points representing 1st pointer movement + * @param aSecondaryPoints Sequence of points representing 2nd pointer movement + * @param aPreviousDistance contains the previous distance aftre this function execution + * @return gesture code by analysing the sequence of points + */ + TGestureCode MultiTouchCode( const RArray< TPointEntry >& aPoints, + const RArray< TPointEntry >& aSecondaryPoints, TInt aPreviousDistance, TBool aIsFirstPinch ) + { + TPointArray filter(aPoints); + TPointArray secondaryFilter(aSecondaryPoints); + return TGestureRecogniser().MultiTouchGestureCode( filter, secondaryFilter, aPreviousDistance, aIsFirstPinch ); + } + } // unnamed namespace + +// ---------------------------------------------------------------------------- +// constructor +// ---------------------------------------------------------------------------- +// +CGesture::CGesture() + { + iPinchStartDistance = -1; + iPinchEndDistance = -1; + iPinchDetected = EFalse ; + } + +// ---------------------------------------------------------------------------- +// destructor +// ---------------------------------------------------------------------------- +// +CGesture::~CGesture() + { + iPoints.Close(); + iSecondaryPoints.Close(); + } + +// ---------------------------------------------------------------------------- +// AsStartEventL +// ---------------------------------------------------------------------------- +// +CGesture* CGesture::AsStartEventLC() const + { + __ASSERT_DEBUG( 0 < iPoints.Count(), Panic( EGesturePanicIllegalLogic ) ); + CGesture* gesture = new ( ELeave ) CGesture; + CleanupStack::PushL( gesture ); + User::LeaveIfError( gesture->AddPoint( iPoints[0].iPos ) ); + return gesture; + } + +// ---------------------------------------------------------------------------- +// ResetToLastPoint +// ---------------------------------------------------------------------------- +// +void CGesture::ResetToLastPoint(TBool aSetPointerZero,TBool aSetToZero) + { + TPointEntry lastEntry(TPoint(0,0),TTime()); + if( aSetToZero ) + { + __ASSERT_DEBUG( 0 < iPoints.Count(), Panic( EGesturePanicIllegalLogic ) ); + lastEntry = LastPoint( iPoints); + } + else + { + __ASSERT_DEBUG( 0 < iSecondaryPoints.Count(), Panic( EGesturePanicIllegalLogic ) ); + lastEntry = LastPoint( iSecondaryPoints); + } + Reset(); + if( aSetPointerZero ) + { + iPoints.Append(lastEntry); + } + else + { + iSecondaryPoints.Append(lastEntry); + } + } + +// ---------------------------------------------------------------------------- +// LastPoint +// ---------------------------------------------------------------------------- +// +inline const TPointEntry CGesture::LastPoint( const RArray< TPointEntry >& aPoints ) const + { + return aPoints[aPoints.Count() - 1]; + } + +// ---------------------------------------------------------------------------- +// IsPinchToleranceHigh +// ---------------------------------------------------------------------------- +// +inline TBool CGesture::IsHighPinchTolerance() const + { + + if( iPinchEndDistance == -1 ) + { + return ETrue; + } + else + { + TInt currentDistance = TGestureRecogniser().Length( LastPoint(iPoints).iPos, LastPoint(iSecondaryPoints).iPos ); + // if previously zooming out and current distance corresponds to zooming in or viceversa + if( ( iZoomState == EZoomOut && currentDistance < iPinchStartDistance) || + ( iZoomState == EZoomIn && currentDistance > iPinchStartDistance)) + { + return ETrue; + } + } + return EFalse; + } +// ---------------------------------------------------------------------------- +// Reset +// ---------------------------------------------------------------------------- +// +void CGesture::Reset() + { + iPoints.Reset(); + iSecondaryPoints.Reset(); + iHoldingState = ENotHolding; + iState = ENotActive; + iHoldingPointIndex = 0; + iVisual = NULL; + iIsDoubleTap = EFalse; + iPinchStartDistance = -1; + iPinchEndDistance = -1; + iPinchDetected = EFalse; + iZoomState = ENoZoom; + } + +// ---------------------------------------------------------------------------- +// IsEmpty +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsEmpty() const + { + return iPoints.Count() == 0; + } + +// ---------------------------------------------------------------------------- +// IsMultiTouch +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsMultiTouch() const + { + return iSecondaryPoints.Count() == 0; + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// ---------------------------------------------------------------------------- +// +TInt CGesture::AddPoint( const TPoint& aPoint ) + { + if ( !IsLatestPoint( aPoint ) ) + { + return iPoints.Append( TPointEntry( aPoint, CurrentTime() ) ); + } + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// AddSecondaryPoint +// ---------------------------------------------------------------------------- +// +TInt CGesture::AddSecondaryPoint( const TPoint& aPoint ) + { + if ( !IsLatestSecondaryPoint( aPoint ) ) + { + return iSecondaryPoints.Append( TPointEntry( aPoint, CurrentTime() ) ); + } + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// SetVisual +// ---------------------------------------------------------------------------- +// +void CGesture::SetVisual( CAlfVisual* aVisual ) + { + iVisual = aVisual; + } + +// ---------------------------------------------------------------------------- +// IsNearHoldingPoint +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsNearHoldingPoint( const TPoint& aPoint ) const + { + return ToleranceRect( iPoints[ iHoldingPointIndex ].iPos ).Contains( aPoint ); + } + +// ---------------------------------------------------------------------------- +// IsLatestPoint +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsLatestPoint( const TPoint& aPoint ) const + { + if ( iPoints.Count() > 0 ) + { + return aPoint == CurrentPos(); + } + return EFalse; + } +// ---------------------------------------------------------------------------- +// IsLatestSecondaryPoint +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsLatestSecondaryPoint( const TPoint& aPoint ) const + { + if ( iSecondaryPoints.Count() > 0 ) + { + return aPoint == iSecondaryPoints[ iSecondaryPoints.Count() - 1 ].iPos; + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// StartHolding +// ---------------------------------------------------------------------------- +// +void CGesture::StartHolding() + { + iHoldingState = EHoldStarting; + + // remove all points that were introduced after holding started + for ( TInt i = iPoints.Count() - 1; i > iHoldingPointIndex; i-- ) + { + iPoints.Remove( i ); + } + } + +// ---------------------------------------------------------------------------- +// SetHoldingPoint +// ---------------------------------------------------------------------------- +// +void CGesture::SetHoldingPoint() + { + iHoldingPointIndex = iPoints.Count() - 1; + } + +// ---------------------------------------------------------------------------- +// ContinueHolding +// ---------------------------------------------------------------------------- +// +void CGesture::ContinueHolding() + { + iHoldingState = EHolding; + } + +// ---------------------------------------------------------------------------- +// SetSingleTouchActive +// ---------------------------------------------------------------------------- +// +void CGesture::SetSingleTouchActive() + { + __ASSERT_DEBUG( ENotActive == iState, Panic( EGesturePanicIllegalLogic ) ); + iState = ESingleTouchActive; + } +// ---------------------------------------------------------------------------- +// SetMultiTouchActive +// ---------------------------------------------------------------------------- +// +void CGesture::SetMultiTouchActive() + { + iState = EMultiTouchActive; + iIsMultiTouched = ETrue; + } +// ---------------------------------------------------------------------------- +// SetSingleTouchReleased +// ---------------------------------------------------------------------------- +// +void CGesture::SetSingleTouchReleased() + { + // IsMovementStopped expects corresponding SetComplete to be called before SetRelease + __ASSERT_DEBUG( ESingleTouchComplete == iState, Panic( EGesturePanicIllegalLogic ) ); + iState = ESingleTouchReleased; + iIsMultiTouched = EFalse; + } +// ---------------------------------------------------------------------------- +// SetMultiTouchReleased +// ---------------------------------------------------------------------------- +// +void CGesture::SetMultiTouchReleased() + { + // IsMovementStopped expects corresponding SetComplete to be called before SetRelease + __ASSERT_DEBUG( EMultiTouchComplete == iState, Panic( EGesturePanicIllegalLogic ) ); + iState = EMultiTouchReleased; + } + +/** + * @return elapsed time between aStartTime and aEndTime + */ +inline TTimeIntervalMicroSeconds32 Elapsed( const TTime& aStartTime, + const TTime& aEndTime ) + { + return aEndTime.MicroSecondsFrom( aStartTime ).Int64(); + } + +// ---------------------------------------------------------------------------- +// SetSingleTouchComplete +// ---------------------------------------------------------------------------- +// +void CGesture::SetSingleTouchComplete() + { + __ASSERT_DEBUG( iPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + iState = ESingleTouchComplete; + iCompletionTime = CurrentTime(); + } + +// ---------------------------------------------------------------------------- +// SetMultiTouchComplete +// ---------------------------------------------------------------------------- +// +void CGesture::SetMultiTouchComplete() + { + __ASSERT_DEBUG( iSecondaryPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + iState = EMultiTouchComplete; + } + +// ---------------------------------------------------------------------------- +// SetCancelled +// ---------------------------------------------------------------------------- +// +void CGesture::SetCancelled() + { + iState = ECancelled; + } + +// ---------------------------------------------------------------------------- +// SetDoubleTap +// ---------------------------------------------------------------------------- +// +void CGesture::SetDoubleTap() + { + iIsDoubleTap = ETrue; + } + +// ---------------------------------------------------------------------------- +// IsTap +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsTap() const + { + if(iIsMultiTouched) + { + return EFalse; + } + return CodeFromPoints( iPoints, EAxisBoth ) == EGestureTap; + } + +// ---------------------------------------------------------------------------- +// IsPinch +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsPinch() + { + if (iPinchStartDistance == -1 ) + { + iPinchStartDistance = TGestureRecogniser().Length( iPoints[0].iPos, iSecondaryPoints[0].iPos ) ; + } + // if there is a pinch detected in the last attempt then update the start distance. + // henceforth this new distance is used as reference for calculating the pinch. + + if( iPinchDetected ) + { + iPinchStartDistance = iPinchEndDistance; + } + iPinchDetected = MultiTouchCode( iPoints, iSecondaryPoints, iPinchStartDistance,IsHighPinchTolerance()) == EGesturePinch; + if( iPinchDetected ) + { + // This end distance is updated the first time the pinch is detected. + // This is done the save the value of pinch end distnce for further refernce to + // update the pinch start distance next time any pointer position changes. + iPinchEndDistance = TGestureRecogniser().Length( + LastPoint(iPoints).iPos,LastPoint(iSecondaryPoints).iPos ); + iZoomState = iPinchEndDistance > iPinchStartDistance ? EZoomOut : EZoomIn; + } + return iPinchDetected; + } + +/** + * Translates a non-holding code into a holding code + * @param aCode original gesture code + * @return a gesture code with hold flag applied + */ +inline TGestureCode Hold( TGestureCode aCode ) + { + if ( aCode != EGestureStart && + aCode != EGestureDrag && + aCode != EGestureReleased && + aCode != EGestureUnknown ) + { + return static_cast< TGestureCode >( aCode | EFlagHold ); + } + return aCode; + } + +// ---------------------------------------------------------------------------- +// Code +// ---------------------------------------------------------------------------- +// +TGestureCode CGesture::Code( TAxis aRelevantAxis ) const + { + switch ( iState ) + { + case ESingleTouchActive: + // "start" event if only first point received + // need to check that not holding, in case user pressed stylus + // down, and activated holding without moving the stylus + if ( iPoints.Count() == 1 && !IsHolding() ) + { + return EGestureStart; + } + // "drag" event if holding not started or holding started earlier + else if ( iHoldingState != EHoldStarting ) + { + // select the correct filter based on aRelevantAxis + // these filter_ objects are array decorators that will eliminate either + // x, y or neither coordinate of each point + TXAxisPointArray filterY( iPoints ); + TYAxisPointArray filterX( iPoints ); + TPointArray filterNone( iPoints ); + TPointArray& filter = + aRelevantAxis == MGestureEvent::EAxisHorizontal ? static_cast< TPointArray& >( filterY ) : + aRelevantAxis == MGestureEvent::EAxisVertical ? static_cast< TPointArray& >( filterX ) : + /* otherwise EAxisBoth */ filterNone; + + return TGestureRecogniser().ValidateDrag( filter, aRelevantAxis ); + } + // holding was just started + else + { + return Hold( CodeFromPoints( iPoints, aRelevantAxis ) ); + } + + case EMultiTouchActive: + // Only if there are some points in secondary array + if ( iSecondaryPoints.Count() == 1 && iPoints.Count() == 1 ) + { + return EGestureMultiTouchStart; + } + else + { + return MultiTouchCode( iPoints, iSecondaryPoints, iPinchStartDistance,IsHighPinchTolerance() ); + } + + case ESingleTouchComplete: + { + if ( iIsDoubleTap ) + { + return EGestureDoubleTap; + } + + // If there was a mulitouch within the last gesture then ignore the tap + TGestureCode gestureCode = CodeFromPoints( iPoints, aRelevantAxis ); + if( gestureCode == EGestureTap && iIsMultiTouched) + { + return EGestureUnknown; + } + return gestureCode; + } + case EMultiTouchComplete: + return MultiTouchCode( iPoints, iSecondaryPoints, iPinchStartDistance,IsHighPinchTolerance()); + + case ESingleTouchReleased: + return EGestureReleased; + case EMultiTouchReleased: + return EGestureMultiTouchReleased; + + case ECancelled: // fallthrough + case ENotActive: + default: + return EGestureUnknown; + } + } + +// ---------------------------------------------------------------------------- +// IsHolding +// ---------------------------------------------------------------------------- +// +TBool CGesture::IsHolding() const + { + return iHoldingState >= EHoldStarting; + } + +// ---------------------------------------------------------------------------- +// StartPos +// ---------------------------------------------------------------------------- +// +TPoint CGesture::StartPos() const + { + // at least one point will be in the array during callback (pointer down pos) + return iPoints[ 0 ].iPos; + } + +// ---------------------------------------------------------------------------- +// CurrentPos +// ---------------------------------------------------------------------------- +// +TPoint CGesture::CurrentPos() const + { + // at least on point will be in the array during callback (pointer down pos) + return iPoints[ iPoints.Count() - 1 ].iPos; + } + +// ---------------------------------------------------------------------------- +// IsMovementStopped +// ---------------------------------------------------------------------------- +// +inline TBool CGesture::IsMovementStopped() const + { + // iCompletionTime is only only valid if client has called SetComplete + if ( iState >= ESingleTouchComplete ) + { + return Elapsed( NthLastEntry( 1 ).iTime, iCompletionTime ).Int() > KSpeedStopTime; + } + return EFalse; + } + +namespace + { + const TInt KFloatingPointAccuracy = 0.000001; + + /** @return percentage (0.0-1.0) how far aPos is from aEdge1 towards aEdge2 */ + inline TReal32 Proportion( TReal32 aPos, TReal32 aEdge1, TReal32 aEdge2 ) + { + if ( Abs( aEdge2 - aEdge1 ) > KFloatingPointAccuracy ) + { + return ( aPos - aEdge1 ) / ( aEdge2 - aEdge1 ); + } + return 0; // avoid division by zero + } + + /** Edges (pixels) at which speed should be -100% or 100% */ + NONSHARABLE_STRUCT( TEdges ) + { + TReal32 iMin; + TReal32 iMax; + }; + + /** + * scale which allows different (coordinate -> percentage) mapping + * between -100% to 0% and 0 and 100% + */ + NONSHARABLE_STRUCT( TScale ) + { + TScale( TInt aZero, const TEdges& aEdges ) + : iMin( aEdges.iMin ), iZero( aZero ), iMax( aEdges.iMax ) + { + } + + /** @return aPos as a percentage between -100% and 100% in aScale */ + TReal32 Percent( TReal32 aPos ) const; + + /// coordinate where speed is -100% + TReal32 iMin; + /// coordinate where speed is 0% + TReal32 iZero; + /// coordinate where speed is 100% + TReal32 iMax; + }; + + /** @convert aPos into a percentage between -100% and 100% in aScale */ + TReal32 TScale::Percent( TReal32 aPos ) const + { + TReal32 percent; + if ( aPos < iZero ) + { + // return negative percentages on the lower side of zero point + percent = -1 * Proportion( aPos, iZero, iMin ); + } + else + { + percent = Proportion( aPos, iZero, iMax ); + } + // constrain between -100% and 100% + return Min( Max( percent, -1.0F ), 1.0F ); + } + + /** Scale in x and y dimensions */ + NONSHARABLE_STRUCT( TScale2D ) + { + TRealPoint Percent( const TPoint& aPos ) const + { + return TRealPoint( iX.Percent( aPos.iX ), + iY.Percent( aPos.iY ) ); + } + + TScale iX; + TScale iY; + }; + + enum TDirection { ESmaller, ELarger }; + + /** @return the direction of pos compared to the previous pos */ + inline TDirection Direction( TInt aPos, TInt aPreviousPos ) + { + return aPos < aPreviousPos ? ESmaller : ELarger; + } + + /** Direction in x and y dimensions */ + NONSHARABLE_STRUCT( TDirection2D ) + { + TDirection iX; + TDirection iY; + }; + + /** Return the direction (up/down) of signal at aIndex */ + inline TDirection2D Direction( TInt aIndex, const RArray< TPointEntry >& aPoints ) + { + const TPoint& pos = aPoints[ aIndex ].iPos; + const TPoint& prevPos = aPoints[ aIndex - 1 ].iPos; + TDirection2D dir = { Direction( pos.iX, prevPos.iX ), + Direction( pos.iY, prevPos.iY ) }; + return dir; + } + /** + * @return a position in the aLow and aHigh, so that it aProportion of + * of length is above the pos + */ + TReal32 ProportionalLength( TReal32 aLow, TReal32 aHigh, TReal32 aProportion ) + { + return ( aHigh - aLow ) * aProportion / ( 1 + aProportion ); + } + + /** + * @return aVariableEdge scaled to new position, when the other edge changes + * from aOldEdge to aNewEdge, so that aOrigin maintains the *same relative + * position* between aVariableEdge and the other edge + */ + inline TReal32 ScaledEdge( TReal32 aOrigin, TReal32 aVariableEdge, + TReal32 aOldEdge, TReal aNewEdge ) + { + TReal32 proportion = Proportion( aOrigin, aVariableEdge, aOldEdge ); + return ( proportion * aNewEdge - aOrigin ) / ( proportion - 1 ); + } + + TScale Rescale( TReal32 aPos, TDirection aDir, TDirection aPrevDir, + const TScale& aPrevScale, const TEdges& aEdges ) + { + TScale scale( aPrevScale ); + if ( aPrevDir != aDir ) + { + // the code duplication is accepted here, since it is difficult to factor out + // while maintaining the understandability of this anyway complex algorithm + if ( aDir == ESmaller ) + { + scale.iMin = aEdges.iMin; + if ( aPrevScale.iZero < aPos ) + { + TReal32 proportionAboveZero = Proportion( aPos, aPrevScale.iZero, aPrevScale.iMax ); + scale.iZero = aPos - ProportionalLength( aEdges.iMin, aPos, proportionAboveZero ); + } + else + { + // adjust zero pos so that proportion between aPos, Min, and Zero pos + // stay the same (Min will move to 0, aPos stays the same) + scale.iZero = ScaledEdge( aPos, aPrevScale.iZero, + aPrevScale.iMin, aEdges.iMin ); + } + // adjust the upper edge to take into account the movement of zero pos + scale.iMax = ScaledEdge( aPos, aPrevScale.iMax, + aPrevScale.iZero, scale.iZero ); + } + else // ELarger + { + scale.iMax = aEdges.iMax; + if ( aPos < aPrevScale.iZero ) + { + TReal32 proportionBelowZero = Proportion( aPos, aPrevScale.iZero, aPrevScale.iMin ); + scale.iZero = aPos + ProportionalLength( aPos, aEdges.iMax, proportionBelowZero ); + } + else + { + // adjust zero pos so that proportion between aPos, Max, and Zero pos + // stay the same (Max will move edge, aPos stays the same) + scale.iZero = ScaledEdge( aPos, aPrevScale.iZero, + aPrevScale.iMax, aEdges.iMax ); + } + // adjust the lower edge to take into account the movement of zero pos + scale.iMin = ScaledEdge( aPos, aPrevScale.iMin, + aPrevScale.iZero, scale.iZero ); + } + } + return scale; + } + + /** Edges in x and y dimensions */ + NONSHARABLE_STRUCT( TEdges2D ) + { + TEdges iX; + TEdges iY; + }; + + /** + * @param aEdges edges of the area in which gesture points are accepted + * @return the scale of latest point in the list of points + */ + TScale2D Scale( const RArray< TPointEntry >& aPoints, const TEdges2D& aEdges ) + { + TScale2D scale = { TScale( aPoints[0].iPos.iX, aEdges.iX ), + TScale( aPoints[0].iPos.iY, aEdges.iY ) }; + TInt count = aPoints.Count(); + if ( count > 1 ) + { + // iterate the whole point list to arrive to the current scale + TDirection2D dir( Direction( 1, aPoints ) ); + for ( TInt i = 1; i < count; i++ ) + { + // get direction at i + TDirection2D newDir( Direction( i, aPoints ) ); + // get new scale at i + scale.iX = Rescale( aPoints[i - 1].iPos.iX, newDir.iX, dir.iX, scale.iX, aEdges.iX ); + scale.iY = Rescale( aPoints[i - 1].iPos.iY, newDir.iY, dir.iY, scale.iY, aEdges.iY ); + dir = newDir; + } + } + return scale; + } + } // unnamed namespace + +TRealPoint CGesture::SpeedPercent( const TRect& aEdges ) const + { + // x and y coordinates are easier to handle separately, extract from TRect: + // ((iMinX, iMinY), (iMaxX, iMaxY)) -> ((iMinX, iMaxX), (iMinY, iMaxY)) + TEdges2D edges = { { aEdges.iTl.iX, aEdges.iBr.iX }, + { aEdges.iTl.iY, aEdges.iBr.iY } }; + // work out the current scale (coordinate -> percentage mapping) from + // the history of points (i.e., points of current gesture). Then + // calculate the percentage of the current position. + return Scale( iPoints, edges ).Percent( CurrentPos() ); + } + +// ---------------------------------------------------------------------------- +// Speed +// ---------------------------------------------------------------------------- +// +TRealPoint CGesture::Speed() const + { + const TReal32 KMicroSecondsInSecond = 1000000; + + // Speed is only evaluated at the end of the swipe + // if user stops at the end of the swipe before lifting stylus, + // speed is zero. If time is zero, return 0 speed (infinite does + // not make sense either). Will need to consider also earlier points + // and their times or start time, if this zero-speed behavior is a problem + TRealPoint speed; + TReal32 time = static_cast( TimeFromPreviousPoint().Int() ) + / KMicroSecondsInSecond; + if ( !IsMovementStopped() && time > 0 ) + { + TPoint distance = CurrentPos() - PreviousPos(); + speed.iX = static_cast( distance.iX ) / time; + speed.iY = static_cast( distance.iY ) / time; + } + return speed; + } + +// ---------------------------------------------------------------------------- +// Distance +// ---------------------------------------------------------------------------- +// +TPoint CGesture::Distance() const + { + return CurrentPos() - StartPos(); + } + +// ---------------------------------------------------------------------------- +// Visual +// ---------------------------------------------------------------------------- +// +CAlfVisual* CGesture::Visual() const + { + return iVisual; + } + +// ---------------------------------------------------------------------------- +// TimeFromPreviousPoint +// ---------------------------------------------------------------------------- +// +inline TTimeIntervalMicroSeconds32 CGesture::TimeFromPreviousPoint() const + { + const TInt KLatestEntryOffset = 1; + return Elapsed( PreviousEntry().iTime, NthLastEntry( KLatestEntryOffset ).iTime ); + } + +// ---------------------------------------------------------------------------- +// return nth point from the end of the points array +// ---------------------------------------------------------------------------- +// +inline const TPointEntry& CGesture::NthLastEntry( TInt aOffset ) const + { + return iPoints[ Max( iPoints.Count() - aOffset, 0 ) ]; + } + +// ---------------------------------------------------------------------------- +// PreviousEntry +// ---------------------------------------------------------------------------- +// +inline const TPointEntry& CGesture::PreviousEntry() const + { + return NthLastEntry( KPreviousPointOffset ); + } + +// ---------------------------------------------------------------------------- +// PreviousPos +// ---------------------------------------------------------------------------- +// +inline TPoint CGesture::PreviousPos() const + { + return PreviousEntry().iPos; + } + +// ---------------------------------------------------------------------------- +// PinchPercent +// ---------------------------------------------------------------------------- +// +TInt CGesture::PinchPercent() const + { + // Added 0.5 to avoid 5.7 getting rounded off to 5. + return (iPinchEndDistance*100/iPinchStartDistance) + 0.5; + } + +// ---------------------------------------------------------------------------- +// PinchCentrePoint +// ---------------------------------------------------------------------------- +// +TPoint CGesture::PinchCentrePoint() const + { + if( iPoints.Count() <= 0 || iSecondaryPoints.Count() <= 0 ) + { + return TPoint(0,0); + } + return TPoint( (iPoints[0].iPos.iX + iSecondaryPoints[0].iPos.iX)/2, (iPoints[0].iPos.iY + iSecondaryPoints[0].iPos.iY)/2); + } + +// end of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesture.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesture.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,267 @@ +/* +* Copyright (c) 2008-2008 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: Gesture class +* +*/ + +#ifndef _GESTURE_H_ +#define _GESTURE_H_ + +#include + +#include "gestureobserver.h" +#include "gesturerecogniser.h" +#include "pointarray.h" + +namespace GestureHelper +{ + +/** + * TGesture represents the gesture that the user has made. + * Implements MGestureEvent interface to allow clients to + * inspect the gesture + */ +NONSHARABLE_CLASS( CGesture ) : public CBase, public MGestureEvent + { +public: + /** constructor */ + CGesture(); + /** destructor */ + ~CGesture(); + + /** + * @return a new gesture that will have only the first point + * of this gesture. Can be used to create gesture's a "start" event + * after some other points have been received. + */ + CGesture* AsStartEventLC() const; + + /** + * Sets the gesture as empty. resets timers to receive points + * immediately + */ + void Reset(); + + /** @return ETrue if the gesture has no points */ + TBool IsEmpty() const; + + /** @return ETrue if there are no points in the second array */ + TBool IsMultiTouch() const; + + /** + * Add a point to the sequence of points that forms the gesture + * Call Reset() just before adding the first point + * @param aPoint the point to add + * @return error code + */ + TInt AddPoint( const TPoint& aPoint ); + + /** + * Add a point to the sequence of points that forms the gesture + * Adds the point to the secondray pointer array. + * Used to add second pointer movement in case of multi touch + * Call Reset() just before adding the first point + * @param aPoint the point to add + * @return error code + */ + TInt AddSecondaryPoint( const TPoint& aPoint ); + + /** Set the visual of this gesture. Should be called when gesture starts */ + void SetVisual( CAlfVisual* aVisual ); + + /** @return ETrue if the point is very near the holding point */ + TBool IsNearHoldingPoint( const TPoint& aPoint ) const; + /** Set the latest point as the holding point */ + void SetHoldingPoint(); + /** @return ETrue if aPoint is the same as point added last */ + TBool IsLatestPoint( const TPoint& aPoint ) const; + /** @return ETrue if aPoint is the same as point added last in the secondary array */ + TBool IsLatestSecondaryPoint( const TPoint& aPoint ) const; + + /** + * After call, Code(...) will return appropriate holding gesture code. + */ + void StartHolding(); + /** + * After call, Code(...) will return a "hold released" gesture code when + * the gesture is completed. Meanwhile, code will be drag. + */ + void ContinueHolding(); + /** Set as single touch gesture started */ + void SetSingleTouchActive(); + /** Set as multitouch gesture started */ + void SetMultiTouchActive(); + /** Set as stylus released when there was only one stylus pressed */ + void SetSingleTouchReleased(); + /** Set as stylus released when there were two pointers, one pointer is still pressed down */ + void SetMultiTouchReleased(); + /** Set the single touch gesture as complete. Gesture is completed at pointer up */ + void SetSingleTouchComplete(); + /** Set the multitouch gesture as complete. Single touch still continues */ + void SetMultiTouchComplete(); + /** After call, Code(...) will return a "cancelled" gesture code */ + void SetCancelled(); + + /** force returning a code as double tap when gesture is complete */ + void SetDoubleTap(); + + /** + * @return Whether the current gesture is a tap (and hence not a swipe) + * Does not consider holding or other state information (such as + * whether the gesture was just started or is dragging). + * Results are based purely on the current stream of points. + */ + TBool IsTap() const; + + /** + * Checks if the current points in primary and secondary pointer array results in + * a pinch gesture. If yes updates the previous distance. + * @return Whether the current gesture is a pinch + * Returns EFalse if multitouch is not active currently. + * Results are based purely on the current stream of points. + */ + TBool IsPinch(); + + /** + * Reset all the events recieved in the current gesture. + * Calls Reset() internally. + * create a new points starting from the last point of the + * earlier gesture + * Used when the multitouch point is released to start the + * single touch operations. + * @param aFirstPointer, Should reset to the first pointers last point or to the 2d pointers. + * false (2nd pointers last point) when multitouch is going on and user releases the first point and + * continues to hold the second point + */ + void ResetToLastPoint(TBool aSetPointerZero,TBool aSetToZero); + +// From MGestureEvent + TGestureCode Code( TAxis aRelevantAxis ) const; + TBool IsHolding() const; + TPoint StartPos() const; + TPoint CurrentPos() const; + TRealPoint Speed() const; + TRealPoint SpeedPercent( const TRect& aEdges ) const; + TPoint Distance() const; + CAlfVisual* Visual() const; + TInt PinchPercent() const; + TPoint PinchCentrePoint()const; + +private: + /** @return elapsed time between the latest and previous points */ + inline TTimeIntervalMicroSeconds32 TimeFromPreviousPoint() const; + + /** @return elapsed time between the latest and first points */ + inline TTimeIntervalMicroSeconds32 TimeFromStart() const; + + /** @return ETrue if user has stopped moving the stylus before lifting it */ + inline TBool IsMovementStopped() const; + + /** @return aOffset'th last entry in the list of points */ + inline const TPointEntry& NthLastEntry( TInt aOffset ) const; + + /** @return previous point (may not be exactly the point before last) */ + inline const TPointEntry& PreviousEntry() const; + + /** @return position of point received just before the latest point */ + inline TPoint PreviousPos() const; + + /** @return the last point in the given pointer array */ + inline const TPointEntry LastPoint( const RArray< TPointEntry >& aPoints ) const; + + /** @return whether a slightly higher tolarence needs to be used for pinch or not*/ + inline TBool IsHighPinchTolerance() const; + +private: + + /// sequence of points that make up the gesture. own. + /// Single touch pointer variations. + RArray< TPointEntry > iPoints; + + /// sequence of points that make up the gesture. own. + /// Second touch pointer variations. + RArray< TPointEntry > iSecondaryPoints; + + /// index in iPoints of the point in which user started holding + TInt iHoldingPointIndex; + + /// the different states that indicate whether user has made a holding gesture + enum THoldingState + { + ENotHolding = 0, // before holding activated (i.e., holding not activated) + EHoldStarting, // holding activated just now (lasts just one callback round) + EHolding // holding activated earlier + }; + + /// state that indicates is user has held the pointer down in one position + /// for long time to indicate a holding gesture + THoldingState iHoldingState; + + /// Whether the gesture completion code will be forcefully overridden to be double tap, + /// regardless of what the points are + TBool iIsDoubleTap; + + /// If in the current gesture, there was a multi touch at any in between point. + /// This is required, if after doing a multitouch, release one pointer and do some + /// operation with the other pointer still touched down. Though the new variations + /// of pointer results in a tap, tap is not possible after a multitouch. + TBool iIsMultiTouched; + + enum TCompletionState + { + ENotActive = 0, + ESingleTouchActive, + EMultiTouchActive, + ECancelled, + EMultiTouchComplete, + EMultiTouchReleased, + ESingleTouchComplete, + ESingleTouchReleased + }; + + /// gesture only becomes complete when user lifts the pointer + TCompletionState iState; + + /// time when the stylus was lifted. + TTime iCompletionTime; + + /// visual relevant to this gesture. null if not known. + CAlfVisual* iVisual; + + /// The distance between the two points, at the time of last identified pinch gesture + /// This will also be the start distance for next pinch. At start it will + /// be the distance between touch down points + TInt iPinchStartDistance; + + /// The distance between the two points, at the time of pinch identified + TInt iPinchEndDistance; + + /// Pinch detcted, true for one cycle,untill a new point is recieved. + TBool iPinchDetected; + + enum TZoomState + { + ENoZoom = 0, + EZoomOut, + EZoomIn + }; + + /// gesture only becomes complete when user lifts the pointer + TZoomState iZoomState; + + }; + +} // namespace GestureHelper + +#endif // _GESTURE_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturecontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2007 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: Gesture control +* +*/ + +// class include +#include "gesturecontrol.h" + +// system includes +#include + +// local includes +#include "gesturehelper.h" + +using namespace GestureHelper; + +// ---------------------------------------------------------------------------- +// Two-phase constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGestureControl* CGestureControl::NewLC( MGestureObserver& aObserver, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) + { + CGestureControl* self = new ( ELeave ) CGestureControl; + CleanupStack::PushL( self ); + self->ConstructL( aObserver, aEnv, aDisplay, aFreeControlGroupId ); + // create a full screen visual to capture pointer events anywhere on screen + self->AppendVisualL( EAlfVisualTypeVisual ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGestureControl::CGestureControl() + { + // do nothing + } + +// ---------------------------------------------------------------------------- +// Second-phase constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureControl::ConstructL( MGestureObserver& aObserver, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) + { + CAlfControl::ConstructL( aEnv ); + iHelper = GestureHelper::CGestureHelper::NewL( aObserver ); + iHelper->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId ); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGestureControl::~CGestureControl() + { + delete iHelper; + } + +// ---------------------------------------------------------------------------- +// OfferEventL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureControl::OfferEventL( const TAlfEvent& aEvent ) + { + return iHelper->OfferEventL( aEvent ); + } + +// ---------------------------------------------------------------------------- +// SetHoldingEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureControl::SetHoldingEnabled( TBool aEnabled ) + { + iHelper->SetHoldingEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsHoldingEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureControl::IsHoldingEnabled() const + { + return iHelper->IsHoldingEnabled(); + } + +// ---------------------------------------------------------------------------- +// SetDoubleTapEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureControl::SetDoubleTapEnabled( TBool aEnabled ) + { + iHelper->SetDoubleTapEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsDoubleTapEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureControl::IsDoubleTapEnabled() const + { + return iHelper->IsDoubleTapEnabled(); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturedefs.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008 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: Gesture helper constant definitions +* +*/ + +#ifndef _GESTUREDEFS_H_ +#define _GESTUREDEFS_H + + +namespace GestureHelper +{ + +/// time to hold the stylus in the same position to activate holding +const TInt KHoldDuration = 1000000; // microseconds + +/// time to tap again for the second tap to be a double tap +const TInt KMaxDoubleTapDuration = 400000; // microseconds + +/// time in which speed becomes zero if user stops stylus movement before +/// lifting the pointer +const TInt KSpeedStopTime = 100000; // microseconds + +/// tolerance in degrees to either side of an angle, for direction to be the +/// same as reference angle +const TReal KAngleTolerance = 25; + +/// Nth pointer event before the latest point +const TInt KPreviousPointOffset = 3; + +/// Tolerance for ignoring small movements, percent of longer screen edge +const TInt KGestureTolerancePercent = 4; // of 100 + +/// Tolerance for considering it as pinch gesture for the first time +const TInt KInitialPinchTolerance = 5; // Pixels + +/// Tolerance for considering it as pinch gesture after a pinch is detected +const TInt KPinchTolerance = 5; // Pixels + +/** + * Panic codes + */ +enum TGesturePanic + { + EGesturePanicIllegalLogic + }; + +/** Panics the thread */ +inline void Panic( TGesturePanic aReason ) + { + _LIT( KComponentName, "GestureHelper" ); + User::Panic( KComponentName, aReason ); + } + +} // namespace GestureHelper + +#endif // _GESTUREDEFS_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturehelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturehelper.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2007 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: Gesture helper interface +* +*/ + +// class include +#include "gesturehelper.h" + +// local includes +#include "gesturehelperimpl.h" + +using namespace GestureHelper; + +// ---------------------------------------------------------------------------- +// Two-phase constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGestureHelper* CGestureHelper::NewL( MGestureObserver& aObserver ) + { + CGestureHelper* self = new ( ELeave ) CGestureHelper; + CleanupStack::PushL( self ); + self->iImpl = CGestureHelperImpl::NewL( aObserver ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGestureHelper::~CGestureHelper() + { + delete iImpl; + } + +// ---------------------------------------------------------------------------- +// SetHoldingEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureHelper::SetHoldingEnabled( TBool aEnabled ) + { + iImpl->SetHoldingEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsHoldingEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureHelper::IsHoldingEnabled() const + { + return iImpl->IsHoldingEnabled(); + } + +// ---------------------------------------------------------------------------- +// SetDoubleTapEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureHelper::SetDoubleTapEnabled( TBool aEnabled ) + { + iImpl->SetDoubleTapEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsDoubleTapEnabled +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureHelper::IsDoubleTapEnabled() const + { + return iImpl->IsDoubleTapEnabled(); + } + +// ---------------------------------------------------------------------------- +// InitAlfredPointerEventCaptureL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureHelper::InitAlfredPointerCaptureL( CAlfEnv& aEnv, + CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) + { + iImpl->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId ); + } + +// ---------------------------------------------------------------------------- +// HandlePointerEventL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureHelper::HandlePointerEventL( const TPointerEvent& aEvent ) + { + return iImpl->HandlePointerEventL( aEvent ); + } + +// ---------------------------------------------------------------------------- +// OfferEventL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGestureHelper::OfferEventL( const TAlfEvent& aEvent ) + { + return iImpl->OfferEventL( aEvent ); + } + +// ---------------------------------------------------------------------------- +// Cancel +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureHelper::Cancel() + { + iImpl->Reset(); + } + +// ---------------------------------------------------------------------------- +// AddObserver +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGestureHelper::AddObserver(MGestureObserver* aObserver) + { + iImpl->AddObserver(aObserver); + } + +// end of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturehelperimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturehelperimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,924 @@ +/* +* Copyright (c) 2008 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: Gesture helper implementation +* +*/ + +#include "gesturehelperimpl.h" + +#include +#include +#include + +#include "gesture.h" +#include "gesturedefs.h" + +#include "pointercapturer.h" + +using namespace GestureHelper; + +namespace GestureHelper +{ + +/// type of function in gesture helper to be called by the timer +/// when timer triggers +typedef void (CGestureHelperImpl::*CallbackFunctionL)(); + +NONSHARABLE_CLASS( CCallbackTimer ) : public CTimer + { +public: + /** Two-phase constructor */ + static CCallbackTimer* NewL( CGestureHelperImpl& aHelper, + CallbackFunctionL aCallbackFunctionL, TInt aDelay, TBool aIsEnabled ) + { + CCallbackTimer* self = new ( ELeave ) CCallbackTimer( aHelper, + aCallbackFunctionL, aDelay, aIsEnabled ); + CleanupStack::PushL( self ); + self->ConstructL(); // construct base class + CActiveScheduler::Add( self ); + CleanupStack::Pop( self ); + return self; + } + + /** Destructor */ + ~CCallbackTimer() + { + Cancel(); + } + + /** Set whether sending holding events is currently enabled */ + void SetEnabled( TBool aEnabled ) + { + iIsEnabled = aEnabled; + // cancel in case hold timer is already running + Cancel(); + } + + /** @return whether sending holding events is currently enabled */ + TBool IsEnabled() const + { + return iIsEnabled; + } + + /** Start the timer. Calls CGestureHelperImpl::StartHoldingL upon completion */ + void Start() + { + // if sending hold events is disabled, do not ever start the hold timer, and + // hence hold events will never be triggered + if ( iIsEnabled ) + { + Cancel(); + After( iDelay ); + } + } + +private: + /** Constructor */ + CCallbackTimer( CGestureHelperImpl& aHelper, + CallbackFunctionL aCallbackFunctionL, TInt aDelay, TBool aIsEnabled ) + : CTimer( EPriorityUserInput - 1 ), // give higher priority to new pointer events with - 1 + iHelper( aHelper ), iCallbackFunctionL( aCallbackFunctionL ), + iDelay( aDelay ), iIsEnabled( aIsEnabled ) + { + } + + void RunL() // From CActive + { + (iHelper.*iCallbackFunctionL)(); + } + +private: + /// helper object that will be called back when timer is triggered + CGestureHelperImpl& iHelper; + /// Function in the iHelper object call + CallbackFunctionL iCallbackFunctionL; + /// How long a time to wait befor calling back after Start() + TInt iDelay; + /// whether sending holding events is currently enabled + TBool iIsEnabled; + }; + +} // namespace GestureHelper + +/** + * @return position from event. Use this instead of using aEvent direction to + * avoid accidentally using TPointerEvent::iPosition + */ +inline TPoint Position( const TPointerEvent& aEvent ) + { + // use parent position, since the capturer is using full screen area, + // and because the (Alfred) drag events are not local to visual even when + // coming from the client + return aEvent.iParentPosition; + } + +// ---------------------------------------------------------------------------- +// Two-phase constructor +// ---------------------------------------------------------------------------- +// +CGestureHelperImpl* CGestureHelperImpl::NewL( MGestureObserver& aObserver ) + { + CGestureHelperImpl* self = new ( ELeave ) CGestureHelperImpl( ); + CleanupStack::PushL( self ); + self->iDoubleTapTimer = CCallbackTimer::NewL( *self, EmitFirstTapEventL, + KMaxDoubleTapDuration, EFalse ); // double tap is disabled by default + self->iHoldingTimer = CCallbackTimer::NewL( *self, StartHoldingL, + KHoldDuration, ETrue ); // holding is enabled by default + self->iGesture = new ( ELeave ) CGesture(); + self->iUnusedGesture = new ( ELeave ) CGesture(); + self->iPointerCapturer = CPointerCapturer::NewL(); + self->iPointerCount = 0; + self->iObserver = &aObserver; + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGestureHelperImpl::~CGestureHelperImpl() + { + delete iDoubleTapTimer; + delete iHoldingTimer; + delete iGesture; + delete iPreviousTapGesture; + delete iUnusedGesture; + delete iPointerCapturer; + } + +// ---------------------------------------------------------------------------- +// SetHoldingEnabled +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::SetHoldingEnabled( TBool aEnabled ) + { + iHoldingTimer->SetEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsHoldingEnabled +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::IsHoldingEnabled() const + { + return iHoldingTimer->IsEnabled(); + } + +// ---------------------------------------------------------------------------- +// SetHoldingEnabled +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::SetDoubleTapEnabled( TBool aEnabled ) + { + iDoubleTapTimer->SetEnabled( aEnabled ); + } + +// ---------------------------------------------------------------------------- +// IsHoldingEnabled +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::IsDoubleTapEnabled() const + { + return iDoubleTapTimer->IsEnabled(); + } + +// ---------------------------------------------------------------------------- +// InitAlfredPointerEventCaptureL +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::InitAlfredPointerCaptureL( CAlfEnv& aEnv, + CAlfDisplay& aDisplay, TInt aFreeControlGroupId ) + { + iPointerCapturer->InitForAlfredL(*this, aEnv, aDisplay, aFreeControlGroupId ); + } + +// ---------------------------------------------------------------------------- +// Reset state +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::Reset() + { + iHoldingTimer->Cancel(); + iGesture->Reset(); + iPointerCapturer->Stop(); + iPointerCount=0; + iCurrentPointer = -1; + } + +/** + * Helper function that calls Reset on the pointer to CGestureHelperImpl + */ +static void ResetHelper( TAny* aHelper ) + { + static_cast< CGestureHelperImpl* >( aHelper )->Reset(); + } + +// ---------------------------------------------------------------------------- +// Handle a pointer event +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::HandlePointerEventL( const TPointerEvent& aEvent ) + { + return HandlePointerEventL( aEvent, NULL ); + } + +// ---------------------------------------------------------------------------- +// OfferEventL +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::OfferEventL( const TAlfEvent& aEvent ) + { + if ( aEvent.IsPointerEvent() ) + { + return HandlePointerEventL( aEvent.PointerEvent(), aEvent.Visual() ); + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// Handle a pointer event +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::HandlePointerEventL( const TPointerEvent& aEvent, + CAlfVisual* aVisual ) + { + TInt pointerNumber = GestureHelper::TGestureRecogniser().PointerNumber( aEvent ); + + if( !ValidatePointer( aEvent, pointerNumber ) ) + { + return EFalse; // don't consume + } + + switch ( aEvent.iType ) + { + case TPointerEvent::EButton1Down: + // Error handling for recieveing a button down on the pointer which + // is already touched down + // Here the pointer number shouldnot be considered for validtaing. + // We should consider which pointer is currently touched down + // It can so happen that user has touched was doing pinch and then released his + // 1st finger. and starts to do panning with the second finger still touched down. + // Then again when he touches the first finger, in that case you should be validating these pointers w.r.t + // the pointer numbers of the last touched finger + + // we shouldnot consider pointer number here. If pointer 1 is + // already touched and dragging and we recieve a down of pointer 0 + if( iPointerCount == 0 && pointerNumber == 1) + { + return EFalse; + } + else if( iPointerCount == 1 ) + { + if(iCurrentPointer == pointerNumber ) + { + TRAP_IGNORE( EmitCancelEventL() ); + Reset(); + } + } + else if( iPointerCount == 2 ) + { + // This case is similar to reciving a pointer up on the pointer + // on which the second down is recieved. We reset all the earlier points + // recieved on this pointer because we assume that some pointer up got + // missed in between. + + // if pointer count is already 2, then reset the array of pointer for + // which a down event is recieved, and continue handling in normal way + // Fix for error crash in photos fullscreen + // Like above if you reset the pointer array for which the down event + // is recieved the second time then in thecase of, 0 down, 1 down, 0 down + // iPoints will be null. + // Here whenever reseting it to single pointer havndling, always iPoints should have + // the data. Hence the first parameter should always be true. + // Fix is iGesture->ResetToLastPoint(pointerNumber != 0,pointerNumber != 0); + // is changed to iGesture->ResetToLastPoint( ETrue,pointerNumber != 0); + iPointerCount = 1; + iCurrentPointer = pointerNumber == 0 ? 1 : 0; + iGesture->ResetToLastPoint( ETrue,pointerNumber != 0); + iGesture->SetSingleTouchActive(); + } + + if(iPointerCount == 0) + { + iPointerCount = 1; + iCurrentPointer = pointerNumber; + // single touch gesture start + iGesture->SetSingleTouchActive(); + HandleSinglePointerEventL( aEvent, aVisual ); + } + else if(iPointerCount == 1) + { + iPointerCount = 2; + iCurrentPointer = -1; + // add the last point of the single touch event + // to first array of gesture + iGesture->ResetToLastPoint(pointerNumber != 0,ETrue); + iGesture->SetMultiTouchActive(); + // multi touch gesture start + HandleMultiplePointerEventL( aEvent, pointerNumber ); + } + else + { + + } + break; + + case TPointerEvent::EDrag: + if(iPointerCount == 1) + { + if(pointerNumber == iCurrentPointer) + { + HandleSinglePointerEventL( aEvent, aVisual ); + } + else + { + // only the drags on the current pointer should be considered. + return EFalse; + } + + } + else if(iPointerCount == 2) + { + HandleMultiplePointerEventL( aEvent, pointerNumber ); + } + else + { + // nothing to be done + } + break; + + case TPointerEvent::EButton1Up: + if(iPointerCount == 2) + { + // multi touch gesture complete + HandleMultiplePointerEventL( aEvent, pointerNumber ); + // should the pointer count decrese first n then + // handling of event or otherwise + iPointerCount = 1; + iCurrentPointer = pointerNumber == 0 ? 1 : 0; + iGesture->ResetToLastPoint(ETrue,pointerNumber != 0); + iGesture->SetSingleTouchActive(); + } + else if( iPointerCount == 1 ) + { + iPointerCount = 0; + iCurrentPointer = -1; + // single touch gesture complete + HandleSinglePointerEventL( aEvent, aVisual ); + } + else + { + // nothing to be done + } + break; + + default: + break; + } + return ETrue; // consume + } +// ---------------------------------------------------------------------------- +// Handle a pointer event +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::HandleSinglePointerEventL( const TPointerEvent& aEvent, + CAlfVisual* aVisual ) + { + switch ( aEvent.iType ) + { + case TPointerEvent::EButton1Down: + // If no up event was received during previous gesture, cancel + // previous event and reset state + if ( !IsIdle() ) + { + // ambiguous what is the right thing when "cancel" event leaves + // and "start" does not. Leaving for cancel *after* "start" could + // be unexpected to client, as client would have handled start + // event successfully. Assume that leaving upon cancellation + // can be ignored. + TRAP_IGNORE( EmitCancelEventL() ); + Reset(); + } + // as long as down event of a double tap comes within the double + // tap timeout, it does not matter how long the user keeps the finger + // pressed for the gesture to be a double tap. Therefore, cancel + // the timeout, as it is no longer relevant. (Of course, this call + // will only do something if the timer is actually running, which + // is only if received a tap event very recently.) + iDoubleTapTimer->Cancel(); + // adding the first point implicitly makes the state "not idle" + AddPointL( aEvent ); + iGesture->SetVisual( aVisual ); + // if pointer capturer leaves, the remaining pointer events will + // not be captured if stylus is dragged outside the capturing visual + // an error note will be shown, so the potential problem is irrelevant, + // assuming client does not (incorrectly) block the leave from reaching + // the framework + iPointerCapturer->StartL(); + // Delay emitting a down event _until_ it is known that this beginning + // gesture is _not_ the second tap of a double tap event. + // iPreviousTapGesture is only non-null if very recently received + // a tap event and double tap is enabled. + if ( !iPreviousTapGesture ) + { + EmitEventL( *iGesture ); + } + // else delay emitting an event, as it might be a double tap + // (allow the second tap of a double tap to be anywhere, so don't check + // for start pos here) + break; + + case TPointerEvent::EDrag: + // While stylus down, the same event is received repeatedly + // even if stylus does not move. Filter out by checking if point + // is the same as the latest point + if ( !iGesture->IsLatestPoint( Position( aEvent ) ) ) + { + AddPointL( aEvent ); + + // as long as the starting gesture is seen as a tap, do not emit any + // drag events + if ( !iGesture->IsTap() ) + { + // if there is a previous tap gesture, getting drag events means that + // the previous gesture is not a double tap. So emit the previous gesture. + if ( iPreviousTapGesture ) + { + // this is a second gesture after a tap (double tap is enabled) + EmitFirstTapEventL(); + // emit down event for the current gesture (since its down was delayed, until + // it was to be known if the event is a tap. That is known now.) + EmitStartEventL( *iGesture ); + } + // restart holding timer every time the current stylus pos changes + StartHoldingTimer( aEvent ); + // emit the drag event to client + EmitEventL( *iGesture ); + } + // else: do not emit drag events until it is known that the gesture is not a tap + // (or the second tap of double tap) + } + break; + + case TPointerEvent::EButton1Up: + // reset in case the down event for next gesture is not received for a reason + // in client, and instead drag or up events are received. + // reset via cleanup stack to ensure Reset is run even if + // observer leaves + CleanupStack::PushL( TCleanupItem( &ResetHelper, this ) ); + // if adding of the point fails, notify client with a + // cancelled event. It would be wrong to send another + // gesture code when the up point is not known + if ( KErrNone == AddPoint( aEvent ) ) + { + // if the gesture is a tap, the gesture is either the first tap of a _potential_ + // double tap, or the second tap of a double tap + if ( iDoubleTapTimer->IsEnabled() && iGesture->IsTap() ) + { + __ASSERT_DEBUG( !iGesture->IsHolding(), Panic( EGesturePanicIllegalLogic ) ); + if ( !iPreviousTapGesture ) + { + // First tap. Delay emitting its code evemt and released events until it is known + // whether the tap is a double tap + iPreviousTapGesture = iGesture; + iGesture = NewGesture(); + iDoubleTapTimer->Start(); + } + else + { + // This is a second tap of a double tap. Do not emit anything for the second + // tap. Only down event has been emitted for the first tap. Emit the code + // event (double tap) and released for the first tap. + iPreviousTapGesture->SetDoubleTap(); + EmitFirstTapEventL(); + } + } + else + { + // modified iGesture to be "released" + CompleteAndEmitSingleTouchL( *iGesture ); + } + } + else + { // adding a point failed + EmitCancelEventL(); + } + // reset state + CleanupStack::PopAndDestroy( this ); + break; + + default: + break; + } + return ETrue; // consume + } + +// ---------------------------------------------------------------------------- +// Handle multiple pointer events +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::HandleMultiplePointerEventL( const TPointerEvent& aEvent, + const TInt aPointerNumber ) + { + switch ( aEvent.iType ) + { + case TPointerEvent::EButton1Down: + // adding the first point implicitly makes the state "not idle" + AddMultiTouchPointsL( aEvent, aPointerNumber); + EmitEventL( *iGesture ); + break; + + case TPointerEvent::EDrag: + // While stylus down, the same event is received repeatedly + // even if stylus does not move. Filter out by checking if point + // is the same as the latest point + if( AddMultiTouchPointsL(aEvent, aPointerNumber )) + { + // as long as the starting gesture is seen as a tap, do not emit any + // drag events + if ( iGesture->IsPinch() ) + { + // emit the pinch event to client + EmitEventL( *iGesture ); + } + // else: do not emit any events to the client + } + + + break; + + case TPointerEvent::EButton1Up: + + // if adding of the point fails, notify client with a + // cancelled event. It would be wrong to send another + // gesture code when the up point is not known + AddMultiTouchPointsL(aEvent, aPointerNumber ); + CompleteAndEmitDoubleTouchL( *iGesture ); + + break; + + default: + break; + } + return ETrue; // consume + } + +// ---------------------------------------------------------------------------- +// Validate AddMultiTouchPointsL events +// Check if the point recieved is the repeavt event of previous point or a new point +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline TBool CGestureHelperImpl::AddMultiTouchPointsL( const TPointerEvent& aEvent, const TInt aPointerNumber) + { + TBool pointAdded = EFalse; + if ( aPointerNumber > 0 ) + { + if ( !iGesture->IsLatestSecondaryPoint( Position( aEvent ) ) ) + { + AddSecondaryPointL( aEvent ); + pointAdded = ETrue; + } + } + else + { + if ( !iGesture->IsLatestPoint( Position( aEvent ) ) ) + { + AddPointL( aEvent ); + pointAdded = ETrue; + } + } + return pointAdded; + } + +// ---------------------------------------------------------------------------- +// Check for Stray evnet +// ---------------------------------------------------------------------------- +// +TBool CGestureHelperImpl::StrayEvent( const TPointerEvent& aEvent ) const + { + //If we are recieving a button down on pointer 0 in pointer capturer then its a stray event + // Dont consume it + if ( aEvent.iType == TPointerEvent::EButton1Down && IsIdle( 0) ) + { + return ETrue; // don't consume + } + return EFalse; + } +// ---------------------------------------------------------------------------- +// Validate the events +// is it a valid event or a stray pointer form some other visuals +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline TBool CGestureHelperImpl::ValidatePointer( const TPointerEvent& aEvent, const TInt aPointerNumber) const + { + // Check if received event is valid or not. + // In practice, event is NOT valid in the following situations: + // + // 1. Pointer down event is received for pointer which is already down. + // 2. Pointer up event is received for pointer which is already up. + // 3. Pointer drag event is received for pointer which is not down. + // 4. Pointer numbers other than 0 and 1. We are handling only 2 pointers. + // + // In these situations this function returns EFalse, + // corresponding event is ignored and recognition continues as earlier. + // + + // filter all the events for which the pointer number is less than 0 + // or greater than 1. we will handle only 2 pointer events. + if( aPointerNumber >= 2 || aPointerNumber < 0 ) + { + return EFalse; + } + + // filter out events that do not start with button down. It is a stray + // event from another visual + TInt pointerTovalidate = aPointerNumber ; + if( iPointerCount == 1 && aPointerNumber == 1) + { + pointerTovalidate = 0; + } + if ( aEvent.iType != TPointerEvent::EButton1Down && IsIdle( pointerTovalidate ) ) + { + return EFalse; // don't consume + } + + + return ETrue; + } + +// ---------------------------------------------------------------------------- +// Is the helper idle? +// Checks whether any points are already added in the array corresponding +// to the pointer number +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline TBool CGestureHelperImpl::IsIdle( TBool aPointerNumber ) const + { + if( aPointerNumber == 0 ) + { + return iGesture->IsEmpty(); + } + else if( aPointerNumber == 1 ) + { + return iGesture->IsMultiTouch(); + } + return ETrue; + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline void CGestureHelperImpl::AddPointL( const TPointerEvent& aEvent ) + { + User::LeaveIfError( AddPoint( aEvent ) ); + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline TInt CGestureHelperImpl::AddPoint( const TPointerEvent& aEvent ) + { + return iGesture->AddPoint( Position ( aEvent ) ); + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline void CGestureHelperImpl::AddSecondaryPointL( const TPointerEvent& aEvent ) + { + User::LeaveIfError( AddSecondaryPoint( aEvent ) ); + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// inline ok in cpp file for a private member function +// ---------------------------------------------------------------------------- +// +inline TInt CGestureHelperImpl::AddSecondaryPoint( const TPointerEvent& aEvent ) + { + return iGesture->AddSecondaryPoint( Position ( aEvent ) ); + } + +// ---------------------------------------------------------------------------- +// StartHoldingTimer +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::StartHoldingTimer( const TPointerEvent& aNewEvent ) + { + if ( !( iGesture->IsHolding() || + iGesture->IsNearHoldingPoint( Position( aNewEvent ) ) ) ) + { + // restart hold timer, since pointer has moved + iHoldingTimer->Start(); + // Remember the point in which holding was started + iGesture->SetHoldingPoint(); + } + } + +/** + * Helper function that calls ContinueHolding on the pointer to TGesture + */ +static void ContinueHolding( TAny* aGesture ) + { + static_cast< CGesture* >( aGesture )->ContinueHolding(); + } + +// ---------------------------------------------------------------------------- +// Add a point to the sequence of points that together make up the gesture +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::StartHoldingL() + { + // hold & tap event is specifically filtered out. Use case: in list fast + // scrolling activation (e.g. enhanced coverflow), tap & hold should not + // start fast scroll. In addition, after long tap on start position, + // drag and drag & hold swiping should emit normal swipe and swipe&hold + // events. Therefore, tap & hold is not supported. + __ASSERT_DEBUG( !iGesture->IsTap() && !iPreviousTapGesture, Panic( EGesturePanicIllegalLogic ) ); + + // holding has just started, and gesture code should be provided to client. + // set gesture state so that it produces a gesture code (other than drag) + iGesture->StartHolding(); + + // create an item in the cleanup stack that will set the gesture state + // to holding-was-started-earlier state. NotifyL may leave, but the + // holding-was-started-earlier state must still be successfully set, + // otherwise, the holding gesture code will be sent twice + CleanupStack::PushL( TCleanupItem( &ContinueHolding, iGesture ) ); + + EmitEventL( *iGesture ); + + // set holding state to "post holding" + CleanupStack::PopAndDestroy( iGesture ); + } + +// ---------------------------------------------------------------------------- +// RecyclePreviousTapGesture +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::RecyclePreviousTapGesture( TAny* aSelf ) + { + CGestureHelperImpl& self = *reinterpret_cast( aSelf ); + self.RecycleGesture( self.iPreviousTapGesture ); + } + +// ---------------------------------------------------------------------------- +// Emit the remainder of the previous tap event (tap + released) +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::EmitFirstTapEventL() + { + // when this function is called, a tap has turned out to _not_ be a double tap + __ASSERT_DEBUG( IsDoubleTapEnabled(), Panic( EGesturePanicIllegalLogic ) ); + __ASSERT_DEBUG( iPreviousTapGesture, Panic( EGesturePanicIllegalLogic ) ); + + iDoubleTapTimer->Cancel(); + + // ensure previous tap gesture is reset even if client leaves + CleanupStack::PushL( TCleanupItem( &RecyclePreviousTapGesture, this ) ); + + CompleteAndEmitSingleTouchL( *iPreviousTapGesture ); + + // recycle the emitted gesture + CleanupStack::PopAndDestroy( this ); + } + +// ---------------------------------------------------------------------------- +// EmitStartEventL +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::EmitStartEventL( const CGesture& aGesture ) + { + CGesture* startGesture = aGesture.AsStartEventLC(); + EmitEventL( *startGesture ); + CleanupStack::PopAndDestroy( startGesture ); + } + +// ---------------------------------------------------------------------------- +// EmitCompletionEvents for single touch +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::CompleteAndEmitSingleTouchL( CGesture& aGesture ) + { + aGesture.SetSingleTouchComplete(); + // send gesture code if holding has not been started. If holding has + // been started, client has already received a "hold swipe left" e.g. event, in which + // case don't another "swipe left" event + if ( !aGesture.IsHolding() ) + { + // if client leaves, the state is automatically reset. + // In this case the client will not get the released event + EmitEventL( aGesture ); + } + // send an event that stylus was lifted + aGesture.SetSingleTouchReleased(); + EmitEventL( aGesture ); + } + +// ---------------------------------------------------------------------------- +// EmitCompletionEvents for double touch +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::CompleteAndEmitDoubleTouchL( CGesture& aGesture ) + { + aGesture.SetMultiTouchComplete(); + if ( aGesture.IsPinch() ) + { + // emit the pinch event to client + EmitEventL( aGesture ); + } + // send an event that stylus was lifted + aGesture.SetMultiTouchReleased(); + EmitEventL( aGesture ); + } + +// ---------------------------------------------------------------------------- +// EmitCancelEventL +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::EmitCancelEventL() + { + iDoubleTapTimer->Cancel(); + + // ensure previous tap gesture is reset even if client leaves + CleanupStack::PushL( TCleanupItem( &RecyclePreviousTapGesture, this ) ); + + CGesture& gestureToCancel = iPreviousTapGesture ? *iPreviousTapGesture : *iGesture; + gestureToCancel.SetCancelled(); + EmitEventL( gestureToCancel ); + + // recycle the emitted gesture + CleanupStack::PopAndDestroy( this ); + } + +// ---------------------------------------------------------------------------- +// Notify observer +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::EmitEventL( const CGesture& aGesture ) + { + // iPoints array must have content when this function is called + iObserver->HandleGestureL( aGesture ); + } + +// ---------------------------------------------------------------------------- +// Return a fresh gesture from the gesture pool (pool of one gesture) +// ---------------------------------------------------------------------------- +// +CGesture* CGestureHelperImpl::NewGesture() + { + __ASSERT_DEBUG( iUnusedGesture, Panic( EGesturePanicIllegalLogic ) ); // pool should no be empty + iUnusedGesture->Reset(); + CGesture* freshGesture = iUnusedGesture; + iUnusedGesture = NULL; + return freshGesture; + } + +// ---------------------------------------------------------------------------- +// Return a fresh gesture from the gesture pool (pool of one gesture) +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::RecycleGesture( CGesture*& aGesturePointer ) + { + // only one object fits into the pool, and that should currently be enough + // one pointer must be null, one non-null + __ASSERT_DEBUG( !iUnusedGesture != !aGesturePointer, Panic( EGesturePanicIllegalLogic ) ); + if ( aGesturePointer ) + { + iUnusedGesture = aGesturePointer; + aGesturePointer = NULL; + } + } + +// ---------------------------------------------------------------------------- +// AddObserver +// ---------------------------------------------------------------------------- +// +void CGestureHelperImpl::AddObserver(MGestureObserver* aObserver) + { + iObserver = aObserver; + } + +// end of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturehelperimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturehelperimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2007 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: Gesture helper implementation +* +*/ + +#ifndef _GESTUREHELPERIMPL_H_ +#define _GESTUREHELPERIMPL_H_ + +#include + +class CAlfEnv; +class CAlfDisplay; +class CAlfVisual; +class TAlfEvent; +struct TPointerEvent; + +namespace GestureHelper +{ + +class CCallbackTimer; +class CGesture; +class CPointerCapturer; +class MGestureObserver; + +/** + * Implementation of CGestureHelper interface + */ +NONSHARABLE_CLASS( CGestureHelperImpl ) : public CBase + { +public: + /** 2-phase constructor */ + static CGestureHelperImpl* NewL( MGestureObserver& aObserver ); + + /** Destructor */ + ~CGestureHelperImpl(); + + void InitAlfredPointerCaptureL( CAlfEnv& aEnv, CAlfDisplay& aDisplay, + TInt aFreeControlGroupId ); + + /** See @ref CGestureHelper::SetHoldingEnabled */ + void SetHoldingEnabled( TBool aEnabled ); + /** See @ref CGestureHelper::IsHoldingEnabled */ + TBool IsHoldingEnabled() const; + /** See @ref CGestureHelper::SetDoubleTapEnabled */ + void SetDoubleTapEnabled( TBool aEnabled ); + /** See @ref CGestureHelper::IsDoubleTapEnabled */ + TBool IsDoubleTapEnabled() const; + /** See @ref CGestureHelper::HandlePointerEventL */ + TBool HandlePointerEventL( const TPointerEvent& aEvent ); + /** See @ref CGestureHelper::OfferEventL */ + TBool OfferEventL( const TAlfEvent& aEvent ); + /** Reset helper state */ + void Reset(); + /** See @ref CGestureHelper::AddObserver */ + void AddObserver(MGestureObserver* aObserver); + /** Returns true the current event is a stray event form another visual */ + TBool StrayEvent( const TPointerEvent& aEvent ) const; + +private: + + /** + * Analyse how the pointer event affects the current gesture, and potentially + * notify the observer. + * @param aVisual visual on which the event fell on or NULL if not known + * @return ETrue if the event was consumed + */ + TBool HandlePointerEventL( const TPointerEvent& aEvent, CAlfVisual* aVisual ); + + /** + * Analyse how the pointer event affects the current gesture, and potentially + * notify the observer. + * @param aVisual visual on which the event fell on or NULL if not known + * @return ETrue if the event was consumed + */ + TBool HandleSinglePointerEventL( const TPointerEvent& aEvent, CAlfVisual* aVisual ); + + /** + * Analyse how the pointer event affects the current gesture, and potentially + * notify the observer. + * @param aVisual visual on which the event fell on or NULL if not known + * @return ETrue if the event was consumed + */ + TBool HandleMultiplePointerEventL( const TPointerEvent& aEvent, const TInt aPointerNumber ); + + /** @return ETrue if the helper has not started processing a gesture */ + inline TBool IsIdle( TBool aPointerNumber = 0 ) const; + /** Add a point to the sequence of points that make up the gesture */ + inline void AddPointL( const TPointerEvent& aEvent ); + /** Add a point to the sequence of points that make up the gesture */ + inline TInt AddPoint( const TPointerEvent& aEvent ); + /** Add a point to the sequence of points that make up the gesture */ + inline void AddSecondaryPointL( const TPointerEvent& aEvent ); + /** Add a point to the sequence of points that make up the gesture */ + inline TInt AddSecondaryPoint( const TPointerEvent& aEvent ); + /** Verify if the currnet pointer event recived is valid and expected */ + inline TBool ValidatePointer( const TPointerEvent& aEvent, const TInt aPointerNumber) const; + /** return if there is a second pointer held down */ + inline TBool IsMultiTouch() const; + /** Add points to corresponding array depending on aPointerNumber, return whether the point is added or not */ + inline TBool AddMultiTouchPointsL( const TPointerEvent& aEvent, const TInt aPointerNumber); + + /** Activates holding and notifies observer that holding has been started */ + void StartHoldingL(); + /* Set previous tag gesture to null (and recycle the gesture object) */ + static void RecyclePreviousTapGesture( TAny* aSelf ); + /** Emits a tap event since second tap of a double tap was not received within timeout */ + void EmitFirstTapEventL(); + /** Emit the start gesture event that aGesture would have produced */ + void EmitStartEventL( const CGesture& aGesture ); + /** + * Send code event if not holding. Also sets the event to released and emits again. + * Modifies aGesture! + */ + void CompleteAndEmitSingleTouchL( CGesture& aGesture ); + /** + * Send code event if pinch. Also sets the event to released and emits again. + * Modifies aGesture! + */ + void CompleteAndEmitDoubleTouchL( CGesture& aGesture ); + /** + * Send cancel event about the latest gesture client was notified about + * Sets the latest gesture to Cancelled. + */ + void EmitCancelEventL(); + /** Notify observer of the gesture */ + void EmitEventL( const CGesture& aGesture ); + /** + * (re)start holding timer at the current point. + * Does not restart holding if the point (in aEvent) is near enough to where holding + * was started earlier. (Allows small movement but still starting holding. + */ + void StartHoldingTimer( const TPointerEvent& aNewEvent ); + + /** + * @return a gesture object from the gesture pool + * Getting gestures from the gesture pool avoids the need to create gestures + * after construction. There is max only one gesture object in the pool, + * but no more is needed + */ + CGesture* NewGesture(); + /** Move the gesture into the gesture pool, and set aGesturePointer to null */ + void RecycleGesture( CGesture*& aGesturePointer ); + +private: + /// Gesture is the logical representation of a sequence of points arriving + /// at certain times + /// This is the current gesture + CGesture* iGesture; + + /// Tap gesture of the previous gesture. Used when double tap is enabled. + /// The gesture is cached, since it cannot be emitted until gesture helper + /// knows whether the next gesture forms a double tap + /// @see CGestureHelperImpl::iDoubleTapTimer + CGesture* iPreviousTapGesture; + + /// This is a recyclable object pool with just one object. + /// This class needs one or two gesture objects at any one time. There is one + /// less error condition to handle if gesture objects are not created after + /// construction. Therefore, if only one gesture object is needed at a specific, + /// point in time, the unused gesture object is stored here. + CGesture* iUnusedGesture; + + /// When double tap is enabled, a tap + /// event (and it's released event) is only emitted after the double tap timeout + /// passes. If user taps again before the timeout (in the same position), + /// this gesture is emitted as a double tap (followed by the released event, + /// and the second tap is not emitted at all. + /// If user taps, and then swipes before the double tap timeout, this tap + /// event (and it's released event) event is emitted, and only then the swipe's + /// down and drag events are emitted. In other words, if user presses down + /// during the timeout, the down event it not emitted until the gesture + /// helper knows that the gesture is not another tap. + /// Behavior while double tap enabled: + /// Swipe: Down + drag + up => emits down + swipe/cancel + released + /// Tap: Down + up => emits down ... timeout ... + tap + released + /// Double tap: Down + up + down + up => emits down ... double tap + released + /// Tap + quick swipe: Down + up + down + drag + ... => emits down ... tap + up (for tap) + down (for swipe ) + drag + ... + /// Double tap timer is cancelled when the second pointer down event is received, + /// i.e., it does not matter if user does this: + /// down + up + down ... long wait ... + up. It's still a double tap. + CCallbackTimer* iDoubleTapTimer; + + /// holding is activated when user keeps pointer down in the same place for + /// a longer period. the holding timer activates off when enough time has passed. + CCallbackTimer* iHoldingTimer; + + /// observer for gesture events + MGestureObserver* iObserver; + + /// captures subsequent pointer events after pointer down received, + /// until pointer up + CPointerCapturer* iPointerCapturer; + + /// Tells number of pointers pressed down. + TInt iPointerCount; + + /// Tells the pointer number of the current pointers pressed down. + /// Valid only when single pointer is touched down. + TInt iCurrentPointer; + + }; + +} // GestureHelper + +#endif // _GESTUREHELPERIMPL_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturerecogniser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturerecogniser.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2008 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: Gesture helper implementation +* +*/ + +#include "gesturerecogniser.h" + +#include + +#include "gesturedefs.h" +#include "gestureobserver.h" +#include "pointarray.h" +#include "utils.h" + +#include // pointerevents + +using namespace GestureHelper; + +/** + * Vector class (math) + */ +NONSHARABLE_CLASS( TVector ) + { +public: + /** + * Constructor + * @param aFrom starting point of the vector + * @param aTo ending point of the vector + */ + TVector( const TPoint& aFrom, const TPoint& aTo ) + : iX( aTo.iX - aFrom.iX ), + iY( aTo.iY - aFrom.iY ) + { + } + + /** @return angle of the vector */ + TReal Angle() const + { + TReal angle = 0; + TReal length = Length(); + if ( length != 0 ) + { + Math::ACos( angle, iX / Length() ); + if ( iY < 0 ) + { + angle = 2 * KPi - angle; + } + } + return Degrees( angle ); + } + + /** @return length of the vector */ + TReal Length() const + { + TReal length = 0; + Math::Sqrt( length, iX * iX + iY * iY ); + return length; + } + +private: + /** @return radians in degrees */ + inline TReal Degrees( TReal aRadians ) const + { + return aRadians * 180 / KPi; + } + +public: + /// x coordinate that represent the vector + TReal iX; + /// y coordinate that represent the vector + TReal iY; + }; + +inline TPoint LastPoint( const TPointArray& aPoints ) + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + return aPoints[ aPoints.Count() - 1 ] ; + } + +/** + * @return Length of the gesture in points + */ +inline TReal GestureLength( const TPointArray& aPoints ) + { + return TVector( aPoints[0], LastPoint( aPoints ) ).Length(); + } + +/** + * @return ETrue if aAngleUnderTest is almost aAngle + * Closeness of the angles is controlled by KAngleTolerance + */ +static TBool IsNear( TReal aAngleUnderTest, TReal aAngle ) + { + return aAngle - KAngleTolerance <= aAngleUnderTest && + aAngleUnderTest <= aAngle + KAngleTolerance; + } + +/** + * @return the angle as a direction flags of TGesture + */ +inline TGestureCode Direction( TReal aAngle ) + { + TGestureCode direction = EGestureUnknown; + + if ( IsNear( aAngle, 90.0 ) ) + { + direction = EGestureSwipeDown; + } + else if ( IsNear( aAngle, 180.0 ) ) + { + direction = EGestureSwipeLeft; + } + else if ( IsNear( aAngle, 270.0 ) ) + { + direction = EGestureSwipeUp; + } + else if ( 360.0 - KAngleTolerance <= aAngle || aAngle <= KAngleTolerance ) + { + direction = EGestureSwipeRight; + } + else // for lint warning + { + // unknown angle + } + + return direction; + } + +/** @return direction between points */ +inline TGestureCode Direction( const TPoint& aFromPoint, const TPoint& aToPoint ) + { + return Direction( TVector( aFromPoint, aToPoint ).Angle() ); + } + +// function type to get a point in the point array +typedef TPoint (TPointArray::*PointByIndexFunc)( TInt aIndex ) const; + +/// @return latest point outside tolerance area or KErrNotFound if not point outside it +TInt LatestCertainPointIndex( const TPointArray& aPoints, PointByIndexFunc aPointByIndex, TRect aToleranceRect ) + { + int i = aPoints.Count(); + // Find out the first point from the end of the array + // that is not contained in the tolerance rect. + while( 0 <= --i ) + { + // if the point does not belong inside tolerance rect, it is the first point + // outside the rect + if( !aToleranceRect.Contains( (aPoints.*aPointByIndex)(i) ) ) + { + break; + } + } + return i; + } + +/** @return last direction of dragging */ +inline TGestureCode LastDirection( const TPointArray& aPoints, MGestureEvent::TAxis aRelevantAxis ) + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + + TRect toleranceRect = ToleranceRect( (aPoints.TPointArray::operator[])(aPoints.Count() - 1), aRelevantAxis ); + + TInt latestPointIndex = LatestCertainPointIndex( aPoints, TPointArray::operator[],toleranceRect ); + if ( KErrNotFound != latestPointIndex ) + { + return Direction( aPoints[latestPointIndex], LastPoint( aPoints ) ); + } + // no points were outside the rect, and hence the direction is unknown + return EGestureUnknown; + } + +/** + * @return ETrue if points for a tap event + */ +inline TBool IsTap( const TPointArray& aPoints ) + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + + TRect toleranceRect = ToleranceRect( (aPoints.TPointArray::Raw)(0) ); + + return KErrNotFound == LatestCertainPointIndex( aPoints, TPointArray::Raw,toleranceRect ); + } + +// ---------------------------------------------------------------------------- +// Return gesture code of a gesture formed by a sequence of points +// ---------------------------------------------------------------------------- +// +TGestureCode TGestureRecogniser::GestureCode( const TPointArray& aPoints, MGestureEvent::TAxis aRelevantAxis ) const + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + + // tap needs to be treated separately, because recognising that needs to consider + // raw points (and not points in which x or y axis has been filtered out) + if ( IsTap( aPoints ) ) + { + return EGestureTap; + } + + return LastDirection( aPoints, aRelevantAxis ); + } + +// ---------------------------------------------------------------------------- +// Return gesture code of a gesture formed by a sequence of points +// ---------------------------------------------------------------------------- +// +TGestureCode TGestureRecogniser::MultiTouchGestureCode( const TPointArray& aPoints, const TPointArray& aSecondaryPoints, + TInt aPreviousDistance, TBool aIsFirstPinch ) const + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + __ASSERT_DEBUG( aSecondaryPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + __ASSERT_DEBUG( aPreviousDistance > 0, Panic( EGesturePanicIllegalLogic ) ); + + TInt currentDistance = TVector( LastPoint( aPoints ), LastPoint( aSecondaryPoints ) ).Length(); + + // currently gesture tolerance is used as reference to identify the pinch + // and it is same for first time recognition and also for pinch thereon + // This can be changed to an independent constant if required + // This is now implemeted. We have different tolerance for intial pinch and pinhc theron + + // We need to have different tolerance at the time of changing direction. + // When user is pinching in and then starts pinching out the tolerance should be different. + // This is implemented in CGesture class. aIsFirstPinch will take care of all this + TInt pinchTolerance = aIsFirstPinch ? KInitialPinchTolerance : KPinchTolerance; + if (Abs( currentDistance - aPreviousDistance ) >= pinchTolerance ) + { + return EGesturePinch; + } + return EGestureUnknown; + } + +// ---------------------------------------------------------------------------- +// Validate the drag formed by a sequence of points. If all the points are +// within the tolerance rect then the gesture is not recognised. +// ---------------------------------------------------------------------------- +// +TGestureCode TGestureRecogniser::ValidateDrag( const TPointArray& aPoints, MGestureEvent::TAxis aRelevantAxis ) const + { + __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) ); + + TRect toleranceRect = ToleranceRect( (aPoints.TPointArray::operator[])(aPoints.Count() - 1), aRelevantAxis ); + + TInt latestPointIndex = LatestCertainPointIndex( aPoints, TPointArray::operator[],toleranceRect ); + if ( KErrNotFound != latestPointIndex ) + { + return EGestureDrag; + } + // no points were outside the rect, and hence the direction is unknown + return EGestureUnknown; + } + +// ---------------------------------------------------------------------------- +// Return the length between the given two points +// ---------------------------------------------------------------------------- +// +TInt TGestureRecogniser::Length( const TPoint aPoint, const TPoint aSecondaryPoint ) const + { + return TVector(aPoint,aSecondaryPoint).Length(); + } + +// ---------------------------------------------------------------------------- +// Return pointer number fetched from the given event +// ---------------------------------------------------------------------------- +// +TInt TGestureRecogniser::PointerNumber( const TPointerEvent& aEvent ) + { + if( aEvent.IsAdvancedPointerEvent() ) + { + return aEvent.AdvancedPointerEvent()->PointerNumber(); + } + return 0; + } +// end of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/gesturerecogniser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/gesturerecogniser.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 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: Algorithm to recognise gesture from a stream of points +* +*/ + +#ifndef _GESTURERECOGNISER_H_ +#define _GESTURERECOGNISER_H_ + +#include +#include + +struct TPointerEvent; + +namespace GestureHelper +{ + +class TPointArray; + +/** + * Note: Not a static class or a function pointer, just to make it sligthly + * easier to replace it with a heavier implementation + */ +NONSHARABLE_CLASS( TGestureRecogniser ) + { +public: + /** + * Translates points into a gesture code + * @param aPoints Points that form the gestures. Client is not required + * to pass in repeated points (sequential points that are + * almost in the same place) + * @param aAxis Axis to filter the points + * @return recognised gesture id or EUnknownGesture + */ + TGestureCode GestureCode( const TPointArray& aPoints, MGestureEvent::TAxis aRelevantAxis ) const; + + /** + * Translates 2 sequences of points into a multitouch gesture code + * @param aPoints Points that represent the first touch point variations. Client is not required + * to pass in repeated points (sequential points that are + * almost in the same place) + * @param aSecondaryPoints Points that represent the second touch point variations. + * @param aPreviousDistance distance between the two points when the pinch was recognized the last time. + * @param aisFirstPinch, Is this the first pinch of teh current gesture. Required to decide which tolerance to use + * @return recognised gesture id or EUnknownGesture if its not a valid multi touch gesture + */ + TGestureCode MultiTouchGestureCode( const TPointArray& aPoints, const TPointArray& aSecondaryPoints, TInt aPreviousDistance, + TBool aIsFirstPinch ) const; + + /** + * Validate the points to decide its a drag or not + * @param aPoints Points that form the gestures. Client is not required + * to pass in repeated points (sequential points that are + * almost in the same place) + * @param aAxis Axis to filter the points + * @return EGestureDrag if valid else returns EUnknownGesture + */ + TGestureCode ValidateDrag( const TPointArray& aPoints, MGestureEvent::TAxis aRelevantAxis ) const; + + /** + * Validate the points to decide its a drag or not + * @param aPoints Points that form the gestures. Client is not required + * to pass in repeated points (sequential points that are + * almost in the same place) + * @param aAxis Axis to filter the points + * @return EGestureDrag if valid else returns EUnknownGesture + */ + TInt Length( const TPoint aPoint, const TPoint aSecondaryPoint ) const; + + /** + * Return the pointer number from the given event + * + * @param aEvent, event for which the pointer number needs to be fetched + * + * This function is added here only for simulating multiple pointer events + * for testing UT, For simulation purpose we will have a custom implemetation + * which will override this method and return our own pointer numbers + * So that we can simulate multiple pointer event. + * @return TInt pointer number + */ + TInt PointerNumber( const TPointerEvent& aEvent); + + }; + +} // namespace GestureHelper + +#endif // _GESTURERECOGNISER_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/hittest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/hittest.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2008-2008 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: Gesture helper helper functions +* +*/ + + +#include "gestureobserver.h" + +// system includes +#include +#include + +using namespace GestureHelper; + +namespace + { + /** @return the leaf-most visual that is under aPos */ + const CAlfVisual* VisualByCoordinates( const CAlfVisual& aRoot, const TPoint& aPos ) + { + // If it has children, chose any of them is hit first + const CAlfLayout* layout = dynamic_cast< const CAlfLayout* >( &aRoot ); + if ( layout) + { + TInt i = layout->Count(); + while( --i >= 0 ) + { + if( VisualByCoordinates( layout->Visual( i ), aPos ) ) + { + return &layout->Visual( i ); + } + } + } + + // children were not hit. is this visual hit? + if( TRect( aRoot.DisplayRect() ).Contains( aPos ) ) + { + return &aRoot; + } + + // visual was not found + return NULL; + } + + TBool IsRootVisual( const CAlfVisual& aVisual ) + { + return !aVisual.Layout(); + } + } // unnamed namespace + +// ---------------------------------------------------------------------------- +// VisualByCoordinates +// ---------------------------------------------------------------------------- +// +EXPORT_C CAlfVisual* HitTest::VisualByCoordinates( const CAlfControl& aControl, + const TPoint& aPos ) + { + TInt i = aControl.VisualCount(); + while( --i >= 0 ) + { + // Ask only root visuals, since all children are within the root visuals + if ( IsRootVisual( aControl.Visual( i ) ) ) + { + const CAlfVisual* hitVisual = ::VisualByCoordinates( + aControl.Visual( i ), aPos ); + if ( hitVisual ) + { + return const_cast< CAlfVisual* >( hitVisual ); + } + } + } + return NULL; + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/pointarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/pointarray.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008 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: Array of points +* +*/ + +#include "pointarray.h" + +using namespace GestureHelper; + +// ---------------------------------------------------------------------------- +// TPointArray constructor +// ---------------------------------------------------------------------------- +// +TPointArray::TPointArray( const RArray< TPointEntry >& aPoints ) + : iPoints( aPoints ) + {} + +// ---------------------------------------------------------------------------- +// TPointArray length +// ---------------------------------------------------------------------------- +// +TInt TPointArray::Count() const + { + return iPoints.Count(); + } + +// ---------------------------------------------------------------------------- +// point at index, no filtering +// ---------------------------------------------------------------------------- +// +TPoint TPointArray::operator[]( TInt aIndex ) const + { + return iPoints[aIndex].iPos; + } + +// ---------------------------------------------------------------------------- +// Unfiltered point at index +// ---------------------------------------------------------------------------- +// +TPoint TPointArray::Raw( TInt aIndex ) const + { + return iPoints[aIndex].iPos; + } + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/pointarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/pointarray.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008 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: Array of points +* +*/ + +#ifndef _POINTARRAY_H_ +#define _POINTARRAY_H_ + +#include + +namespace GestureHelper +{ + +/** + * Represents a single point given at certain time + */ +struct TPointEntry + { + /** constructor */ + inline TPointEntry( const TPoint& aPos, const TTime& aTime ) + : iPos( aPos ), iTime( aTime ) + { + } + + TPoint iPos; + TTime iTime; + }; + +/** + * Array of points that wraps another point array + * The purpose of this class is to allow deriving classes to override [] + * and in that member function adjust the point, e.g., by setting one + * axis to always a constant value. This allows providing a sequence of + * points to the recogniser in which the other axis is ignored. + */ +NONSHARABLE_CLASS( TPointArray ) + { +public: + /** + * @param aPoints points array to wrap (and filter) + */ + TPointArray( const RArray< TPointEntry >& aPoints ); + /** @returns length of the array */ + TInt Count() const; + /** + * @returns a filtered point at aIndex. Default implementation same + * as Raw(...) + * virtual so deriving classes can modify the point (e.g., filter one axis) + */ + virtual TPoint operator[]( TInt aIndex ) const; + /** @returns an raw, non-filtered point at aIndex */ + TPoint Raw( TInt aIndex ) const; + +private: + const RArray< TPointEntry >& iPoints; + }; + +} // namespace GestureHelper + +#endif // _POINTARRAY_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/pointercapturer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/pointercapturer.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2008 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: Alf control group and control for capturing pointer events +* +*/ + +#include "pointercapturer.h" + +#include +#include +#include +#include +#include +#include + +#include "gesturehelperimpl.h" + +namespace GestureHelper +{ + +/** + * CPointerCaptureControl + * Gesture control own a gesture helper, and captures any pointer events that + * no other control captures. After it captures pointer down event, it will + * capture all pointer events until pointer up. It does this by bringing its + * control group to the top upon pointer down, and lowering the control group + * to the botton upon pointer up. + */ +NONSHARABLE_CLASS( CPointerCaptureControl ) : public CAlfControl + { +public: + /** Two-phased constructor */ + static CPointerCaptureControl* NewLC( CGestureHelperImpl& aHelper, + CAlfEnv& aEnv, CAlfDisplay& aDisplay ) + { + CPointerCaptureControl* self = new ( ELeave ) CPointerCaptureControl( aHelper ); + CleanupStack::PushL( self ); + self->ConstructL( aEnv ); // construct base class + self->BindDisplay( aDisplay ); + self->AppendVisualL( EAlfVisualTypeVisual ); + return self; + } + + void StartCaptureL() + { + User::LeaveIfError( Display()->Roster().SetPointerEventObservers( + EAlfPointerEventReportDrag | EAlfPointerEventReportUnhandled, + *this ) ); + Display()->Roster().ShowL( *ControlGroup(), KAlfRosterShowAtTop ); + } + + void StopCapture() + { + ( void ) Display()->Roster().SetPointerEventObservers( 0, *this ); + TRAP_IGNORE( Display()->Roster().ShowL( *ControlGroup(), KAlfRosterShowAtBottom ) ); + } + +private: + /** Constructor */ + CPointerCaptureControl( CGestureHelperImpl& aHelper ) + : iHelper( aHelper ) + { + } + + // From CAlfControl + TBool OfferEventL( const TAlfEvent& aEvent ) + { + TBool consumed = EFalse; + if ( aEvent.IsPointerEvent() ) + { + // pointer down for first pointer should never come here if everything is + // working properly. if pointer event comes here, stop capturing and allow the + // event to fall to the controls below + if ( iHelper.StrayEvent(aEvent.PointerEvent() )) + { + StopCapture(); + } + else + { + consumed = iHelper.HandlePointerEventL( aEvent.PointerEvent() ); + } + } + return consumed; + } + +private: + /// gesture helper that analyses pointer sequences. own. + CGestureHelperImpl& iHelper; + + }; + +} // namespace GestureHelper + +using namespace GestureHelper; + +// ---------------------------------------------------------------------------- +// Two phase constructor +// ---------------------------------------------------------------------------- +// +CPointerCapturer* CPointerCapturer::NewL() + { + return new ( ELeave ) CPointerCapturer(); + } + +// ---------------------------------------------------------------------------- +// Two phase constructor +// ---------------------------------------------------------------------------- +// +CPointerCapturer::~CPointerCapturer() + { + if ( iCaptureControl ) + { + // deleting the control group will also delete the control + iCaptureControl->Env().DeleteControlGroup( iControlGroupId ); + } + } + +// ---------------------------------------------------------------------------- +// InitForAlfredL +// ---------------------------------------------------------------------------- +// +void CPointerCapturer::InitForAlfredL( CGestureHelperImpl& aHelper, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aControlGroupId ) + { + CAlfControlGroup& group = aEnv.NewControlGroupL( aControlGroupId ); + CPointerCaptureControl* control = CPointerCaptureControl::NewLC( aHelper, + aEnv, aDisplay ); + group.AppendL( control ); + CleanupStack::Pop( control ); + + // store control only after it has been successfully added to group + iCaptureControl = control; + iControlGroupId = aControlGroupId; + } + +// ---------------------------------------------------------------------------- +// StartCaptureL +// ---------------------------------------------------------------------------- +// +void CPointerCapturer::StartL() + { + if ( iCaptureControl ) + { + iCaptureControl->StartCaptureL(); + } + } + +// ---------------------------------------------------------------------------- +// StopCapture +// ---------------------------------------------------------------------------- +// +void CPointerCapturer::Stop() + { + if ( iCaptureControl ) + { + iCaptureControl->StopCapture(); + } + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/pointercapturer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/pointercapturer.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008 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: Responsible for capturing pointer events +* +*/ + +#ifndef _POINTERCAPTURER_H_ +#define _POINTERCAPTURER_H_ + +// INCLUDES +#include +#include + +class CAlfControl; +class CAlfControlGroup; +class CAlfEnv; +class CAlfDisplay; + +// CLASS DECLARATION + +namespace GestureHelper +{ + +class CGestureHelperImpl; +class CPointerCaptureControl; + +/** + * CPointerCaptureControl + * Gesture control own a gesture helper, and captures any pointer events that + * no other control captures. After it captures pointer down event, it will + * capture all pointer events until pointer up. It does this by bringing its + * control group to the top upon pointer down, and lowering the control group + * to the botton upon pointer up. + */ +NONSHARABLE_CLASS( CPointerCapturer ) : public CBase + { +public: + /** Two-phased constructor */ + static CPointerCapturer* NewL(); + /** Destructor */ + ~CPointerCapturer(); + + void InitForAlfredL( CGestureHelperImpl& aHelper, CAlfEnv& aEnv, + CAlfDisplay& aDisplay, TInt aControlGroupId ); + + void StartL(); + void Stop(); + +private: + /// + CPointerCaptureControl* iCaptureControl; + TInt iControlGroupId; + }; + +} // namespace GestureHelper + +#endif // _POINTERCAPTURER_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/utils.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008 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: Gesture recognition utilities +* +*/ + +#include "utils.h" + +#include // for CCoeEnv +#include // for CEikAppUi + +#include "gesturedefs.h" + +namespace GestureHelper + { + /** @return the longer edge of the size */ + inline TInt LongerEdge( const TSize& aSize ) + { + return Max( aSize.iHeight, aSize.iWidth ); + } + + // for documentation, see header file + TRect ToleranceRect( const TPoint& aCenterPoint ) + { + TSize screenSize = static_cast( CCoeEnv::Static()->AppUi() ) + ->ApplicationRect().Size(); + // multiplication has to be done first, to avoid rounding integer to 0 with division + int toleranceLength = ( KGestureTolerancePercent * LongerEdge( screenSize ) ) / 100; + TRect toleranceRect( aCenterPoint, TSize() ); + // grow by the tolerance length, while keeping the center point + toleranceRect.Shrink( -toleranceLength, -toleranceLength ); + return toleranceRect; + } + + // for documentation, see header file + TRect ToleranceRect( const TPoint& aCenterPoint, MGestureEvent::TAxis aRelevantAxis ) + { + TRect toleranceRect = ToleranceRect(aCenterPoint); + + TSize screenSize = static_cast( CCoeEnv::Static()->AppUi() ) + ->ApplicationRect().Size(); + + if(aRelevantAxis == MGestureEvent::EAxisHorizontal) + { + toleranceRect.iTl.iY = 0; + toleranceRect.iBr.iY = screenSize.iHeight; + } + else if(aRelevantAxis == MGestureEvent::EAxisVertical) + { + toleranceRect.iTl.iX = 0; + toleranceRect.iBr.iX = screenSize.iWidth; + } + else // EAxisBoth + { + // nothing to be done + } + + return toleranceRect; + } + + } // namespace GestureHelper diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/gesturehelper/src/utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/gesturehelper/src/utils.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2008 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: Gesture recognition utilities +* +*/ + +#ifndef _GESTURE_UTILS_H_ +#define _GESTURE_UTILS_H_ + +#include +#include + +namespace GestureHelper + { + + /** + * @return the a rectange in which dragging will be ignored. Tolerance rect + * represents a rectange within which any movement will not be considered + * intentional, but as accidental stylus movement. + */ + TRect ToleranceRect( const TPoint& aCenterPoint ); + + /** + * @return the a rectange in which dragging will be ignored. Tolerance rect + * represents a rectange within which any movement will not be considered + * as drag, This depends on the Axis. + * For Example, any movement within a vertical strip at the point of touch down is + * if the interested Axis is Horizontal axis. + */ + TRect ToleranceRect( const TPoint& aCenterPoint, MGestureEvent::TAxis aRelevantAxis ); + + } // namespace GestureHelper + +#endif // _GESTURE_UTILS_H_ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,60 @@ +/* +* 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: Build information file for project ?myapp +* +*/ + +#include + + + +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + + +//Include the logging +#include "../mullogging/group/bld.inf" + +// Include the Data Model +#include "../muldatamodel/group/bld.inf" + +// Include the Common Utilities +#include "../common/group/bld.inf" + +// Include the Gesture Helper +#include "../gesturehelper/group/bld.inf" + + +// Include the CoverFlow Widget +#include "../mulcoverflowwidget/group/bld.inf" + +// Include the Slider widget +#include "../mulsliderwidget/group/bld.inf" + +#include "../alfviewwidget/group/bld.inf" +#include "../alfcontainerwidget/group/bld.inf" +#include "../alfscrollbarwidget/group/bld.inf" + + + +//End of files diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007-2008 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: Build information file for CoverFlow widget component +* +*/ + +#include +// Include the Test App +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../rom/mulcoverflowwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mulcoverflowwidget.iby) +//../internal/test/testcoverflowwidget/rom/testcoverflowwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(testcoverflowwidget.iby) +PRJ_MMPFILES + +mulcoverflowwidget.mmp + +PRJ_TESTMMPFILES + + +PRJ_TESTEXPORTS + + +//End of files diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/group/mulcoverflowwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/group/mulcoverflowwidget.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ +#include + +TARGET mulcoverflowwidget.dll +TARGETTYPE PLUGIN + +UID 0x10009d8d 0x2000D240 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE mulcoverflowwidgetfactoryplugin.cpp +SOURCE mulcoverflowwidget.cpp +SOURCE mulcoverflowcontrol.cpp +SOURCE mulbaseelement.cpp +SOURCE mulcoverflowtemplate.cpp +SOURCE mulcoverflowao.cpp +SOURCE mulcovertemplate4.cpp +SOURCE mulcovertemplate1.cpp + +USERINCLUDE ../../../inc/mul +USERINCLUDE ../../../inc +USERINCLUDE ../../common/inc +USERINCLUDE ../inc +USERINCLUDE ../../mullogging/inc + + +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +// System Libraries +LIBRARY aknskins.lib +LIBRARY charconv.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY libc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY touchfeedback.lib //for tactile feedback +LIBRARY egul.lib +LIBRARY gdi.lib +LIBRARY eikcore.lib + +// Alf Libraries +LIBRARY alfclient.lib +LIBRARY alfwidgetmodel.lib +LIBRARY alfwidgetutils.lib + +// Osn Libraries +LIBRARY osncore.lib + + +// STL Libraries +LIBRARY libstdcpp.lib +LIBRARY libpthread.lib +LIBRARY aknlayout2hierarchy.lib +LIBRARY aknlayout2scalable.lib +LIBRARY cdlengine.lib +LIBRARY mulmodelutility.lib +LIBRARY mullogging.lib //for logging +LIBRARY alfresourcepool.lib //for resource pool + + +// Gesture Helper Library +LIBRARY gesturehelper.lib + +LANG SC +START RESOURCE 2000D240.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET mulcoverflowwidget.rsc +#endif +END + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/imullogicaltemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/imullogicaltemplate.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-2008 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: List Template Interface + * +*/ + +#ifndef I_MULLOGICALTEMPLATE_H +#define I_MULLOGICALTEMPLATE_H + +#include "mulvisualutility.h" +#include "mulitemdefinitions.h" + +namespace Alf + { + + +class IMulLogicalTemplate + { + +public: + virtual ~IMulLogicalTemplate() {} + //fills up the data structure pertaining to specific templates + virtual void PopulateData() = 0; + //Return the structure of the specified element Id + virtual const LCTElementStructure* GetElementStructure( + TMulCurrentOrientation aCurOrient, + const char* aElemId) = 0; + + }; + + } + + +#endif //I_MULLOGICALTEMPLATE_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulbaseelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulbaseelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,694 @@ +/* +* Copyright (c) 2007-2008 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: base element header for CoverFlow +* +*/ + +// This file defines the API for MulCoverFlowWidget.dll + +#ifndef __MULBASEELEMENT_H__ +#define __MULBASEELEMENT_H__ + + +// Include Files +#include +#include "alf/alfelement.h" +#include +#include +#include + +#include "mulcoverflowdefinitions.h" + +namespace Alf + { + +//Forward declarations +class MulCoverFlowTemplate; +struct TMulBaseElementImpl; + +// Structure to store the position and sizes of cover flow items +struct TMulCoverFlowItem + { + int height; + int width; + int posx; + int posy; + + TMulCoverFlowItem() + :height(0),width(0),posx(0),posy(0){} + + TMulCoverFlowItem(int aPosx,int aPosy,int aWidth,int aHight) + :posx(aPosx),posy(aPosy),width(aWidth),height(aHight){} + + }; + +namespace mulbaseelement + { + static const IfId Ident= + { + 0,"mulbaseelement" + }; + } + + +/* Element class which handles all the visuals in the layout + * The class also handles event handling and applies animation as required + * by the widget.The class forms the basis of the entire layout heriarchy in the widget + * */ +/// @bug minor:avanhata:7/7/2008 This class is coverflow-specific, so name it as such +class MulBaseElement : public AlfElement, + public IAlfWidgetEventHandler + { +public://Constructor and destructor + + /** + * C++ constructor. + */ + MulBaseElement( CAlfWidgetControl& aControl, const char* aName ); + + /** + * Destructor. + */ + virtual ~MulBaseElement(); + + +public: //From IAlfWidgetEventHandler + + static inline const IfId& Type() + { + return mulbaseelement::Ident; + } + + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + void setActiveStates( unsigned int aStates ); + + AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + AlfWidgetEventHandlerInitData* eventHandlerData(); + + AlfEventHandlerType eventHandlerType() ; + + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + +public: //New Methods + + /** + * Sets the Item Brush Color. + * @param aColor color to be set. + */ + void SetItemBrush(const TRgb& aColor); + + /** + * changes the opacity of counter accordingly. + * @param aUiOn true if UIOn or else false. + * @param aTransitionTime transition time. + */ + void UIOnOffMode(bool aUiOn, int aTransitionTime); + + /** + * Sets the Scroll direction during the step scroll. + * @param TItemScroll sets the direction if it is right or left. + */ + void SetTextColor(TTextVisualType aVisualType, const TRgb& aColor); + + /** + * returns the color of the specified text + * @param aVisualType is the visual type. + */ + TMulVisualColorProperty TextColor(TTextVisualType aVisualType); + + + /** + * Sets the Scroll direction during the step scroll. + * @param TItemScroll sets the direction if it is right or left. + */ + void SetScrollDir( TItemScroll aScrollDir ); + + /** + * Update the text opacity and counter values whenever highlight is modified + * + * @param aAnimationTime, text will be updated after the aAnimationTime. + */ + void UpdateTextAndCounter(int animationTime = 0); + + /** + * Stores the dimensions of the highlighted and nonhighlighted item from the template. + * + * @param aHighlightItemDimensions The highlight item dimensions . + * @param aNonHighlightItemDimensions The non highlight item dimensions. + * @param aVisibleIconCount The count of visible items on screen. + */ + void StoreVisualDimensions( TMulCoverFlowItem aHighlightItemDimensions, TMulCoverFlowItem aNonHighlightItemDimensions,int aVisibleIconCount ); + + /** + * Stores whether the text is visible or not in the current orientation and template. + * + * @parama aIsTextVisible Boolean value indicating whether text is there or not. + */ + void StoreTextVisibility( bool aIsTextVisible ); + + /** + * Return is the textvisible or not + * + */ + bool IsTextVisibile( ) const ; + + /** + * + * + */ + void ApplyBrushOnIcon( CAlfImageVisual& aImageVisual ); + + /** + * + * + */ + void RemoveBrushOnIcon( CAlfImageVisual& aImageVisual ); + + /** + * To hide and unhide Widget. + * + * @param aShow value to hide/unhide the Widget + * @param aTransitionTime Transition Time in MilliSeconds + */ + void ShowWidget( bool aShow, int aTransitionTime = 0) ; + + /* + * Takes the new positions of the visuals and applies the same to the visuals + * On change of orientation + */ + void OrientationChange(); + + /** + * Sets the empty text to be displayed when the number of items is 0. + * + * @param aDefaultText The text to be displayed. + */ + void SetEmptyText( const UString& aDefaultText ); + + /** + * Shows/Hide the empty text when the number of items in the model or layout is 0 . Also when the model is NULL. + * + * @param aShow Boolean value to show/hide the empty text. + */ + void ShowEmptyText( bool aShow ); + + /** + * Returns true if empty text is set by the application else returns false. + * + * @returns true if empty text is set else returns false. + */ + bool IsEmptyText(); + + /** + * Updates the Slider Widget ticks when item is added or removed + * + * @param aUpdateTick takes the count of items in the coverflow widget + */ + void UpdateSliderTick(int aUpdateTick); + + /** + * Returns the icon/text flow layout in vertical flow layout + * + * @param aLayoutIndex the index will determine which layout to return from the main/vertical flow layout + */ + CAlfLayout& FlowLayout( int aLayoutIndex ); + + /** + * + * Sets the text to be displayed for the counter element . + * + * @param aTransitionTime the transition time in milliseconds for animation + */ + void SetCounterText( int aTransitionTime = 0 ); + + /** + * Creates a visual for counter if not created initailly else return the existing counter visual. + */ + CAlfTextVisual& CounterVisual(); + + /** + * Move the Iconflow by a items width in case of bounce effect. + * + * @param aBounceDirection Tells the direction by which the iconflowlayout should move. + */ + void StartBounce(int aBounceDirection); + + /** + * Returns whether its in Ui on mode or not. + * + * @return true if its currently in Ui on mode. + */ + bool IsUiOnMode(); + + /** + * Creates the text visuals if it is not created, else returns the existing + * visual for the title and detail text. + * + * @param aTextString, visual tag + * @param aLayout, Layout in which to create the text visual + */ + CAlfTextVisual& CreateTextVisual(const TDesC8& aName, CAlfLayout& aLayout); + + /** + * Updates the value of the text visuals when an image has scrolled . + * + * @param aAnimationTime, text will be updated after the aAnimationTime. + */ + void UpdateTextValue( int aAnimationTime = 0); + + /** + * returns the layout to text. + */ + CAlfLayout& TextLayout(); + + /** + * Start marquee for the text. + * + * @param aName, text type is title or detail + */ + void StartMarquee(mulvisualitem::TVisualAttribute aName ); + + /** + * Stop marquee for the text. + * + * * @param aName, text type is title or detail + */ + void StopMarquee(mulvisualitem::TVisualAttribute aName); + + /** + * Decide whether to show or hide the slider based on the parameter. + * + * @param aFlag, boolean to decide slider to be shown or not. + */ + void ShowSlider(bool aFlag); + + /** + * Return size of hightlight icon for the template specified . + * + * @param aTemplateId, id of the template whose icon size to be calculated. + * @param aAttribute, attribute whose size is to be calculated. + * @param aHeight, refrence in which the height parameter is returned. + * @param aWidth, refrence in which the width parameter is returned. + */ + void GetIconSize( mulwidget::TLogicalTemplate aTemplateId, + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth); + + /** + * Sets the Scroll Animation Time defined by the application. + * + * @param aScrollAnimationTime, ScrollAnimation Time set by the application. + */ + + void SetScrollAnimationTime( int aScrollAnimationTime ); + + /** + * Set background for coverflow + * + * @param aColor, background color. + */ + void SetBackground(const TRgb& aColor); + + /** + * Set background for coverflow. + * + * @param aIID, Skin id that shoudl be used as background. + */ + void SetBackground(const TAknsItemID& aIID); + + /** + * Stores the fit mode flag (on or off). + * + * @param aFlag fitmode flag + */ + void SetFitMode(bool aFlag); + + /** + * Apply scale mode on image visual and also appy brush for remaining area. + * + * @param aImageVisual Image visual + */ + void ApplyScaleMode( CAlfImageVisual& aImageVisual); + + /** + * + * + */ + void CreateAndInitializeVisuals(bool aIsOrientationChange = false); + + /** + * + * + */ + void SetHighlight(int aHighlightIndex, int aAnimationTime = 0); + + /** + * + * + */ + void MoveVisuals(int aDistance,int aAnimationTime = 0); + + /** + * + * + */ + CAlfVisual* CreateIconStructure(CAlfLayout* aParentLayout); + + /** + * + * + */ + void MoveVisualsWithSizeChange(int aDistance, int aAnimationTime=0); + + /** + * + * + */ + void StartDoodling(int aDistance, int aAnimationTime=0); + + /** + * + * + */ + void StopDoodling(int aAnimationTime=0); + + /** + * Recycle the Icon visuals instead of destroying and creating them each time. + */ + void RecycleIconVisuals(); + + /** + * + * + */ + void UpdateVisuals(); + + /** + * Sets the specified size to the base layout and deck layout and also on the empty text visual + */ + void SetDefaultSize( TSize aSize ); + + /** + * Displays the indicator icon for the specified item index. + * + * @param aVisualItem visual item which conatins the index. + * @param aIndex index of the item. + */ + void DisplayIndicatorIcon(const MulVisualItem & aVisualItem, int aIndex); + + /** + * Returns whether the user has doodled enough to change the highlight multiple times. + * + * @returns TNumberofSwipes, Doodling distance converted into multiple swipes. + */ + TNumberofSwipes NumberOfSwipes(); + + /** + * Returns the final swipe direction based on which highlight is nerest to teh centre point + * in the last direction + * + * @param aDistance, doodled distance + * @param, aastSwipeDirection, last direction in which the user has swiped. + */ + int FinalSwipeDirection(int aDistance, int aLastSwipeDirection); + + /** + * Returns teh current direction in which itesm are scrolled + * + * @return, Scroll direction + */ + TItemScroll ScrollDir(); + + /** + * Removes the slider layout form the coverflow main layout + * + */ + void RemoveSliderFromLayout(); + + /** + * Rotate the image in teh given direction + * + * @param aDirection, Direction of the rotation (ERotateLeft/ERotateRight). + * @param aImageSize, The actual size of the current highlighted image. + * @param aTransition transition time to rotate the image. + * @param aAdjustSize, true for orientation change + * + */ + void RotateImage(IMulWidget::TMulRotation aDirection,TSize aImageSize,int aAnimationTime,bool aAdjustSize = false); + + /** + * If the image on which rotation is applied, is updated then remove the rotation + * + * @param aIndex, relative index which is updated + */ + void CancelRotationOnUpdate(int aIndex); + +private: + + /** + * Set the virtual Size of viewportlayout(parent) of text + * + * @param aName, text type is title or detail + */ + void SetVirtualViewPortSize(mulvisualitem::TVisualAttribute aName); + + /** + * Cancell all the custom commands related to marquee. + */ + void CancelAllCommands(); + + /** + * Reset counter opacity( depending on the current ui on/off mode + * when an item is added to an empty model. + * + * @param aTransitioTime transition time defined by app. + */ + void ResetUiOnOff( int aTransitionTime = 0 ); + + /** + * Calculate the new position for counter visual based on the value of the higlight index and total model count + * + * @param aCounterLctDimension Lct Dimensions of counter visual. + * @param aOrientationChanged Orientation Changed or not + */ + void SetNewCounterPosition(const TMulCoverFlowItem& aCounterLctDimension,bool aOrientationChanged = false ); + + /** + * Returns number of digits in a number. + * + * @param aNumber The number whose number of digits have to be found. + * @returns Number of digits in a number. + */ + int NumberOfDigits(int aNumber); + + /** + * Returns the current 2D coverflow template. + */ + MulCoverFlowTemplate* Template2D(); + + //slider related apis + /** + * Created the slider widget and calls the other function related to slider. + */ + void CreateSlider(); + + /** + * Constructs the slider widget if its not already constructed . + */ + void ConstructSliderWidget(); + + /** + * Checks whether slider needs to be shown or hidden and sets its opacity accordingly. + * + */ + void SetSliderOpacity(); + + /** + * Creates the base layout structure required for the base element to contain + * images and slider and meta data information . + */ + void CreateBaseLayoutStructure(); + + /** + * Sets the text data of the current highlight to the text visual . + * + * @param aName The name of the visual in the text visual e.g mul_tiltle or mul_detail. + * @param aData The variant type containing the new data to be set to the text visual . + */ + void SetTextToVisual( mulvisualitem::TVisualAttribute aName,IMulVariantType* aData ); + + /** + * Create empty text visualisation to show empty text when there are no items to display . + */ + void CreateEmptyTextVisualisation(); + + /** + * Decides the size to be applied on the main layout depending on whether the model is null or not. + */ + void HandleSizeChangeOnMain(); + + /** + * Shows/Hides the text and counter visuals when empty text has to be hidden/shown. + * + * @param aShow true when text/counter have to be shown , + * false when text/counter have to be hidden. + */ + void ShowHideVisualsForEmptyText( bool aShow ); + + /** + * Calculates the padding between the images based on the position + * and sizes of the highlighted and non higlighted items. + */ + void CalculatePadding(); + + /** + * + * Sets opacity to the counter text visual . + * + * @param aOpacity, opacity value that should be set + */ + void SetCounterTextOpacity( int aOpacity); + + /** + * Arranging the Visual with padding and using Transition time + * + */ + void ArrangeItems(); + + /** + * Sets the opacity of all the text visuals in the specifed visual to the given opacity (aOpacity) + * + * @param aOpacity The opacity to be set for the text visuals . + * @param aTransitionTime The transition time + */ + void SetTextVisualOpacity( int aOpacity , int aTransitionTime = 0 ); + + /** + * Returns the percentage factor with which new Position and Sizes are calculated . + * + * @returns The change in percentage to be applied on the current size and position. + */ + int CalculateDistanceChangeFactor(); + + /** + * + * + */ + void CreateVisuals(); + + /** + * Creates a Indicator Image visual if not created initially. + * + * @param aLayout decklayout to which icon is to be added . + */ + CAlfImageVisual* CreateIndicatorIconVisual(CAlfDeckLayout& aLayout); + + /** + * + * + */ + void SetIndicatorDimensions(CAlfImageVisual& aIndicatorVisual); + + /** + * + * + */ + const TDesC8& IdToTag( int aId ); + + /** + * Creates an array of midpoints of all the visuals form left to right + * + * @return, array of midpoints + */ + std::vector ReferenceMidPoints(); + + /** + * Calculates the new midpoints after the doodling + * + * @param aReferenceMidPoints,midpoints before doodling + * @param aDistance, final doodled distance + * @return array of new midpoints + */ + std::vector FinalMidPoints(std::vector aReferenceMidPoints,int aDistance); + + /** + * Returns the position of the visual in the array which is nearest to midpoint + * in swipe direction + * + * @param aFinalMidPoints, new midpoints after the doodling + * @param aLastSwipeDirection, Last swipe direction + */ + int NearestPoint(std::vector aFinalMidPoints,int aLastSwipeDirection); + + /** + * The image visual size and position is modified to stretch/compress the image + * after rotation. This is done because the before rotation teh texture will be + * generated according to the current orientation. To show the rotated texture + * image visual is modified such that the texture looks rotated preserving + * the aspect ration + * + * @param aVisual,Visual for which the rotation is applied + * @param aAnimationTime, time for rotation + */ + void AdjustVisualSizeInRotation(CAlfImageVisual* aVisual,int aAnimationTime); + + /** + * Handle rotation of 90degree or 270 degree. here the image visuals size + * needs to be altered if required as the current width will become teh height of + * the texture after rotation. + * + * @param aVisual,Visual for which the rotation is applied + * @param aAnimationTime, time for rotation + */ + void HandleRotationOnVerticalAxis(CAlfImageVisual* aVisual,int aAnimationTime); + + /** + * Handle rotation of 180degree or 0 degree. Here no need to modify the image visuals + * size. + * + * @param aVisual,Visual for which the rotation is applied + * @param aAnimationTime, time for rotation + */ + void HandleRotationOnHorizontalAxis(CAlfImageVisual* aVisual,int aAnimationTime); + + /** + * Cancel the rotation applied for teh visual at the given relative index. + * Relative index -1 indicates cancel the rotation on highlighted visual + * + * @param aIndex, relative index of teh visual for which the rotation needs to be canceled + */ + void CancelRotation(int aIndex = -1); + + /** + * Preserve the rotation after orientation change. + * + */ + void UpdateRotation(); + +private: //Class Data + + auto_ptr mData; //owned + + }; + + } // namespace Alf + +#endif // __MULBASEELEMENT_H__ + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowao.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007-2008 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: Active Object header for CoverFlow +* +*/ + +#ifndef __MULCOVERFLOWAO_H__ +#define __MULCOVERFLOWAO_H__ + +#include // For CTimer + +namespace Alf + { +//Forward declarations +class MulCoverFlowControl; + +class MulCoverFlowAo:public CTimer + { + +public : // Constructor and Destructor + /// @bug critical:avanhata:7/7/2008 this is a symbian-dependent class, + /// need to have two-phase construction + /// - otherwise mixing leaves and throws + MulCoverFlowAo( MulCoverFlowControl& aControl ); + + ~MulCoverFlowAo(); + +public: //new method + + /** + * Keeps moving layout asynchronously until it stopmoving() is called . + * The layout will move on to show more items . + * + * @param aSpeedPoint Gesture speed point. + * @param, aCurrGestureDirection, Current direction of gesture + * @param, aFastScrollForKey , if fast scroll due to key event + * @param, aAnimationTime , animation time for fast scroll in key event. + */ + void StartMoving(TReal32 aSpeedPoint, int aCurrGestureDirection,bool aFastScrollForKey = false,int aAnimationTime = 0); + + /** + * Stop moving the layout. + * + */ + void StopMoving(); + + /** + * Transition time for highlight change in fast scroll + * + * @return, transition time to be used + */ + int FastScrollTransitionTime(); + +private: + + /** + * Timer call back funtion . Performs animations and moves the layout + * for a particular distance depending on the length of the swipe + * in a particular time period depending on the speed . + */ + void RunL(); + +private : //new methods + + /** + * Cancel all pending requests. + */ + void StopTimer(); + + /** + * Increment the highlight with +-1 depending on the swipe direction and informs the + * control class to cahnge teh highlight. + */ + void ChangeHighLight(); + +private: //data + + MulCoverFlowControl& mControl; //doesnt own + int mTransitionTime; + int mWaitingTime; + int mCurrGestureDirection; + bool mStarted; + }; //end of class. + + } // End of namespace . + +#endif //__MULCOVERFLOWAO_H__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowcontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,539 @@ +/* +* Copyright (c) 2007 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: The Control header for CoverFlow Widgets. + * +*/ + +#ifndef MULCOVERFLOWCONTROL_H +#define MULCOVERFLOWCONTROL_H + +// Alf Headers +#include + +// Osn Headers +#include + +// Gesture Helper +#include + +// Mul Headers +#include +#include +#include "imulmodelobserver.h" + +//Gesture Helper namespace +namespace GestureHelper + { + class CGestureHelper; + struct TRealPoint; + } + +//Forward declarations +class CAlfFlowLayout ; +class CAlfImageVisual; + +namespace Alf + { +//Forward declarations +class IAlfWidget; +class IMulModelAccessor; +class IMulSliderModel; +class IMulSliderWidget; +class MulBaseElement; +class MulCoverFlowAo; +class MulCoverFlowTemplate; + +struct TMulCoverFlowControlImpl; + +namespace mulcoverflowcontrol + { + static const IfId Ident= + { + 0,"MulCoverFlowControl" + }; + } + +class MulCoverFlowControl : public CAlfWidgetControl, + public IMulModelObserver, + public GestureHelper::MGestureObserver + { + +public: //Constructor and destructor + + /** + * C++ constructor. + */ + MulCoverFlowControl( CAlfEnv& aEnv ); + + /** + * Destructor. + */ + virtual ~MulCoverFlowControl(); + +public: //From CAlfWidgetControl + + AlfEventStatus handleEvent( const TAlfEvent& aEvent ); + + static inline const IfId& Type() + { + return mulcoverflowcontrol::Ident; + } + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + void VisualLayoutUpdated (CAlfVisual& aVisual); + +public:// From IMulModelObserver + + void ModelStateChanged( TMulChangedState aState, IMulVariantType& aData ); + +public:// From MGestureObserver + + /** + * Handles gesture events and delegates the processing to the base element + * + * @param aEvent Gesture event e.g . EGestureSwipeLeft/Right + */ + void HandleGestureL( const GestureHelper::MGestureEvent& aEvent ); + + +public: //New Methods + + /** + * Returns the total count that application has set to the model . + * The number of items that application has set to the model i,e the total + * number of items that the application may insert into the model may not + * be equal to the total number of items given to the widget for presentation + * by the model . + * + * @returns The number of items that the application has set to the model . + */ + int TotalModelCount(); + + /** + * Sets the highlight index to the given aIndex + * + * @param aIndex, Index to which the current focus visulisation to be moved. + */ + void SetHighlightIndex( int aIndex ,bool aUpdateSlider = true); + + /** + * Return the Highlight Item Index maintained in control when update highlight to model is blocked + * + * @return, Current Highlight + */ + int HighlightIndex(); + + /** + * Returns the current 2D coverflow template. + * + * @return, CoverflowTemplate + */ + MulCoverFlowTemplate* Template2D(); + + /** + * Returns whether the coverflow is currently in fast scroll mode or not . + * + * @returns true if fast scroll mode is launched, else returns false + */ + bool IsFastScrollMode(); + + /** + * Resets the show widget flag depending on the parameter passed. + * + * @param aNewResetValue The new value with which the flag needs to be reset. + */ + void ResetShowWidgetFlag( bool aNewResetValue ); + + + /** + * Returns the accessor to the current model of the widget. + */ + IMulModelAccessor* ModelAccessor(); + + + /** + * Recycles all the visuals added to the Icon Layout. + * The function is called whenever there is an model change + */ + void RecycleVisuals(); + + /** + * Creates the slider widget . The creation of slider widget depends on the xml . + * That is if the xml has a slider tag then only slider widget is created . + */ + IAlfWidget* CreateSliderWidget(); + + /** + * Returns the created slider widget . If the widget is not created , then returns NULL. + */ + IAlfWidget* GetSliderWidget(); + + /** + * Returns the slider model pointer . + * + * @returns The slider model pointer if slider widget is created and exists, else returns NULL. + */ + IMulSliderModel* GetSliderModel(); + + /** + * Check whether we need hold events (Enhanced coverflow can be launched) and + * set the state to gesture helper accordingly + */ + void SetHoldingEnabled(); + + /** + * Enable/Disable double tap on Gesture helper based on the aValue specified. + * + * @param aValue The value whether double tap should be enabled or not. + */ + void SetDoubleTapEnabled( bool aValue); + + /** + * Handles the scrolling event and changes the focus accordingly. + * + * @param aEvent the scrolling event to be handled + */ + void HandleNavigationEvent( int aEvent ); + + /** + * Transition time for highlight change in fast scroll + * + * @return, transition time to be used + */ + int FastScrollTransitionTime(); + + /** + * Update the item at relative index Of aVisualIndex with the data at aItemIndex + * + * @param aItemIndex, Absolute index + * @param aVisualIndex, Relative index + * @param aAnimationTime, text will be updated after the aAnimationTime. + */ + void UpdateCoverflowItem( int aItemIndex, int aVisualIndex, int aAnimationTime = 0); + + /** + * Checks the current index is in visible window and returns its relative index in aRelativeIndex + * + * @param aIndex, + * @param aRelativeIndex, + */ + bool IsIndexInVisibleWindow(const int aIndex,int& aRelativeIndex); + + /** + * + * + */ + int RelativeToAbsolute(const int aRelativeIndex); + + /** + * update the item at the relative index. + * + * @param aVisualIndex, Relative index + * @param aAnimationTime, text will be updated after the aAnimationTime. + * + */ + void UpdateItemAtIndex(const int aRelativeIndex, int aAnimationTime = 0); + + /** + * + * + */ + void DoSetImage(IMulVariantType* aImageData,CAlfImageVisual* aImgVisual); + + /** + * Checks the given file path is of SVG image or not + * + * @param aImagePath Path of the image file,which need to be checked for SVG file format. + */ + bool IsSVGImage(const TDesC& aImagePath); + + /** + * Load Image visual with image provided from file path + * + * @param aSvgFilePath path of Image + * @param aImageVisual visual on with image to be loaded + */ + void LoadImageFromSvg(const TDesC& aImagePath,CAlfImageVisual& aImageVisual ); + + /** + * + * + */ + void StoreVisibleItemCount(int aVisibleItemCount); + + /** + * + * + */ + void SetDefaultImage(int aTextureId); + + /** + * + * + */ + int WindowTop(int aHighlightIndex); + + /** + * + * + */ + void UpdateBaseElement(MulBaseElement* aBaseElement); + + /** + * Slider handles the key events . + * Slider thumb positions itself to the gesture and key events of coverflow widget + * + */ + void SetSliderTickPosition(); + + /** + * + * + */ + void ModelChanged( IMulModelAccessor* aAccessor); + + /** + * Determins the current resolution + * + * + */ + bool IsLandscape(); + + /** + * Destroys slider widget. + */ + void DestroySlider(); + + /** + * Return gesture helper. + */ + GestureHelper::CGestureHelper* Gesturehelper(); + +private: + + // Event handling related api. + /** + * Handles key event related manipulation. + * + * @param TAlfEvent + * @returns The status of the handled event. + */ + AlfEventStatus HandleKeyEvent( const TAlfEvent& aEvent ); + + /** + * Handles repeated key event. + * + * @param TAlfEvent + * @returns The status of the handled event. + */ + AlfEventStatus HandleRepeatKeyEvent( const TAlfEvent& aEvent ); + + /** + * Handle fast scrolling and speed variations with repeated key events. + * + * @param aDirection, Direction in which to change the highlight + */ + void HandleFastScrollWithKeyEvents(int aDirection); + + /** + * Handles custom event that control has raised to itself like bounce,bounce over etc. + * + * @returns The status of the handled event. + */ + AlfEventStatus HandleCustomEvent( const TAlfEvent& aEvent ); + + /** + * Handles swipe events(only on pointer events from gesture helper) + * + * @param aEvent - SwipeRight/SwipeLeft. + */ + void HandleSwipe(int aEvent); + + /** + * Performs the focus visualisation for the new focusedindex, and clears the old + * index visulisation. Called for every navigation events and sethighlight api call. + * + * @param aIndex new Index to which the focus visualisation is to be set. + */ + void DoSetFocusIndex( int aIndex, int aAnimationTime =0); + + /** + * Sets the current highlighted item as the selected item . + * Sends the selection event to the application . + */ + void SetSelection(int aHighlight); + + /** + * Creates a new template element with aTemplateName . + * + * @param aTemplateName The name of thew new template element. + */ + void CreateTemplateElement( mulwidget::TLogicalTemplate aTemplateName); + + + /** + * Sends the specified event to the base element . + * + * @param aEvent Event to be sent to the base element. + */ + void SendEventToBaseElement( const TAlfEvent& aEvent ); + + /** + * Handles if there is any change in the total count of model . + * Updates the slider tick if the total count of model increases/decreases. + * + */ + + void HandleModelCountChange(); + + /** + * Gets the absolute index of the specified visual, which has been tapped. + * + * @param aHitVisual The visual which has been tapped or hit. + */ + int GetHitVisualIndex( CAlfVisual* aHitVisual ); + + /** + * Handle enhanced stop. + */ + void HandleEnhancedStop(); + + /** + * Performs all the enhanced mode related checkings ..e.g whether the fast scroll flag + * is set or not / whether the application is in landscape mode or not . + * + * @return Boolean value informing whether enhanced mode should be started or not . + */ + bool EnhancedModeCondition(); + + /** + * Performs animations when enhanced mode is started . + * The coverflow transits to enhanced mode from 2D normal mode . + * + * @param aEvent , gesture event + */ + void EnhancedStarted( const GestureHelper::MGestureEvent& aEvent ); + + /** + * Returns the current Gesture Speed. + * + * @param aEvent Event from the gesture helper. + * @returns The current gesture speed. + */ + GestureHelper::TRealPoint GestureSpeed( const GestureHelper::MGestureEvent& aEvent ); + + /** + * Performs animations in enhanced mode. + * Moves the layout along with the pointer event . The function calls the active object class + * to move the layout with smooth animation . + * + * @param aEvent Gesture event . + */ + void StartMoving( const GestureHelper::MGestureEvent& aEvent ); + + /** + * Handles all normal gesture events other than hold events + * + * @param aEvent Gesture event e.g . EGestureSwipeLeft/Right + */ + void HandleNormalGestureEvents(const GestureHelper::MGestureEvent& aEvent); + + /** + * Handles hold gesture events. + * + * @param aEvent Gesture event e.g . EGestureSwipeHoldLeft/Right + */ + void HandleHoldGestureEvents(const GestureHelper::MGestureEvent& aEvent); + + /** + * Handles updating utems when the number of items in model are less than total visible items + * + * @param aIndex, Index to update. + */ + void HandleLessItemsUpdate(int aIndex); + + /** + * Sets a blank texture the visual at relative index. + * + * @param aRelativeIndex, Index for which the blank texture should be set + */ + void SetBlankTexture(int aRelativeIndex); + + + /** + * Converts the gesture distance into the form of direction (For right + * its plus and left its minus) + * + * @param aDistance, Gesture distance + */ + int ConvertDistanceToDirection( int aDistance ); + /** + * Sends Tactile feedback in case of touch down event. + * + * @param aEvent Gesture event. + */ + void SendFeedbackOnTouchDown(const GestureHelper::MGestureEvent& aEvent); + + /** + * Decides in which direction the strip should move during fast scroll and also decides the position of + * reference point for some special cases . + * + * @param aEvent Gesture event. + */ + void ReverseDirectionInFastScroll(const GestureHelper::MGestureEvent& aEvent); + + /** + * Change the reference point of reversing the direction until the reference point becomes the + * middle of the screen . + * + * @param aCurrPosition The current pointer position . + * @param aDistanceTravelled The distance travelled by the gesture till now. + */ + void ChangeDirReferencePoint(int aCurrPosition, int aDistanceTravelled ); + + /** + * Handles the operations on the Single tap. + * + * @param aEvent Gesture event. + */ + void HandleSingleTap(const GestureHelper::MGestureEvent& aEvent); + + /** + * + * + * + */ + int TotalSwipeDistance( const GestureHelper::MGestureEvent& aEvent ); + + +private: + + auto_ptr mHelper; //owns it + + auto_ptr mData; // Owned + + auto_ptr mCoverFlowAo; // owned + + MTouchFeedback* mFeedback; // tactile feedback, doesnt own it. + + IMulSliderWidget* mSliderWidget; // + + }; + + } // namespace Alf + +#endif // MULCOVERFLOWCONTROL_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowdefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowdefinitions.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2007-2008 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: header for defining all the common variables +* +*/ + +// This file defines the variables for MulCoverFlowWidget.dll + +#ifndef __MULCOVERFLOWDEFINITIONS_H__ +#define __MULCOVERFLOWDEFINITIONS_H__ + +/// @bug minor:avanhata:7/7/2008 The constants need to be documented. Overall, +/// if you are only using a constant in a single cpp file, then define it there. + +namespace Alf + { + /// @bug minor:avanhata:7/7/2008: unclear variable name - is this duration + /// is milliseconds? + /// @bug minor:avanhata:7/7/2008: KAnimation200 add absolutely + /// no abstraction over just the number 200. + /// Define these as higher-level abstractions ( + /// e.g., KEntryAnimationDuration, KBounceAnimationDuration, etc.) + //static const int KMaxVisibleItems = 3; + static const int KAnimation200 = 200; + + // Minimum differnece in Speed percentage after which the strip size + // and speed will be modified + static const int KMainLayoutIndex = 0; + static const int KHorizontalLeftAlign = 0; + static const int KHorizontalRightAlign = 2; + static const int KMinNumItemForFastScroll = 4; + static const int KNumberOfRepeatsForMediumSpeed = 10; + static const int KNumberOfRepeatsForFastSpeed = 20; + + static const int KZeroAnimation = 0; + /// @bug minor:avanhata:7/7/2008 remove hard coded constant + /// - use sizeof( TUint16 ) instead + static const int KSlashSize = 2; + + static const float KHighlightOpacity = 1.0f; + static const float KBackGroundOpacity = 0.0f; + + static const int KIconFlowLayoutIndex = 0; + static const int KTextLayoutIndex = 1; + static const int KTextLayoutViewPortIndex = 2; + + static const int KTime = 500; + static const int KBounceTime = 150; + static const int KMarqueeTime25 = 40; // marquee animation time + static const int KMarqueeTime1000 = 1000; // after marquee end wait time + static const int KBounceRight= -1; + static const int KBounceLeft= 1; + static const int KVisibleWindow = 3; + static const int KContainerIndex = 1; + static const int KGroupId = 21; + static const int KInitialvalueZero = 0; + static const int KInitialvalueOne = 1; + /// @bug minor:avanhata:7/7/2008 use a meaningful variable name + static const int KTextRowsz = 6; + /// @bug minor:avanhata:7/7/2008 Capitalisation + static const int KTextFontindex = 9; + /// @bug minor:avanhata:7/7/2008 move to the cpp file in which this is used + static const int KTempBufferSize = 50; + static const char* const KNameSliderWidget = "mulsliderwidget"; + static const char* const KNameSliderModel = "mulslidermodel"; + static const char* const KMulTemplate = "mul_template"; + + static const char* const KBase = "base"; + static const char* const KItem = "item"; + static const char* const KText = "text"; + static const char* const KLandscape = "landscape"; + static const char* const KPortrait = "portrait"; + _LIT8( mainlayout,"mainlayout" ); + _LIT8( backgroundvisual,"backgroundvisual" ); + _LIT8( verticalflowlayout,"verticalflowlayout" ); + _LIT8( iconflowlayout,"iconflowlayout" ); + _LIT8( textflowlayout, "textflowlayout"); + _LIT8( counterflowlayout,"counterflowlayout" ); + _LIT8( decklayout,"deck" ); + _LIT8( KEmptyText,"emptytext" ); + _LIT8( KMulEcfShadowTop,"mul_ecf_shadow_top"); + _LIT8( KMulEcfShadowBottom,"mul_ecf_shadow_bottom"); + _LIT( KSlash,"/" ); + _LIT(KOutOfBound,"Out of Bound Index"); + _LIT(KLogicError,"Logic error"); + + _LIT8( KDetailViewPortLayout,"detailviewportlayout"); + _LIT8( KTitleViewPortLayout,"titleviewportlayout"); + _LIT8( text,"text" ); + _LIT8( KLitMulBackGround , "mul_background" ); + _LIT8( KTextAnchor , "anchor" ); + _LIT(KTemplateNotFound, "Template Not Found"); + _LIT(KOrientationNotFound, "Orientation Node not found"); + _LIT(KVisualNotFound, "Visual Not Found"); + _LIT(KIteratorNotCreated, "Iterator could not be created"); + _LIT(KNullPointer,"Null Pointer"); + _LIT(KInvalidArgument,"Invalid Argument"); + _LIT(KInvalidTemplate,"Invalid Template"); + _LIT(KInvalidAttribute,"Invalid Attribute"); + + _LIT8( KCoverflowTitle,"mul_title"); + _LIT8( KCoverflowDetail,"mul_detail"); + _LIT8( KCoverflowIcon,"mul_icon"); + _LIT8( KCoverflowIndicator,"mul_indicator"); + _LIT8( KCoverflowCounter,"mul_count"); + _LIT8(KInvalidID,""); + + static const char* const KOrientation = "orientation"; + static const char* const KCategory = "category"; + static const char* const KElement = "element"; + static const char* const KHighlight = "highlight"; + static const char* const KLayout = "layout"; + static const char* const KFlow = "flow"; + static const char* const KBackground = "background"; + static const char* const KAnchor = "anchor"; + static const char* const KDeck = "deck"; + static const char* const KImageVisual = "imagevisual"; + static const char* const KTextVisual = "textvisual"; + static const char* const KBaseTemplate = "templatebase"; + static const char* const KCounter = "counter"; + static const char* const KNonHighlight = "nohighlight"; + static const char* const KXml = "xml"; + static const char* const KSize = "size"; + static const char* const KUiOnOff = "uiOnOff"; + static const char* const KEnhancedMode = "enhancedmode"; + static const char* const KSlider = "slider"; + static const char* const KSliderWidget = "widget"; + static const char* const KEnhancedSize = "enhancedsize"; + static const char* const KMinSize = "min_size"; + static const char* const KMaxSize = "max_size"; + static const char* const KCounterSize = "counter_size"; + static const char* const KMulBackGround = "mul_background"; + static const char* const KMulTitle = "mul_title"; + static const char* const KMulDetail = "mul_detail"; + static const char* const KOpacity = "opacity"; + static const char* const KColour = "colour"; + static const char* const KHeight = "height"; + static const char* const KWidth = "width"; + static const char* const KPosX = "positionx"; + static const char* const KPosY = "positiony"; + static const char* const KTemplateId = "template"; + static const char* const KLogicalTemplateDrive = "\\resource\\coverflow\\"; + static const char* const KTemplatePrefix = "logical_template"; //for slider + static const char* const KUnderscore = "_"; + static const char* const KExtension = ".xml"; + static const char* const KCentreItem = "item_center"; + static const char* const KRightItem = "item_right"; + static const char* const KId = "id"; + static const char* const KMulCount = "mul_count"; + static const char* const KCounterBgColor = "backgroundcolor"; + static const char* const KCounterBgOpacity = "backgroundopacity"; + static const char* const KFitMode = "fitmode"; + static const char* const KItemCentre = "item_center"; + static const char* const KItemRight = "item_right"; + static const char* const KMainLayout = "mainlayout"; + static const char* const KMarquee = "marquee"; + static const char* const KMarqueeOn = "yes"; + static const char* const KRedColorAttrib = "red"; + static const char* const KGreenColorAttrib = "green"; + static const char* const KBlueColorAttrib = "blue"; + static const char* const KAlphaColorAttrib = "alpha"; + static const char* const KOn = "on"; + static const char* const KOff = "off"; + static const char* const KTextStyle = "style"; + static const char* const KHorzAlign = "horizontalalign"; + static const char* const KVertAlign = "verticalalign"; + static const char* const KColor = "color"; + static const char* const KFontThemeColor = "fontthemecolor"; + static const char* const KTextSkinColorId = "textskincolorid"; + static const char* const KTextColorSkinIndex = "textcolorskinindex"; + static const char* const KTempMaxCount = "templatemaxcount"; + static const char* const KFastScroll = "fastscroll"; + static const char* const KIndicator = "mul_indicator"; + + enum TMulCoverFlowEventType + { + ECustomEventBounceBack = 300,/*!< A message regarding coverflow bounce */ + ECustomEventScroll, + ECustomEventBounceCompleted + }; + + enum TItemScroll + { + EItemNoDirection, + EItemScrollLeft, + EItemScrollRight + }; + + enum TTextVisualType + { + ECounterVisual = 1, + ETilteDetailTextVisual + }; + + enum TNumberofSwipes + { + ESingleSwipe, + EDoubleSwipe, + ETripleSwipe + }; + +struct TMulVisualColorProperty + { + TRgb mColor; + bool mIsColorSet; + TMulVisualColorProperty():mIsColorSet(false){} + }; //end of the structure + +struct TMulRotationProperty + { + int mIndex; + bool mIsApplied; + int mImageAngle; + TSize mTextureSize; + + TMulRotationProperty():mIsApplied(false),mIndex(-1),mImageAngle(0) + { + } + }; //end of the structure + + } //namespace Alf + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowenhancedtemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowenhancedtemplate.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2007-2008 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: template header for CoverFlow +* +*/ + +// This file defines the API for MulCoverFlowWidget.dll + +#ifndef MULCOVERFLOWENHANCEDTEMPLATE_H_ +#define MULCOVERFLOWENHANCEDTEMPLATE_H_ + +#include "mulcoverflowbasetemplate.h" + +namespace osncore + { +// Forward declarations +class UString; + } + +namespace Alf + { +// Forward declarations +class MulCoverFlowControl; +class MulXmlUtility; + +struct TMulCoverFlowEnhancedTemplateImpl; + +class MulCoverFlowEnhancedTemplate :public MulCoverFlowBaseTemplate + { + +public: // Constructor and Destructor + + /** + * Constructor + */ + MulCoverFlowEnhancedTemplate(MulCoverFlowControl &aControl,UString &aTemplateID, MulXmlUtility& aMulXmlUtility ,DuiNode* aRootNode); + + /** + * Destructor + */ + ~MulCoverFlowEnhancedTemplate(); + +public: // New Methods + + /** + * Returns the enhanced max size in TMulCoverFlowItem structure. + * + * @return Returns reference to TMulCoverFlowItem structure. + */ + const TMulCoverFlowItem& EnhancedMaxSize(); + + /** + * Returns the enhanced min size in TMulCoverFlowItem structure. + * + * @return Returns reference to TMulCoverFlowItem structure. + */ + const TMulCoverFlowItem& EnhancedMinSize(); + + /** + * Returns the counter position and size in TMulCoverFlowItem structure. + * + * @return Returns reference to TMulCoverFlowItem structure. + */ + const TMulCoverFlowItem& EnhacedCounterPos(); + + /** + * Returns the path of the image that should be used as ecf shadow border. + * + * @return Returns path of the image that should be used as ecf shadow border. + */ + const UString& EnhancedBorderImagePath(); + +private: + + /** + * Parses xml tags of type and in turn creates AlfElements + * which in turn are added in the control. + * + * All tags with will be parsed here + * + * @param aNode the orientation node depending on the orientation + * being used . + */ + void ParseNode( DuiNode& aNode ); + + /** + * Parses the enhanced size tag in the xml . + * + * @param aNode the node at which the tag is . + */ + void ParseEnhancedTag( DuiNode& aNode ); + + /** + * Parses the counter size tag in the xml . + * + * @param aNode the node at which the tag is . + */ + void ParseCounterTag( DuiNode& aNode ); + + /** + * Parses the sizes tag and stores those values in corresponding variables. + * + * @param aNode the node at which sizes are to be parsed from. + */ + void ProcessSizeTag( DuiNode& aNode ); + + /** + * Parses the imagepath tag and stores those values in corresponding variables. + * + * @param aNode the node at which sizes are to be parsed from. + * @param aPath, Reference to Ustring in which the parsed value should be stored + */ + bool GetStaticImagePath(DuiNode& aNode, UString& aPath); + +private: + auto_ptr mData; // owns it + + }; // class + + }//namespace Alf + +#endif /*MULCOVERFLOWENHANCEDTEMPLATE_H_*/ + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowitemelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowitemelement.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007-2008 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: Item element header for Cover Flow. +* +*/ + +// This file defines the API for mulcoverflowwidget.dll +#ifndef MULCOVERFLOWITEMELEMENT_H_ +#define MULCOVERFLOWITEMELEMENT_H_ + + +// Includes +#include +#include + +#include + +#include "mulvisualtemplate.h" +// Forward declarations. +class MulTemplateInterface; + +namespace Alf + { + +class MulCoverFlowItemElement: public AlfElement, public IAlfWidgetEventHandler + { + +public: // Constructor and Destructor + + /** + * Constructor + * @param aControl WidgetControl + * @param aName Name of the element. + */ + // third parameter shd be moved. + MulCoverFlowItemElement( CAlfWidgetControl& aControl, const char* aName , MulTemplateInterface& aControlInterface ); + + /** + * Destructor + */ + ~MulCoverFlowItemElement(); + +public: // From IAlfWidgetEventHandler + + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + void setActiveStates( unsigned int aStates ); + + AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + AlfWidgetEventHandlerInitData* eventHandlerData(); + + AlfEventHandlerType eventHandlerType() ; + + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + + +public: // new methods + + CAlfVisual* CreateIconStructure(CAlfLayout* aParentLayout, const UString& aTemplateId); + + void DoSetImage(IAlfVariantType* data, CAlfImageVisual* aImgVisual); + + + +private: + + /** + * gets the handle to the visual template. + */ + MulVisualTemplate* VisualTemplate() + { + return static_cast(getVisualTemplate()); + } +private: // Member data + + std::vector mRecycleVisualArray; //stores sizes and positions of all items + bool mVisualRecycled; + int mNumVisualsRecycled; + CAlfFlowLayout* mIconFlow; + }; + + } // namespace ends here + +#endif /*MULCOVERFLOWITEMELEMENT_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowtemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowtemplate.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,397 @@ +/* +* Copyright (c) 2007-2008 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: template header for CoverFlow +* +*/ + +// This file defines the API for MulCoverFlowWidget.dll + +#ifndef __MULCOVERFLOWTEMPLATE_H__ +#define __MULCOVERFLOWTEMPLATE_H__ + +// Avkon Includes +#include + +#include "mulbaseelement.h" // for TMulCoverflowItem + +namespace osncore + { +// Forward declarations +class UString; + } + +namespace Alf + { +// Forward declarations +class MulCoverFlowControl; + +struct TMulCoverFlowTemplateImpl + { + + TMulCoverFlowTemplateImpl() + { + mEnhancedSupportFlag = false; + mSliderEnabled = false; + mUiOnOffFlag = false; + mOrientationChange = false; + mControl = NULL; + mBaseElement = NULL; + mMaxVisibleCount = 0; + mTitleFontMaxCharLength = 0; + mDetailFontMaxCharLength = 0; + mCounterFontMaxCharLength = 0; + } + + //Structure used to store the position and sizes of the counter. + TMulCoverFlowItem mCounterDimensions; + TMulCoverFlowItem mSliderDimensions; + TMulCoverFlowItem mIndicatorDimensions; + bool mEnhancedSupportFlag; + bool mSliderEnabled; + bool mUiOnOffFlag ; + int mMaxVisibleCount; + MulBaseElement* mBaseElement; + bool mOrientationChange; + MulCoverFlowControl* mControl; // doesn't own it . + mulwidget::TLogicalTemplate mTemplateID; // to store the template name + TSize mTitleParentSize; + TSize mDetailParentSize; + int mTitleFontMaxCharLength; + int mDetailFontMaxCharLength; + int mCounterFontMaxCharLength; + + ~TMulCoverFlowTemplateImpl() + { + } + }; + + + +class MulCoverFlowTemplate + { + +public: // Constructor and Destructor + + /** + * Constructor + */ + MulCoverFlowTemplate(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); + + /** + * Destructor + */ + virtual ~MulCoverFlowTemplate(); + +public: // New Methods + + /** + * Returns the counter element structure. + * + * @return Returns a refrence to the counter element structure. + */ + const TMulCoverFlowItem& CounterDimensions() const + {return mData->mCounterDimensions;} + + /* + * Returns whether the current template and orientation supports enhanced mode or not. + * + * @Returns true/false depending on whether the template supports or not. + */ + bool EnhancedTagParsed() const {return mData->mEnhancedSupportFlag;} + + /* + * Returns whether the slider is enable or not for the current template and + * orientation. + * + * @Returns true/false depending on whether enabled or not. + */ + bool IsSliderVisible() const {return mData->mSliderEnabled;} + + /* + * Returns the maxvisible items to be in the respective template . + * + * @Returns int depending on the no of visble item count. + */ + int MaxVisibleCount() const {return mData->mMaxVisibleCount;} + + /** + * Returns whether the template is UI on/off or not . + * That is UI on/off flag is enabled in the template or not . + * + * @returns true if flag is enabled else false . + */ + bool IsUiOnOffFlagEnabled() const {return mData->mUiOnOffFlag;} + + /** + * Returns the slider dimensions . + * + * @Returns TMulCoverFlowItem dimension of the slider + */ + const TMulCoverFlowItem& SliderDimension() {return mData->mSliderDimensions;} + + /** + * Returns the video indicator dimension. + * + * @return Returns a refrence to the indicator dimension. + */ + const TMulCoverFlowItem& IndicatorDimension() const {return mData->mIndicatorDimensions;} + + /** + * Returnt the size of the title window size. + * + */ + const TSize& TitleWindowSize() {return mData->mTitleParentSize;} + + /** + * Return the size of the detail window size. + * + */ + const TSize& DetailWindowSize() {return mData->mDetailParentSize; } + + /** + * Return the title maximum character font Width + * + */ + int TitleMaxCharWidth() {return mData->mTitleFontMaxCharLength;} + + /** + * Return the detail maximum character font Width + */ + int DetailMaxCharWidth() {return mData->mDetailFontMaxCharLength;} + + /** + * Return the counter maximum character font Width + */ + int CounterMaxCharWidth() {return mData->mCounterFontMaxCharLength;} + + + /** + * Virtual function must be overriden by derived class. + * Creates the visualisation based on the Orientation + * also updates the visualisation on orientation change + * + * @param aIsLandscape, current orientation + * @param aIsOrientationChange, based on flag decide to + * create or update the visualisation + */ + virtual void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange = false); + + +protected: + + /** + * Get the window rect of the Imagevisual or layouts . + * @Param aLayout layout which gives all the LCT data of + * the visual(image or layout). + * @Param aParentRect rect of the parent to the visual. + */ + TRect IconWindowRect(const TAknWindowLineLayout &aLayout, const TRect& aParentRect); + + /** + * Get the window rect of the textvisual . + * @Param aLayout layout which gives all the LCT data of + * the textvisual. + * @Param aParentRect rect of the parent to the visual + */ + TRect TextWindowRect(const TAknTextLineLayout& aLayout, const TRect& aParentRect); + + /** + * Set the style to the textvisual + * + * @param aTextFontId the fontId to be set on textvisual. + * @param textVisual refernce to textvisual. + */ + void SetTextStyle(int aTextFontId, CAlfTextVisual& textVisual); + + /** + * Update the maximum character width of text font of textvisual + * @Param textVisual , alftextvisual + */ + int UpdateMaxFontWidth(CAlfTextVisual* textVisual); + + /** + * Applies brush on the specified visual . + * The colour of the brush is aBrushColour. + * @param aVisual visual on which brush has to be applied. + * @param aBrushColour The brush colour. + * @param aBrushOpacity The opacity to be applied on the brush. + */ + void ApplyBrush( CAlfTextVisual& aVisual,const TRgb& aBrushColour, + float aBrushOpacity ); + +private: + + /** + * Returns a font id for the specified style. + * + * @Param aFontStyle font style. + * @Param aManager textstyle manager. + */ + TInt GetFontId(const UString &aFontStyle, CAlfTextStyleManager& aManager)const; + + +protected: + auto_ptr mData; + + }; + + +// class Template 4 +class MulCoverFlowTemplate4 : public MulCoverFlowTemplate + { +public: + + /** + * Constructor + */ + MulCoverFlowTemplate4(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); + + /** + * destructor + */ + ~MulCoverFlowTemplate4(); + +// From MulCoverFlowTemplate + + /** + * @See CreateVisualisation of MulCoverFlowTemplate + */ + void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange=false); + +// new method + + /** + * provides the dimension of the visual attribute (icon & video indicator) + * based on the orientation. + * + * @param aAttribute, type of visual attribue + * @param aIslandscape, current orientation + */ + static void GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, + int& aHeight, int& aWidth); + +private: + + /** + * create visualisation for potrait orientation + * + */ + void CreatePrtStructure(); + + /** + * create visualisation for landscape orientation + * + */ + void CreateLscStructure(); + + /** + * create counter visual and apply attribute + * + * @param acounterPaneVerityId, lct verity of counter visual. + * @param aMainRect, parent rect for counter visual. + */ + void ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect); + + }; + +// class Template 1 +class MulCoverFlowTemplate1 : public MulCoverFlowTemplate + { +public: + + /** + * Constructor + */ + MulCoverFlowTemplate1(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); + + /** + * destructor + */ + ~MulCoverFlowTemplate1(); + +// From MulCoverFlowTemplate + + /** + * @See CreateVisualisation of MulCoverFlowTemplate + */ + void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange=false); + +// new method + + /** + * provides the dimension of the visual attribute (icon & video indicator) + * based on the orientation. + * + * @param aAttribute, type of visual attribue + * @param aIslandscape, current orientation + */ + static void GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, + int& aHeight, int& aWidth); + +private: + + /** + * create visualisation for potrait orientation + */ + void CreatePrtStructure(); + + /** + * create visualisation for landscape orientation + */ + void CreateLscStructure(); + + /** + * create counter visual and apply attribute + * + * @param acounterPaneVerityId, lct verity of counter visual. + * @param aMainRect, parent rect for counter visual. + */ + void ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect); + + /** + * apply attribute on main text layout + * + * @param aMainRect, parent rect for main text layout + */ + void ApplyTextAttribute(const TRect& aMainRect); + + /** + * create title text visual and apply attribute + * + * @param aVerityId, lct verity of title text. + * @param aTextLayoutRect, parent rect for title text + */ + void ApplyTitleTextAttribute(int aVerityId,const TRect& aTextLayoutRect); + + /** + * create detail text visual and apply attribute + * + * @param aVerityId, lct verity of detail text. + * @param aTextLayoutRect, parent rect for detail text + */ + void ApplyDetailTextAttribute(int aVerityId,const TRect& aTextLayoutRect); + + /** + * parse and apply the slider attribute + * + * @param aMainRect, parent rect for slider + */ + void ApplySliderAttribute(const TRect& aMainRect); + }; + + + }//namespace Alf +#endif //__MULCOVERFLOWTEMPLATE_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2007-2008 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: widget header for CoverFlow +* +*/ + +// This file defines the API for MulCoverFlowWidget.dll + +#ifndef __MULCOVERFLOWWIDGET_H__ +#define __MULCOVERFLOWWIDGET_H__ + + +// Include Files +// Mul headers +#include + +// Alf headers +#include "alf/alfwidget.h" + +//Gesture Helper namespace +namespace GestureHelper + { + class CGestureHelper; + } + +namespace Alf + { + +//Forward Class Definitions +class MulBaseElement; +class MulCoverFlowControl; + +/// @bug comment:avanhata:3/7/2008 It would be good to describe the responsibilities and +/// design of the class here. The comment about method is incorrect, as it is the abstract +/// interface that the application uses +/** + * Widget Implementation class. The Widget Class is responsible for the creation of the control and elements. + */ + +class MulCoverFlowWidget : public AlfWidget, + public IMulCoverFlowWidget + { +public: //Constructor and destructor + + /** + * C++ constructor. + */ + MulCoverFlowWidget( CAlfEnv& aEnv, const char* aWidgetId, IAlfContainerWidget& aContainerWidget ); + + /** + * Destructor. + */ + ~MulCoverFlowWidget(); + +public: // From AlfWidget Common Property related apis + + IAlfContainerWidget* parent() const; + + CAlfWidgetControl* control() const; + + void setControl( CAlfWidgetControl* aControl,bool aDeletePreviousControl ); + + IAlfModel* model(); + + void setModel( IAlfModel* aModel,bool aTakeOwnership ); + + const char* widgetName() const; + + void setChildFocus( bool aFocus ); + + void setPresentation( const char* aFilePath ); + +public: //From MAlfInterfaceBase. + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + +public: //From IMulCoverFlowWidget. + + void SetBackground( const TRgb& aColor ); + + void SetBackground(const TAknsItemID& aItemID ); + + void SetEmptyText( const UString& aDefaultText ); + + void SetUIMode(bool UIOn=false, int aTransition=0 ); + + void SetDefaultImage(int aTextureId); + + void RotateImage(TMulRotation aDirection,TSize aImageSize,int aAnimationTime); + + GestureHelper::CGestureHelper* Gesturehelper(); + +public: //From IMulWidget + + void SetFlags( unsigned int aAnyFlag ); + + void ClearFlags( unsigned int aAnyFlag ) ; + + unsigned int GetFlags() const; + + bool IsFlagSet( TMulWidgetPropertiesFlag aAnyFlag ) const; + + void SetModel( IMulModelAccessor* aAccessor, bool aFlag=true ); + + void SetRect( int aLeftMargin, int aTopmargin, int aHeight, int aWidth, int aTransitionTime = 0 ); + + void ShowWidget( bool aShow, int aTransitionTime = 0 ) ; + + void GetIconSize( mulwidget::TLogicalTemplate aTemplateId, + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth); + + void GetIconSize(mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth); + + void AddEventHandler( IAlfWidgetEventHandler& aObserver ); + + void RemoveEventHandler( IAlfWidgetEventHandler& aObserver ); + + const CAlfLayout& ContainerLayout(); + + void SetMarkMode( bool aFlag ); + + bool IsMarkMode()const ; + + void SetReorderMode( TMulReOrderMode /*aReorderMode*/); + + bool IsReorderModeOn() const; + + + void SetOverlay( TMulAttributeDataType aType, const UString& aAttribute, const UString& aFormat ) ; + + void SetAnimationTime( TMulVisualEffect aVisualEffect, int aTransitionTime = 0 ) ; + + void SetVisualColor( TMulVisualType aVisualType , const TRgb& aColor ); + + +private: // Class Data + + unsigned int mWidgetPropertyFlag; + IMulModelAccessor* mMulModelAccessor; // doesn't won it. + MulBaseElement* mBaseElement; // doesn't own it. + MulCoverFlowControl* mCoverflowControl; //// doesn't own it. + bool mTakesModelOwnership; + + }; + + } // namespace Alf + +#endif // __MULCOVERFLOWWIDGET_H__ + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/inc/mulcoverflowwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/inc/mulcoverflowwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007-2008 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: factory plugin header for CoverFlow +* +*/ + +#ifndef MULCOVERFLOWWIDGETFACTORYPLUGIN_H +#define MULCOVERFLOWWIDGETFACTORYPLUGIN_H + + +#include +#include +#include + + +namespace Alf + { +class IfId; + +/** + * Plugin factory to create widget factory + * @lib alfwidgetfactory.dll + */ +/// @bug comment:avanhata:3/7/2008 This class is only used from its own cpp file, +/// so the definition can be moved into the cpp and the header file removed. +class MulCoverFlowWidgetFactoryPlugin: public IAlfFactoryPlugin + { +public: + /** + * Two-phased symbian constructor. + * + * @return New instance of this factory plugin. + */ + static MulCoverFlowWidgetFactoryPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~MulCoverFlowWidgetFactoryPlugin(); + +public: // from MAlfPluginFactory + + IAlfInterfaceBase* createProduct(const char* aProduct,void* aInitData); + + int productCount()const; + + const char* productInfo(int aIndex)const; + + IAlfInterfaceBase* makeInterface(const IfId& aType); + + }; + + } // namespace Alf + +/// @bug comment:avanhata:3/7/2008 does not need to be declared - just define in cpp +// Exported factory function required by ECOM-framework +IMPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount); + +#endif //MULCOVERFLOWWIDGETFACTORYPLUGIN_H + +//End of file \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/rom/mulcoverflowwidget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/rom/mulcoverflowwidget.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2007-2008 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: CoverFlow Widget iby file. +* +*/ + +#ifndef __MULCOVERFLOWWIDGET_IBY__ +#define __MULCOVERFLOWWIDGET_IBY__ + +ECOM_PLUGIN( mulcoverflowwidget.dll, mulcoverflowwidget.rsc ) + +#endif // __MULCOVERFLOWWIDGET_IBY__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/2000D240.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/2000D240.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007-2008 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: Ecom plugin resource file for coverflow widget +* +*/ + + +#include +#include "alf/alfecompluginfactoryuid.rh" + + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x2000D240; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2000D241; + version_no = 1; + display_name = ""; + default_data = "mulcoverflowwidget"; + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulbaseelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulbaseelement.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,2961 @@ +/* +* Copyright (c) 2007-2008 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: base element Implementation + * +*/ + +// Include Files +// Class Headers +#include "mulbaseelement.h" + +#include +// Alf Headers +#include +#include +#include +#include +#include +#include +#include +#include + +// Mul Headers +#include "mul/mulmodelutility.h" +#include "imulmodelaccessor.h" +#include +#include +#include "mulassert.h" +#include "mulleave.h" +#include "mullog.h" //for logs + +// Local Cover Flow Headers +#include "mulcoverflowcontrol.h" +#include "mulcoverflowtemplate.h" + +namespace Alf + { +//Internal base element structure implementation +struct TMulBaseElementImpl + { + + UString mEmptyText; // empty text to be displayed when number of items is 0. + + int mPadding; //Padding between item + + TMulCoverFlowItem mHighlightItemStruct; + TMulCoverFlowItem mItemStruct; + int mVisibleCount; + int mScrollAnimationTime; // animation time for highlight transition set by the application. + bool mUiOn; // true if in UiOnMode + + bool mTextVisible; // not suppose to be displayed in template 4 + + + // To keep a pointer of iconFlow layout.Not owned, created at construction. + // The below 4 layouts will never be null. No need to validate before using + CAlfFlowLayout* mIconFlowLayout; + CAlfLayout* mTextLayout; + CAlfFlowLayout* mVerticalFlow; + CAlfLayout* mSliderLayout ; // stores visual of the slider widget + + // Can be null when the template doesnt have counter. + CAlfTextVisual* mCounterVisual ; + CAlfTextVisual* mEmptyTextVisual; + + //Stores current slider opacity. + float mSliderOpacity; + TItemScroll mScrollDir; + float mEmptyTextOpacity; + // whether to apply default fit mode(fitinside) or not. + // if false apply default fit mode , else based on the image size. + bool mFitMode; + + // different visuals color properties + TMulVisualColorProperty mIconBgColor; + TMulVisualColorProperty mCounterColor; + TMulVisualColorProperty mTextColor; + TMulRotationProperty mRotation; + + bool mChangeSize; + // whether user has swiped multiple times. + TNumberofSwipes mNumSwipes; + // total number of digits in counter visual at every highlight. + int mNumOfDigitsInCounter; + // marquee animation time + int mMarqueeAnimTime; + // Titletext extents + TSize mTitleExt; + // Detailtext extents + TSize mDetailExt; + //Dummy text visual for getting text extents + CAlfTextVisual* mDummyVisual; + bool mIsMirrored; + + //Constructor of the structure + TMulBaseElementImpl() + { + //Intialisation + mPadding = -1; + mNumOfDigitsInCounter = -1; + mVisibleCount = 0; + mScrollAnimationTime = 200; + mEmptyText = ""; + mCounterVisual = NULL; + mIconFlowLayout = NULL; + mTextLayout = NULL; + mVerticalFlow = NULL; + mSliderLayout = NULL; + mEmptyTextVisual = NULL; + mSliderOpacity = 0.0f; + mTextVisible = true; + mScrollDir = EItemNoDirection; + mEmptyTextOpacity = 0.0f; + mFitMode = false; + mUiOn = false; + mChangeSize = false; + mNumSwipes = ESingleSwipe; + mMarqueeAnimTime = 0; + mDummyVisual = NULL; + mIsMirrored = false; + } + ~TMulBaseElementImpl() + { + } + }; //end of the structure + + +// --------------------------------------------------------------------------- +// MulBaseElement +// --------------------------------------------------------------------------- +// +MulBaseElement::MulBaseElement( CAlfWidgetControl& aControl, + const char* aName ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MulBaseElement"); + mData.reset( new (EMM)TMulBaseElementImpl ); + //Call the base class method + construct( aControl,aName ); + CreateBaseLayoutStructure(); + (static_cast(aControl)).UpdateBaseElement(this); + if (AknLayoutUtils::LayoutMirrored()) + { + mData->mIsMirrored = true; + } + else + { + mData->mIsMirrored = false; + } + } + +// --------------------------------------------------------------------------- +// ~MulBaseElement +// --------------------------------------------------------------------------- +// +MulBaseElement::~MulBaseElement() + { + // Nothing to delete . + } + +// --------------------------------------------------------------------------- +// accept +// --------------------------------------------------------------------------- +// +bool MulBaseElement::accept( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) const + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::accept"); + uint eventID; + if(!aEvent.IsCustomEvent()) + { + return false; + } + eventID = aEvent.CustomParameter(); + + //Events handled by the base element + if( eventID == ETypeHighlight + || eventID == EEventWidgetInitialized + || eventID == ETypePrimaryValueChange ) + { + return true; + } + else + { + return false; + } + } + +// --------------------------------------------------------------------------- +// offerEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulBaseElement::offerEvent( CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::offerEvent"); + if ( !accept( aControl, aEvent ) ) + { + //return false; + return EEventNotHandled; + } + + uint eventID = aEvent.CustomParameter(); + + MulCoverFlowControl* coverflowControl = static_cast(&control()); + + if( eventID == EEventWidgetInitialized ) + { + // some of the member variable needs to be reset + // to support dynamic template change with model change. + mData->mNumOfDigitsInCounter = -1; + + UpdateTextAndCounter(); + CalculatePadding(); + ArrangeItems(); + // Show empty text if coverflow is empty + int totalModelCount = coverflowControl->TotalModelCount(); + IMulModelAccessor* model = coverflowControl->ModelAccessor(); + if( (totalModelCount <= 0) || (model == NULL)) + { + ShowEmptyText( true ); + return EEventConsumed; + } + else + { + ShowEmptyText( false ); + } + return EEventConsumed; + } + + else if( eventID == ETypeHighlight ) + { + // Update the text and counter values according to the new highlight + int newHighlight = coverflowControl->HighlightIndex(); + int animationTime = aEvent.CustomEventData(); + animationTime = animationTime > 0 ? animationTime : mData->mScrollAnimationTime; + + if(mData->mScrollDir != EItemNoDirection) + { + if(coverflowControl->IsFastScrollMode()) + { + animationTime = coverflowControl->FastScrollTransitionTime(); + SetHighlight(newHighlight,animationTime); + } + else + { + SetHighlight(newHighlight,animationTime ); + } + } + else + { + //@TODO: update all the items + animationTime = KZeroAnimation; + SetHighlight(newHighlight,animationTime); + } + + UpdateTextAndCounter(animationTime); + + return EEventConsumed; + } + else if( eventID == ETypePrimaryValueChange ) + { + IMulSliderModel* mulSliderModel = coverflowControl->GetSliderModel(); + if( mulSliderModel ) + { + int primaryValue = mulSliderModel->PrimaryValue(); + coverflowControl->SetHighlightIndex( primaryValue , false); + } + return EEventConsumed; + } + + return EEventNotHandled; + } + +// --------------------------------------------------------------------------- +// setActiveStates +// --------------------------------------------------------------------------- +// +void MulBaseElement::setActiveStates( unsigned int /*aStates*/ ) + { + //No implementation required + } + +//----------------- Creating the visuals and layout structure ---------------- + + +// --------------------------------------------------------------------------- +// CreateBaseLayoutStructure +// --------------------------------------------------------------------------- +// +void MulBaseElement::CreateBaseLayoutStructure() + { + THROW_IF_LEAVES + ( + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateBaseLayoutStructure"); + + CAlfLayout* main = CAlfLayout::AddNewL(control()); + + // set this flag, to recieve layout change events ,that are handled + // by the ovverriden VisualLayoutUpdated method of the alfwidgetcontrol. + main->SetFlags( EAlfVisualFlagLayoutUpdateNotification ); + main->SetTagL( mainlayout ); + main->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + main->SetClipping(ETrue); + + CAlfDeckLayout* deckLayout = CAlfDeckLayout::AddNewL( (CAlfControl &)control(),main); + deckLayout->SetTagL( decklayout ); + deckLayout->SetFlag( EAlfVisualFlagManualLayout ); + + CAlfGradientBrush* deckBrush = CAlfGradientBrush::NewL( control().Env() ); + // Set the brush colour + deckBrush->SetColor( KRgbBlack ); + deckLayout->EnableBrushesL( ETrue ); + // Apply brush and set the opacity . + deckLayout->Brushes()->AppendL( deckBrush, EAlfHasOwnership ); + deckLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + deckLayout->SetClipping(ETrue); + + + // Create a vertical flow layout which has two horizontal layouts + mData->mVerticalFlow = CAlfFlowLayout::AddNewL((CAlfControl&)control(), deckLayout ); + + // Set the Layout Direction + mData->mVerticalFlow->SetFlowDirection( CAlfFlowLayout::EFlowVertical ); + mData->mVerticalFlow->SetFlag( EAlfVisualFlagManualLayout ); + mData->mVerticalFlow->SetTagL( verticalflowlayout ); + mData->mVerticalFlow->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + + // Create flow layout,all the item visuals are added to this layout. + // make this layout as the child to the vertical flow layout at index 1. + mData->mIconFlowLayout = CAlfFlowLayout::AddNewL( (CAlfControl&)control(), mData->mVerticalFlow ); + + // Set the Layout Direction + mData->mIconFlowLayout->SetFlowDirection( CAlfFlowLayout::EFlowHorizontal ); + mData->mIconFlowLayout->SetTagL( iconflowlayout ); + mData->mIconFlowLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + + // stores visuals of all the items(text visuals) + mData->mTextLayout = CAlfLayout::AddNewL((CAlfControl&)control(),mData->mVerticalFlow); + mData->mTextLayout->SetTagL( textflowlayout ); + mData->mTextLayout->SetFlag(EAlfVisualFlagIgnorePointer); + mData->mTextLayout->SetFlag( EAlfVisualFlagManualLayout ); + mData->mTextLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + //Add main layout to the base visual tree + addVisualTree( main, KInitialvalueZero ); + + ); + } + +// --------------------------------------------------------------------------- +// SetDefaultSize +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetDefaultSize( TSize aSize ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetDefaultSize"); + CAlfLayout* main = (CAlfLayout*)findVisual( KMainLayoutIndex ); + main->SetSize(aSize ); + CAlfDeckLayout& deckLayout = static_cast (main->Visual(KMainLayoutIndex) ); + deckLayout.SetSize(aSize); + CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual); + if(backgroundVisual) + { + backgroundVisual->SetSize(aSize); + } + if( mData->mEmptyTextVisual && mData->mEmptyTextOpacity == 1 ) + { + mData->mEmptyTextVisual->SetSize(aSize); + } + } + +// --------------------------------------------------------------------------- +// TextAnchorLayout +// --------------------------------------------------------------------------- +// +CAlfLayout& MulBaseElement::TextLayout() + { + __MUL_ASSERT( mData->mTextLayout != 0,KNullPointer); + return *mData->mTextLayout; + } + + +//----------------------Empty text related visualisation--------------------- +// --------------------------------------------------------------------------- +// SetEmptyText +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetEmptyText( const UString& aDefaultText ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetEmptyText"); + + mData->mEmptyText = aDefaultText; + int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount(); + + if( mData->mEmptyTextVisual ) + { + THROW_IF_LEAVES + ( + TBuf desc; + + MulModelUtility::ConvertUStringToTDes(mData->mEmptyText, desc); + mData->mEmptyTextVisual->SetTextL(desc); + ); + } + + if( totalModelCount <= KInitialvalueZero ) + { + ShowEmptyText( true ); + } + } + +// --------------------------------------------------------------------------- +// ShowEmptyText +// --------------------------------------------------------------------------- +// +void MulBaseElement::ShowEmptyText( bool aShowText ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowEmptyText"); + + // If the application has not set any empty text , then no need to do anything + if( mData->mEmptyText.isEmpty() ) + { + if( aShowText ) + { + ShowHideVisualsForEmptyText(false); + HandleSizeChangeOnMain(); + } + else + { + ShowHideVisualsForEmptyText(true); + } + return; + } + + if( aShowText ) + { + if( !mData->mEmptyTextVisual ) + { + CreateEmptyTextVisualisation(); + } + + // This function is called twice only when an empty model is set and the app sets the empty text twice . + ShowHideVisualsForEmptyText(false); + if( mData->mEmptyTextOpacity == KBackGroundOpacity && mData->mEmptyTextVisual ) + { + mData->mEmptyTextVisual->SetOpacity(KHighlightOpacity); + mData->mEmptyTextOpacity = KHighlightOpacity; + } + HandleSizeChangeOnMain(); + + } + else + { + ShowHideVisualsForEmptyText(true); + if( mData->mEmptyTextVisual && mData->mEmptyTextOpacity == 1 ) + { + mData->mEmptyTextVisual->SetOpacity(KBackGroundOpacity); + mData->mEmptyTextOpacity = KBackGroundOpacity; + } + } + } + +// --------------------------------------------------------------------------- +// HandleSizeChangeOnMain() +// --------------------------------------------------------------------------- +// +void MulBaseElement::HandleSizeChangeOnMain() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleSizeChangeOnMain"); + + IMulModelAccessor* model = ((MulCoverFlowControl*)&control())->ModelAccessor(); + CAlfLayout* main = (CAlfLayout*)findVisual( KMainLayoutIndex ); + TSize topLayoutSize = main->Size().Target().AsSize(); ; + + if( !model ) + { + if (topLayoutSize != TSize(0,0)) + { + SetDefaultSize(topLayoutSize); + } + else + { + SetDefaultSize( control().DisplayArea().Size() ); + } + + } + else + { + SetDefaultSize(topLayoutSize); + } + } + +// --------------------------------------------------------------------------- +// IsEmptyText +// --------------------------------------------------------------------------- +// +bool MulBaseElement::IsEmptyText() + { + return !(mData->mEmptyText.isEmpty()); + } +// --------------------------------------------------------------------------- +// ShowHideVisualsForEmptyText +// --------------------------------------------------------------------------- +// +void MulBaseElement::ShowHideVisualsForEmptyText( bool aShow ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowHideVisualsForEmptyText"); + + if( !aShow ) + { + SetTextVisualOpacity( KBackGroundOpacity ); + SetCounterTextOpacity( KBackGroundOpacity); + } + else + { + if(mData->mTextVisible) + { + SetTextVisualOpacity( KHighlightOpacity ); + } + // if ui on off template is enabled then reset the counter + // opacity depending on the current ui on/off value + if( Template2D()->IsUiOnOffFlagEnabled() ) + { + ResetUiOnOff(); + } + else + { + SetCounterTextOpacity( KHighlightOpacity); + } + } + } + +// --------------------------------------------------------------------------- +// CreateEmptyTextVisualisation +// --------------------------------------------------------------------------- +// +void MulBaseElement::CreateEmptyTextVisualisation() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateEmptyTextVisualisation"); + + if( !mData->mEmptyTextVisual ) + { + THROW_IF_LEAVES + ( + CAlfLayout* main = static_cast(findVisual( KMainLayoutIndex )); + mData->mEmptyTextVisual = CAlfTextVisual::AddNewL(control(),main); + + TBuf desc; + + MulModelUtility::ConvertUStringToTDes(mData->mEmptyText, desc); + mData->mEmptyTextVisual->SetTextL(desc); + mData->mEmptyTextVisual->SetTagL(KEmptyText); + mData->mEmptyTextVisual->SetWrapping(CAlfTextVisual::ELineWrapBreak); + + TInt fontId =control().Env().TextStyleManager() + .CreatePlatformTextStyleL(EAknLogicalFontSecondaryFont,-1); + // check if user has set any different color for text. + if (mData->mTextColor.mIsColorSet) + { + // apply the color set by the application + mData->mEmptyTextVisual->SetColor(mData->mTextColor.mColor); + } + else + { + // apply the default color + mData->mEmptyTextVisual->SetColor(KRgbWhite); + } + + mData->mEmptyTextVisual->SetLineSpacing(KTextRowsz); + mData->mEmptyTextVisual->SetTextStyle(fontId); + mData->mEmptyTextVisual->SetFlag(EAlfVisualFlagIgnorePointer); + ); + + } + } + + + +// --------------------------------------------------------------------------- +// DisplayIndicatorIcon +// --------------------------------------------------------------------------- +// +void MulBaseElement::DisplayIndicatorIcon(const MulVisualItem & aVisualItem, int aIndex) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::DisplayIndicatorIcon"); + CAlfDeckLayout& layout = static_cast(mData->mIconFlowLayout->Visual(aIndex)); + CAlfImageVisual* visual =static_cast(layout.FindTag(KCoverflowIndicator)); + IMulVariantType* varData = aVisualItem.Attribute(mulvisualitem::KMulIndicator2); + + if(varData) + { + if(!visual) + { + visual = CreateIndicatorIconVisual(layout); + } + ((MulCoverFlowControl*)&control())->DoSetImage(varData,visual); + visual->ClearFlag(EAlfVisualFlagIgnorePointer); + } + + else if(visual) + { + CAlfTextureManager& textureMgr = control().Env().TextureManager(); + TAlfImage image = TAlfImage(textureMgr.BlankTexture()); + visual->SetImage(image); + visual->SetFlag(EAlfVisualFlagIgnorePointer); + } + + } + +// --------------------------------------------------------------------------- +// CreateIndicatorIconVisual +// --------------------------------------------------------------------------- +// +CAlfImageVisual* MulBaseElement::CreateIndicatorIconVisual(CAlfDeckLayout& aLayout) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateIndicatorIconVisual"); + CAlfImageVisual* indicatorVisual = CAlfImageVisual::AddNewL(control(), &aLayout); + indicatorVisual->SetTagL(KCoverflowIndicator); + SetIndicatorDimensions(*indicatorVisual); + indicatorVisual->SetScaleMode(CAlfImageVisual::EScaleNormal); + + return indicatorVisual; + } + +// --------------------------------------------------------------------------- +// SetIndicatorDimensions +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetIndicatorDimensions(CAlfImageVisual& aIndicatorVisual) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetIndicatorDimensions"); + TMulCoverFlowItem indicatorDimensions = Template2D()->IndicatorDimension(); + aIndicatorVisual.SetPos(TAlfRealPoint(indicatorDimensions.posx,indicatorDimensions.posy)); + aIndicatorVisual.SetSize(TAlfRealSize(indicatorDimensions.width ,indicatorDimensions.height)); + } + +// --------------------------------------------------------------------------- +// StoreVisualDimensions +// --------------------------------------------------------------------------- +// +void MulBaseElement::StoreVisualDimensions( TMulCoverFlowItem aHighlightItemDimensions, TMulCoverFlowItem aNonHighlightItemDimensions,int aVisibleIconCount ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StoreVisualDimensions"); + mData->mHighlightItemStruct = aHighlightItemDimensions; + mData->mItemStruct = aNonHighlightItemDimensions; + mData->mVisibleCount = aVisibleIconCount; + ((MulCoverFlowControl*)&control())->StoreVisibleItemCount(mData->mVisibleCount); + if (mData->mVisibleCount > 1) + { + mData->mChangeSize = true; + } + else + { + mData->mChangeSize = false; + } + } + +// --------------------------------------------------------------------------- +// StoreTextVisibility +// --------------------------------------------------------------------------- +// +void MulBaseElement::StoreTextVisibility( bool aIsTextVisible ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StoreTextVisibility"); + mData->mTextVisible = aIsTextVisible; + } + + +// --------------------------------------------------------------------------- +// IsTextVisibile +// --------------------------------------------------------------------------- +// +bool MulBaseElement::IsTextVisibile( )const + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::IsTextVisible"); + return mData->mTextVisible ; + } + + +// --------------------------------------------------------------------------- +// OrientationChange +// --------------------------------------------------------------------------- +// +void MulBaseElement::OrientationChange() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::OrientationChange"); + + mData->mVerticalFlow->SetOpacity(0); + if (mData->mDummyVisual) + { + // deleting since the textextents being zero. + mData->mDummyVisual->RemoveAndDestroyAllD(); + mData->mDummyVisual = NULL; + } + + // update the attribute of visuals + Template2D()->CreateVisualisation(((MulCoverFlowControl*)&control())->IsLandscape(),true); + + CalculatePadding(); + CreateAndInitializeVisuals(true); + + // Redraw the visuals after orientation changes + int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount(); + if( totalModelCount == 0 ) + { + CAlfLayout* main = (CAlfLayout*)findVisual( KMainLayoutIndex ); + SetDefaultSize(main->Size().ValueNow().AsSize()); + } + ArrangeItems(); + SetNewCounterPosition(Template2D()->CounterDimensions(),true); + UpdateRotation(); + mData->mVerticalFlow->SetOpacity(1); + } + + +//------------------Counter and Text related---------------------------------- + +// --------------------------------------------------------------------------- +// CreateCounterVisual +// --------------------------------------------------------------------------- +// +CAlfTextVisual& MulBaseElement::CounterVisual() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CounterVisual"); + __MUL_ASSERT( mData->mVerticalFlow != 0,KNullPointer); + + mData->mCounterVisual = &CreateTextVisual(KCoverflowCounter,*mData->mVerticalFlow); + mData->mCounterVisual->SetAlign(EAlfAlignHCenter,EAlfAlignVCenter); + return *mData->mCounterVisual; + } + +// --------------------------------------------------------------------------- +// CreateVisual +// --------------------------------------------------------------------------- +// +CAlfTextVisual& MulBaseElement::CreateTextVisual(const TDesC8& aName, + CAlfLayout& aLayout) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateTextVisual"); + + CAlfTextVisual* textVisual =static_cast(aLayout.FindTag(aName)); + + if(textVisual == NULL) + { + THROW_IF_LEAVES + ( + textVisual = CAlfTextVisual::AddNewL( (CAlfControl &)control(),&aLayout); + textVisual->SetTagL(aName); + ); + textVisual->SetFlag(EAlfVisualFlagIgnorePointer); + textVisual->SetFlag(EAlfVisualFlagClipping); + } + return *textVisual; + } + + +// --------------------------------------------------------------------------- +// UpdateTextAndCounter +// --------------------------------------------------------------------------- +// +void MulBaseElement::UpdateTextAndCounter(int animationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateTextAndCounter"); + + UpdateTextValue(animationTime); + + //After highlight is changed then the counter text should be updated + SetCounterText(); + } + +// --------------------------------------------------------------------------- +// SetCounterTextOpacity +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetCounterTextOpacity( int aOpacity) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetCounterTextOpacity"); + if(mData->mCounterVisual) + { + mData->mCounterVisual->SetOpacity( aOpacity ); + } + } + + +// --------------------------------------------------------------------------- +// ResetUiOnOff +// --------------------------------------------------------------------------- +// +void MulBaseElement::ResetUiOnOff(int aTransitionTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ResetUiOnOff"); + + int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount(); + if(mData->mCounterVisual && Template2D() && Template2D()->IsUiOnOffFlagEnabled() && totalModelCount>0 ) + { + int opacity = mData->mUiOn? KHighlightOpacity: KBackGroundOpacity; + mData->mCounterVisual->SetOpacity( TAlfTimedValue(opacity,aTransitionTime) ); + // Every time In template4 Ui on off mode toggles we should set the enable holding flag + // to gesture helper to recieve the hold events. + ((MulCoverFlowControl*)&control())->SetHoldingEnabled(); + } + } + +// --------------------------------------------------------------------------- +// UIOnOffMode +// --------------------------------------------------------------------------- +// +void MulBaseElement::UIOnOffMode(bool aUiOn, int aTransitionTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UIOnOffMode"); + + mData->mUiOn = aUiOn; + ResetUiOnOff( aTransitionTime ); + } + +// --------------------------------------------------------------------------- +// IsUiOnMode +// --------------------------------------------------------------------------- +// +bool MulBaseElement::IsUiOnMode() + { + return mData->mUiOn; + } + + +// --------------------------------------------------------------------------- +// SetTextVisualOpacity +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetTextVisualOpacity( int aOpacity , int aTransitionTime ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetTextVisualOpacity"); + if(mData->mTextLayout) + { + mData->mTextLayout->SetOpacity(TAlfTimedValue (aOpacity,aTransitionTime)); + } + } + +// --------------------------------------------------------------------------- +// UpdateTextValue +// --------------------------------------------------------------------------- +// +void MulBaseElement::UpdateTextValue(int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::UpdateTextValue"); + if( !mData->mTextVisible ) + { + return; + } + + IMulModelAccessor* modelAccessor = ((MulCoverFlowControl*)&control())->ModelAccessor(); + int highlightindex = static_cast(&control())->HighlightIndex(); + + if(highlightindex>=0 ) + { + //set text to title + try + { + const MulVisualItem& item = modelAccessor->Item(highlightindex); + IMulVariantType* varData = item.Attribute(mulvisualitem::KMulTitle); + MUL_LOG_INFO("MUL::UpdateTextValue::UpdateTiltle"); + SetTextToVisual( mulvisualitem::KMulTitle, varData ); + + // SetVirtualSize if required. + SetVirtualViewPortSize(mulvisualitem::KMulTitle); + } + catch(...) + { + IMulVariantType* varData = NULL; + SetTextToVisual( mulvisualitem::KMulTitle, varData ); + } + + //set text to detail + try + { + const MulVisualItem& item = modelAccessor->Item(highlightindex); + IMulVariantType* varData = item.Attribute(mulvisualitem::KMulDetail); + MUL_LOG_INFO("MUL::UpdateTextValue::UpdateDetail"); + SetTextToVisual( mulvisualitem::KMulDetail, varData ); + + // SetVirtualSize if required. + SetVirtualViewPortSize(mulvisualitem::KMulDetail); + } + catch(...) + { + IMulVariantType* varData = NULL; + SetTextToVisual( mulvisualitem::KMulDetail,varData ); + } + + // Cancel if any command is in process before start marquee. + CancelAllCommands(); + + // Before orientaion change stop marquee on the text + if(!((static_cast(control())).IsFastScrollMode())) + { + control().Env().Send( + TAlfCustomEventCommand(ECustomEventMarqueeStart, + &control()), KMarqueeTime1000 + aAnimationTime); + + } + } + } +// --------------------------------------------------------------------------- +// SetTextToVisual +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetTextToVisual( mulvisualitem::TVisualAttribute aName,IMulVariantType* aText ) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::SetTextToVisual"); + + if(mData->mTextLayout) + { + CAlfTextVisual* textVisual = + static_cast (mData->mTextLayout->FindTag( IdToTag(aName) )); + + if(textVisual) + { + if ( aText ) + { + // set text to visual + THROW_IF_LEAVES + ( + MUL_LOG_INFO("MUL::SetTextToVisual::Set New Data"); + textVisual->SetTextL(aText->DesC()); + textVisual->SetWrapping(CAlfTextVisual::ELineWrapTruncate); + ); + // A workaround till the text visual starts giving the correct text extents value. + if(!mData->mDummyVisual) + { + mData->mDummyVisual = CAlfTextVisual::AddNewL(control(), NULL); + mData->mDummyVisual->SetWrapping(CAlfTextVisual::ELineWrapManual); + mData->mDummyVisual->SetOpacity(0); + mData->mDummyVisual->SetFlags(EAlfVisualFlagIgnorePointer); + } + + // Setting the style same as our text visual. + mData->mDummyVisual->SetTextStyle(textVisual->TextStyle()); + mData->mDummyVisual->SetTextL(aText->DesC()); // Setting the text + + if(aName == mulvisualitem::KMulDetail) + { + mData->mDetailExt = mData->mDummyVisual->TextExtents(); + } + else + { + mData->mTitleExt = mData->mDummyVisual->TextExtents(); + } + } + else + { + // reset to null value . + THROW_IF_LEAVES + ( + textVisual->SetTextL(_L("")); + ); + } + } + else + { + mData->mTextLayout->SetOpacity(TAlfTimedValue(KBackGroundOpacity,0)); + } + } + } + +// --------------------------------------------------------------------------- +// SetVirtualViewPortSize() +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetVirtualViewPortSize(mulvisualitem::TVisualAttribute aName) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::SetVirtualViewPortSize"); + CAlfViewportLayout* viewportLayout = NULL ; + CAlfTextVisual* text = NULL ; + TSize textExtent ; + TSize parentSize; + if (aName == mulvisualitem::KMulDetail) + { + viewportLayout = static_cast( + mData->mTextLayout->FindTag(KDetailViewPortLayout)); + if(!viewportLayout) + { + return; // return if no viewport + } + textExtent = mData->mDetailExt; + parentSize = Template2D()->DetailWindowSize(); + + } + else + { + viewportLayout = static_cast( + mData->mTextLayout->FindTag(KTitleViewPortLayout)); + if(!viewportLayout) + { + return; // return if no viewport + } + textExtent = mData->mTitleExt; + parentSize = Template2D()->TitleWindowSize(); + + } + text = static_cast( + viewportLayout->FindTag( IdToTag(aName) )); + if(!text) + { + return; // if text visual is not found we will not set viewportsize. + } + + viewportLayout->SetViewportPos((TAlfRealPoint(0, 0)), 0); + viewportLayout->SetVirtualSize( + (TAlfRealPoint(parentSize.iWidth, parentSize.iHeight)),0); + + //Tollerance is 15 pixel, it might happen that + // the text is big but while wrapping it not filling the whole + // width of the layout because the remaining space is less to + // accomodate a character. + // As for QFN_PRIMARY the max character width is 15 pixel + // so I am keeping tollerance as 15 + // @TODO: Insted of hard coding to 15 pixel use max charecter + // width for QFN_PRIMARY. + if ((parentSize.iWidth - textExtent.iWidth) > 15) + { + text->SetAlign(EAlfAlignHCenter, EAlfAlignVCenter); + } + else + { + text->SetAlign(EAlfAlignHLocale,EAlfAlignVCenter); + } + } + +// --------------------------------------------------------------------------- +// StartMarquee() +// --------------------------------------------------------------------------- +// +void MulBaseElement::StartMarquee(mulvisualitem::TVisualAttribute aName) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::StartMarquee"); + // start marquee. + int widthOffScreen = 0; + CAlfViewportLayout* viewportLayout = NULL ; + CAlfTextVisual* text = NULL ; + TSize textExtent ; + TSize parentSize; + int maxCharWidth ; + if (aName == mulvisualitem::KMulDetail) + { + viewportLayout =static_cast( + mData->mTextLayout->FindTag(KDetailViewPortLayout)); + if(!viewportLayout) + { + return;// return if no viewport + } + textExtent = mData->mDetailExt; + parentSize = Template2D()->DetailWindowSize(); + maxCharWidth = Template2D()->DetailMaxCharWidth(); + } + else + { + viewportLayout = static_cast( + mData->mTextLayout->FindTag(KTitleViewPortLayout)); + if(!viewportLayout) + { + return;// return if no viewport + } + textExtent = mData->mTitleExt; + parentSize = Template2D()->TitleWindowSize(); + maxCharWidth = Template2D()->TitleMaxCharWidth(); + } + text = static_cast( + viewportLayout->FindTag( IdToTag(aName) )); + if(!text) + { + return; // if no text. + } + + text->SetWrapping(CAlfTextVisual::ELineWrapManual); + + widthOffScreen= textExtent.iWidth - parentSize.iWidth; + int nDbMaxChars = (widthOffScreen/(2*maxCharWidth)) + 1; + + // Schedule a update event, when the visual has finished marquee text scrolling. + if (aName == mulvisualitem::KMulDetail) + { + if (nDbMaxChars > 0 ) + { + viewportLayout->SetVirtualSize( + (TAlfRealPoint(textExtent.iWidth, parentSize.iHeight)),0); + // to avoid negative time value + mData->mMarqueeAnimTime = (nDbMaxChars*KMarqueeTime1000); + viewportLayout->SetViewportPos((TAlfRealPoint(widthOffScreen , 0)), + nDbMaxChars * KMarqueeTime1000); + // delay after completion of the marquee for titlte. + mData->mMarqueeAnimTime += KMarqueeTime1000; + control().Env().Send( + TAlfCustomEventCommand(ECustomEventMarqueeFinished, + static_cast(&(control()))), + mData->mMarqueeAnimTime); + } + } + else + { + // reset the marquee animation time + mData->mMarqueeAnimTime = 0; + if(nDbMaxChars > 0) + { + viewportLayout->SetVirtualSize( + (TAlfRealPoint(textExtent.iWidth, parentSize.iHeight)),0); + + // to avoid negative time value + mData->mMarqueeAnimTime = (nDbMaxChars*KMarqueeTime1000); + viewportLayout->SetViewportPos((TAlfRealPoint(widthOffScreen , 0)), + nDbMaxChars * KMarqueeTime1000); + // delay after completion of the marquee for titlte. + mData->mMarqueeAnimTime += KMarqueeTime1000; + control().Env().Send( + TAlfCustomEventCommand(ECustomEventTitleMarqueeFinished, + static_cast(&(control()))), + mData->mMarqueeAnimTime ); + // delay before start the marquee for detail. + mData->mMarqueeAnimTime += KMarqueeTime1000; + } + control().Env().Send( + TAlfCustomEventCommand(ECustomEventDetailMarqueeStart, + (&(control()))), mData->mMarqueeAnimTime ); + } + } + +// --------------------------------------------------------------------------- +// StopMarquee() +// --------------------------------------------------------------------------- +// +void MulBaseElement::StopMarquee(mulvisualitem::TVisualAttribute aName) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::StopMarquee"); + CAlfViewportLayout* viewPortLayout = NULL; + CAlfTextVisual* text = NULL; + TSize parentSize; + if (aName == mulvisualitem::KMulDetail) + { + viewPortLayout = + static_cast(mData->mTextLayout->FindTag(KDetailViewPortLayout)); + parentSize = Template2D()->DetailWindowSize(); + } + else + { + viewPortLayout = + static_cast(mData->mTextLayout->FindTag(KTitleViewPortLayout)); + parentSize = Template2D()->TitleWindowSize(); + } + if(!viewPortLayout) + { + return; + } + text = static_cast(viewPortLayout->FindTag( IdToTag(aName) )); + if(!text) + { + return; + } + const TDesC textDesc = text->Text(); + if(!textDesc.Length()) + { + return; + } + + viewPortLayout->SetViewportPos((TAlfRealPoint(0, 0)), 0); + viewPortLayout->SetVirtualSize((TAlfRealPoint(parentSize.iWidth, parentSize.iHeight)),0); + text->SetWrapping(CAlfTextVisual::ELineWrapTruncate); + + } + +// --------------------------------------------------------------------------- +// CancelAllCommands +// --------------------------------------------------------------------------- +// +void MulBaseElement::CancelAllCommands( ) + { + MUL_LOG_ENTRY_EXIT("Mul::MulBaseElement::CancelAllCommands"); + CAlfWidgetControl * cntrl = &control(); + control().Env().CancelCustomCommands( cntrl, ECustomEventMarqueeFinished); + control().Env().CancelCustomCommands( cntrl, ECustomEventMarqueeStart); + control().Env().CancelCustomCommands( cntrl, ECustomEventTitleMarqueeFinished); + control().Env().CancelCustomCommands( cntrl, ECustomEventDetailMarqueeStart); + } + +// --------------------------------------------------------------------------- +// SetCounterText +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetCounterText( int /*aTransitionTime*/ ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetCounterText"); + + if( mData->mCounterVisual ) + { + SetNewCounterPosition(Template2D()->CounterDimensions()); + int totalModelCount = ((MulCoverFlowControl*)&control())->TotalModelCount(); + int currHighlightIndex = ((MulCoverFlowControl*)&control())->HighlightIndex(); + + // this code will work for model count upto 99999. + // done for performance improvement , no need to calculate + // no of digits in highlight index and total model count. + auto_ptr countbuffer(HBufC::NewL (12)); + + //settin value for counter text visual + /// @bug critical:avanhata:7/7/2008 in arabic/hebrew the text should flow + /// from right to left (totalCount / highlight) => the string format needs + /// to come from a resource file, and use stringloader (and arabic indic number + /// conversion if stringloader does not do it automatically) + countbuffer->Des().AppendNum(currHighlightIndex+1); + countbuffer->Des().Append(KSlash); + countbuffer->Des().AppendNum(totalModelCount); + + mData->mCounterVisual->SetTextL(*countbuffer); + } + } + +//-------------------------------------------------------------------------- +// SetNewCounterPosition +//-------------------------------------------------------------------------- +// +void MulBaseElement::SetNewCounterPosition( const TMulCoverFlowItem& aCounterLctDimension, bool aOrientationChanged) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetNewCounterPosition"); + MulCoverFlowControl* coverflowControl = ((MulCoverFlowControl*)&control()); + int totalModelCount = coverflowControl->TotalModelCount(); + int currHighlightIndex = coverflowControl->HighlightIndex(); + bool isLandScape = static_cast(control()).IsLandscape(); + + if( totalModelCount > 0 && currHighlightIndex >= 0 ) + { + int numOfDigits = NumberOfDigits(totalModelCount); + numOfDigits += NumberOfDigits(currHighlightIndex); + + if( mData->mNumOfDigitsInCounter!= numOfDigits || aOrientationChanged ) + { + mData->mNumOfDigitsInCounter = numOfDigits; + int maxCharWidth = coverflowControl->Template2D()->CounterMaxCharWidth(); + int numOfPixels = numOfDigits*maxCharWidth + 20; // 10 is the tolerance. + + int rightPosx =0; + int leftPosx = 0; + // if mirroring is enabled(ie for RTL Language) + if (mData->mIsMirrored) + { + + CAlfLayout* main = (CAlfLayout*)findVisual( KMainLayoutIndex ); + TSize topLayoutSize = main->Size().Target().AsSize(); + if(!isLandScape) + { + rightPosx = topLayoutSize.iWidth - aCounterLctDimension.posx ; + leftPosx = rightPosx - numOfPixels; + } + else + { + leftPosx = topLayoutSize.iWidth - aCounterLctDimension.posx ; + } + } + else + { + if(!isLandScape) + { + rightPosx = aCounterLctDimension.posx + aCounterLctDimension.width; + leftPosx = rightPosx - numOfPixels; + } + else + leftPosx = aCounterLctDimension.posx; + } + mData->mCounterVisual->SetPos(TAlfRealPoint(leftPosx,aCounterLctDimension.posy)); + mData->mCounterVisual->SetSize(TAlfRealPoint(numOfPixels ,aCounterLctDimension.height)); + } + } + } +// --------------------------------------------------------------------------- +// NumberOfDigits +// --------------------------------------------------------------------------- +// +int MulBaseElement::NumberOfDigits(int aNumber) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::NumberOfDigits"); + int num_digits = 0; + int number = aNumber; + do + { + num_digits++; + number/=10; + } + while ( number > 0 ); + + return num_digits; + } + +// --------------------------------------------------------------------------- +// ApplyScaleMode +// --------------------------------------------------------------------------- +// +void MulBaseElement::ApplyScaleMode( CAlfImageVisual& aImageVisual) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ApplyScaleMode"); + CAlfImageVisual::TScaleMode scaleMode; + + if (mData->mFitMode) + { + if(aImageVisual.Image().HasTexture()) + { + CAlfTexture* texture = const_cast(&aImageVisual.Image().Texture()); + TInt imageWidth = texture->Size().iWidth; + TInt imageHeight = texture->Size().iHeight; + // when animation is not complete sizes will not be correct. + // so sizes are taken from template + if(imageWidth == 0 || imageHeight == 0) + { + scaleMode = CAlfImageVisual::EScaleFitInside; + } + else if( imageWidth <= mData->mHighlightItemStruct.width && + imageHeight <= mData->mHighlightItemStruct.height ) + { + scaleMode = CAlfImageVisual::EScaleNormal; + } + else + { + scaleMode = CAlfImageVisual::EScaleFitInside; + } + } + else + { + scaleMode = CAlfImageVisual::EScaleFitInside; + } + } + else + { + // Apply default scale mode + scaleMode = CAlfImageVisual::EScaleFitInside; + } + + if (aImageVisual.ScaleMode() != scaleMode) + { + aImageVisual.SetScaleMode( scaleMode ); + } + ApplyBrushOnIcon( aImageVisual ); + } + +// --------------------------------------------------------------------------- +// ApplyBrushOnIcon +// --------------------------------------------------------------------------- +// +void MulBaseElement::ApplyBrushOnIcon( CAlfImageVisual& aImageVisual ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ApplyBrushOnIcon"); + if( mData->mIconBgColor.mIsColorSet ) + { + aImageVisual.EnableBrushesL(ETrue); + CAlfBrushArray* brushArray = aImageVisual.Brushes(); + if( (brushArray->Count()==0)) + { + CAlfGradientBrush* brush = CAlfGradientBrush::NewL(aImageVisual.Env()); + brush->SetColor( mData->mIconBgColor.mColor ); + aImageVisual.Brushes()->AppendL( brush, EAlfHasOwnership ); + } + else + { + CAlfGradientBrush* brush = static_cast(&brushArray->At(0)); + if ( brush->Color(0) != mData->mIconBgColor.mColor ) + { + brush->SetColor( mData->mIconBgColor.mColor ); + } + } + } + } + +// --------------------------------------------------------------------------- +// RemoveBrushOnIcon +// --------------------------------------------------------------------------- +// +void MulBaseElement::RemoveBrushOnIcon( CAlfImageVisual& aImageVisual ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RemoveBrushOnIcon"); + CAlfBrushArray* brushArray = aImageVisual.Brushes(); + if(brushArray && (brushArray->Count()!=0)) + { + brushArray->Remove(0); + } + } + +// --------------------------------------------------------------------------- +// Template2D +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate* MulBaseElement::Template2D() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::Template2D"); + return ((MulCoverFlowControl*)&control())->Template2D(); + } + +// --------------------------------------------------------------------------- +// SetScrollAnimationTime +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetScrollAnimationTime( int aScrollAnimationTime ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetScrollAnimationTime"); + mData->mScrollAnimationTime = aScrollAnimationTime; + } + +// --------------------------------------------------------------------------- +// ArrangeItems +// --------------------------------------------------------------------------- +// +void MulBaseElement::ArrangeItems() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ArrangeItems"); + + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); + + int totalVisual = 2*mData->mVisibleCount + 1; + int highlightIndex = mData->mVisibleCount; + CAlfImageVisual* imageVisual = NULL; + + + int posX = mData->mHighlightItemStruct.posx - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding); + + TAlfRealPoint highlightItemSize(mData->mHighlightItemStruct.width, mData->mHighlightItemStruct.height); + TAlfRealPoint nonHighlightItemSize(mData->mItemStruct.width, mData->mItemStruct.height); + + for (int i=0; i < totalVisual ; i++) + { + CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i); + imageVisual = (CAlfImageVisual*)deckLayout.FindTag(KCoverflowIcon); + + if (i != highlightIndex) + { + deckLayout.SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy)); + deckLayout.SetSize(nonHighlightItemSize); + imageVisual->SetSize(nonHighlightItemSize); + posX = posX + mData->mItemStruct.width + mData->mPadding; + } + else + { + deckLayout.SetPos( TAlfRealPoint(mData->mHighlightItemStruct.posx,mData->mHighlightItemStruct.posy)); + deckLayout.SetSize(highlightItemSize); + imageVisual->SetSize(highlightItemSize); + posX = posX + mData->mHighlightItemStruct.width + mData->mPadding; + } + if (mData->mFitMode) + { + ApplyScaleMode(*imageVisual); + } + CAlfImageVisual* indicatorVisual =static_cast(deckLayout.FindTag(KCoverflowIndicator)); + if (indicatorVisual) + { + SetIndicatorDimensions(*indicatorVisual); + } + + } + + control().Env().BatchBufferHandler().FlushBatchBuffer(); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred); + + } + +// --------------------------------------------------------------------------- +// SetScrollDir +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetScrollDir( TItemScroll aScrollDir ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetScrollDir"); + mData->mScrollDir = aScrollDir; + } + +// --------------------------------------------------------------------------- +// SetScrollDir +// --------------------------------------------------------------------------- +// +TItemScroll MulBaseElement::ScrollDir() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ScrollDir"); + return mData->mScrollDir; + } + +// --------------------------------------------------------------------------- +// CalculatePadding +// --------------------------------------------------------------------------- +// +void MulBaseElement::CalculatePadding() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CalculatePadding"); + + // The vector has already been created when the template was set. + if( mData->mVisibleCount == 1) + { + if( mData->mHighlightItemStruct.posx > KInitialvalueZero ) + { + mData->mPadding = mData->mHighlightItemStruct.posx; + } + else + { + // full screen template ..photos + // padding between the highlight and non highlight item is considered to be 2 pixel for + // full screen template as only one visual is visible. + mData->mPadding = 2; + } + } + else + { + int startx = mData->mHighlightItemStruct.posx+ mData->mHighlightItemStruct.width; + mData->mPadding = mData->mItemStruct.posx - startx; + } + } + + +// --------------------------------------------------------------------------- +// GetIconSize +// --------------------------------------------------------------------------- +// +void MulBaseElement::GetIconSize( mulwidget::TLogicalTemplate aTemplateId, + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::GetIconSize"); + + bool isLandscape = ((MulCoverFlowControl*)&control())->IsLandscape(); + switch(aTemplateId) + { + case mulwidget::KTemplate1: + { + MulCoverFlowTemplate1::GetIconSize(aAttribute,isLandscape,aHeight,aWidth); + } + break; + case mulwidget::KTemplate4: + { + MulCoverFlowTemplate4::GetIconSize(aAttribute,isLandscape,aHeight,aWidth); + } + break; + default: + { + // Invalid template id + // raise exception + __MUL_ASSERT(false,KInvalidTemplate); + } + break; + } + } + + +// --------------------------------------------------------------------------- +// ShowWidget +// --------------------------------------------------------------------------- +// +void MulBaseElement::ShowWidget( bool aShow, int aTransitionTime ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowWidget"); + float opacity ; + CAlfLayout* main = (CAlfLayout*) findVisual( KMainLayoutIndex ); + + if( aShow ) + { + opacity = KHighlightOpacity; + } + else + { + opacity = KBackGroundOpacity; + } + main->SetOpacity(TAlfTimedValue(opacity,aTransitionTime)); + } + +// --------------------------------------------------------------------------- +// makeInterface +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulBaseElement::makeInterface( const IfId& aType ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::makeInterface"); + UString param(aType.mImplementationId); + + if(param == MulBaseElement::Type().mImplementationId ) + { + return static_cast(this); + } + else if(param == IAlfWidgetEventHandler::type().mImplementationId ) + { + return static_cast(this); + } + else + { + return AlfElement::makeInterface(aType); + } + } + +// --------------------------------------------------------------------------- +// setEventHandlerData +// --------------------------------------------------------------------------- +// +void MulBaseElement::setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + //No implementation required + } + +// --------------------------------------------------------------------------- +// eventHandlerData +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandlerInitData* MulBaseElement::eventHandlerData() + { + return NULL; + } + +// ---------------------------------------------------------------------------- +// eventHandlerType +// ---------------------------------------------------------------------------- +// + IAlfWidgetEventHandler::AlfEventHandlerType MulBaseElement::eventHandlerType() + { + return IAlfWidgetEventHandler::ELogicalEventHandler ; + } +// ---------------------------------------------------------------------------- +// eventExecutionPhase +// ---------------------------------------------------------------------------- +// + +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulBaseElement::eventExecutionPhase() + { + return EBubblingPhaseEventHandler; + } + +//------------------------Slider related Api's ------------------------- + +//-------------------------------------------------------------------------- +// UpdateSliderTick +//-------------------------------------------------------------------------- +// +void MulBaseElement::UpdateSliderTick(int aUpdateTick) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MulBaseElement"); + IMulSliderModel* mulSliderModel = ((MulCoverFlowControl*)&control())->GetSliderModel(); + if( mulSliderModel && Template2D()->IsSliderVisible() ) + { + // Creating a reference Visual Item + //@todo remove const from Data api in slider model + const MulVisualItem& item = mulSliderModel->Data(); + //auto_ptr tempItem( new (EMM) MulVisualItem()); + MulVisualItem* tempItem = const_cast (&item); + + tempItem->SetAttribute( mulvisualitem::KMulMaxRange, --aUpdateTick ); + tempItem->SetAttribute (mulvisualitem::KMulMinRange, 0); + tempItem->SetAttribute ( mulvisualitem::KMulTick,1); + + // Add the newly created visual item to the model + // Model takes the ownership of the visual item + mulSliderModel->SetData(*tempItem); + } + + // Set the opacity to the slider widget after verifyiny all the conditions. + SetSliderOpacity(); + } +//-------------------------------------------------------------------------- +// SetSliderOpacity +//-------------------------------------------------------------------------- +// +void MulBaseElement::SetSliderOpacity() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetSliderOpacity"); + + if (mData->mSliderLayout) + { + if ( Template2D()->IsSliderVisible() ) + { + if( static_cast(control()).TotalModelCount() > 1 && mData->mSliderOpacity == KBackGroundOpacity) + { + ShowSlider(true); + } + else if((static_cast(control()).TotalModelCount() <= 1) && mData->mSliderOpacity == KHighlightOpacity) + { + ShowSlider(false); + } + } + else if(mData->mSliderOpacity == KHighlightOpacity) + { + ShowSlider(false); + } + } + } + +//-------------------------------------------------------------------------- +//CreateSlider +//-------------------------------------------------------------------------- +// +void MulBaseElement::CreateSlider() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateSlider"); + if ( Template2D()->IsSliderVisible() ) + { + MulCoverFlowControl* coverflowControl = static_cast(&control()); + IAlfWidget* sliderwidget = coverflowControl->GetSliderWidget(); + if(!sliderwidget) + { + ConstructSliderWidget(); + } + + const TMulCoverFlowItem sliderStruct = Template2D()->SliderDimension(); + mData->mSliderLayout->SetPos(TAlfRealPoint(sliderStruct.posx,sliderStruct.posy)); + mData->mSliderLayout->SetSize(TAlfRealPoint(sliderStruct.width,sliderStruct.height)); + int totalModelCount = coverflowControl->TotalModelCount(); + if( totalModelCount > 1 ) + { + UpdateSliderTick(totalModelCount); + coverflowControl->SetSliderTickPosition(); + ShowSlider(true); + } + else + { + ShowSlider(false); + } + mData->mSliderLayout->UpdateChildrenLayout(); + } + else + { + if (!mData->mSliderLayout) + { + return; + } + ShowSlider(false); + } + } + +//-------------------------------------------------------------------------- +//ConstructSliderWidget +//-------------------------------------------------------------------------- +void MulBaseElement::ConstructSliderWidget() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ConstructSliderWidget"); + IAlfWidget* alfSliderWidget = ((MulCoverFlowControl*)&control())->CreateSliderWidget(); + IMulSliderWidget* mulSliderWidget = static_cast(alfSliderWidget); + mData->mSliderLayout = const_cast(&mulSliderWidget->ContainerLayout()); + mData->mVerticalFlow->Insert(mData->mSliderLayout, mData->mVerticalFlow->Count()); + } + + +//-------------------------------------------------------------------------- +//ShowSlider +//-------------------------------------------------------------------------- +void MulBaseElement::ShowSlider(bool aFlag) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::ShowSlider"); + if(mData->mSliderLayout) + { + IAlfWidget* alfSliderWidget = ((MulCoverFlowControl*)&control())->GetSliderWidget(); + IMulSliderWidget* mulSliderWidget = static_cast(alfSliderWidget); + mulSliderWidget->ShowWidget(aFlag); + if(aFlag) + { + mData->mSliderLayout->SetOpacity(TAlfTimedValue(KHighlightOpacity)); + mData->mSliderOpacity = KHighlightOpacity; + } + else + { + mData->mSliderLayout->SetOpacity(TAlfTimedValue(KBackGroundOpacity)); + mData->mSliderOpacity = KBackGroundOpacity; + } + } + } + + +//-------------------------------------------------------------------------- +// StartBounce +//-------------------------------------------------------------------------- +void MulBaseElement::StartBounce(int aBounceDirection) + { + int bounceDistance = (mData->mHighlightItemStruct.width/4) * aBounceDirection; + control().Env().Send(TAlfCustomEventCommand(ECustomEventBounceBack,&control()),KBounceTime); + StartDoodling(bounceDistance,KBounceTime); + } + + +// --------------------------------------------------------------------------- +// CalculateDistanceChangeFactor +// --------------------------------------------------------------------------- +// +int MulBaseElement::CalculateDistanceChangeFactor() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CalculateDistanceChangeFactor"); + + int firstVisualMidPoint = mData->mHighlightItemStruct.posx + (mData->mHighlightItemStruct.width/2); + int secVisualMidPoint = mData->mItemStruct.posx + (mData->mItemStruct.width/2); + + return Abs(secVisualMidPoint-firstVisualMidPoint); + } + + +// --------------------------------------------------------------------------- +// SetBackground +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetBackground(const TRgb& aColor) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetBackground"); + + CAlfLayout* main = static_cast(findVisual( KMainLayoutIndex )); + CAlfDeckLayout& deckLayout = static_cast (main->Visual(KMainLayoutIndex) ); + + CAlfVisual* oldVisual = deckLayout.FindTag(backgroundvisual); + if(oldVisual) + { + CAlfImageVisual* imageVisual = static_cast(oldVisual); + if(imageVisual->Image().HasTexture()) + { + const CAlfTexture& textureToUnload = imageVisual->Image().Texture(); + CAlfTextureManager& textureMgr = control().Env().TextureManager(); + textureMgr.UnloadTexture(textureToUnload.Id()); + } + + deckLayout.Remove( oldVisual ); + oldVisual->RemoveAndDestroyAllD(); + } + + deckLayout.EnableBrushesL( ETrue ); + CAlfBrushArray* brushArray = deckLayout.Brushes(); + if(brushArray) + { + if( brushArray->Count()!=0) + { + CAlfGradientBrush& brush = static_cast(brushArray->At(0)); + brush.SetColor( aColor ); + } + else + { + THROW_IF_LEAVES + ( + CAlfGradientBrush* brush = CAlfGradientBrush::NewL( control().Env() ); + // Set the brush colour + brush->SetColor( aColor ); + // Apply brush and set the opacity . + deckLayout.Brushes()->AppendL( brush, EAlfHasOwnership ); + ); + } + } + } + +// --------------------------------------------------------------------------- +// SetBackground +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetBackground(const TAknsItemID& aIID) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetBackground"); + + CAlfLayout* main = static_cast(findVisual( KMainLayoutIndex )); + CAlfDeckLayout& deckLayout = static_cast (main->Visual(KMainLayoutIndex) ); + + CAlfBrushArray* brushArray = deckLayout.Brushes(); + if(brushArray) + { + if( brushArray->Count()!=0) + { + brushArray->Reset(); + } + } + + TAlfRealSize layoutSize = deckLayout.Size().ValueNow(); + const TAlfImage image(aIID,TSize(layoutSize),EAspectRatioPreserved,NULL,-1,-1,0.f,0.f,1.f, + 1.f, TAlfTextureFlags(EAlfTextureFlagAutoSize | EAlfTextureFlagSkinContent), + KAlfAutoGeneratedTextureId,NULL); + + CAlfVisual* oldVisual = deckLayout.FindTag(backgroundvisual); + if(oldVisual) + { + CAlfImageVisual* imageVisual = static_cast(oldVisual); + if(imageVisual->Image().HasTexture()) + { + const CAlfTexture& textureToUnload = imageVisual->Image().Texture(); + CAlfTextureManager& textureMgr = control().Env().TextureManager(); + textureMgr.UnloadTexture(textureToUnload.Id()); + } + imageVisual->SetImage(image); + } + else + { + THROW_IF_LEAVES + ( + CAlfImageVisual* imagevisual(CAlfImageVisual::AddNewL((CAlfControl&)control(), &deckLayout)); + deckLayout.MoveVisualToBack(*imagevisual); + imagevisual->SetImage(image); + imagevisual->SetFlag(EAlfVisualFlagIgnorePointer); + imagevisual->SetPos(TPoint(0,0)); + imagevisual->SetSize(layoutSize); + imagevisual->SetOpacity( KHighlightOpacity ); + imagevisual->SetTagL( backgroundvisual ); + ); + } + } + +// --------------------------------------------------------------------------- +// SetItemBrush +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetItemBrush(const TRgb& aColor) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetItemBrush"); + mData->mIconBgColor.mIsColorSet = true; + mData->mIconBgColor.mColor = aColor; + + int itemCount = 2*mData->mVisibleCount + 1; + + itemCount = itemCount > mData->mIconFlowLayout->Count() ? mData->mIconFlowLayout->Count() : itemCount; + + for(int i =0 ;imIconFlowLayout->Visual( i ); + CAlfImageVisual* imageVisual = ( CAlfImageVisual* )visual.FindTag(KCoverflowIcon); + ApplyBrushOnIcon( *imageVisual); + } + } + + +// --------------------------------------------------------------------------- +// SetTextColor +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetTextColor(TTextVisualType aVisualType, const TRgb& aColor) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetTextColor"); + + switch(aVisualType) + { + case ECounterVisual: + { + // save the values set by the application + mData->mCounterColor.mIsColorSet = true; + mData->mCounterColor.mColor = aColor; + + // apply the property if the visuals are already created + if(mData->mCounterVisual) + { + mData->mCounterVisual->SetColor(aColor); + } + break; + } + case ETilteDetailTextVisual: + { + // save the values set by the application + mData->mTextColor.mIsColorSet = true; + mData->mTextColor.mColor = aColor; + + // apply the property if the visuals are already created + CAlfTextVisual* titleTextVisual =static_cast(mData->mTextLayout->FindTag(KCoverflowTitle)); + if(titleTextVisual) + { + titleTextVisual->SetColor(aColor); + } + CAlfViewportLayout* viewPortLayout =static_cast(mData->mTextLayout->FindTag(KDetailViewPortLayout)); + if(viewPortLayout) + { + CAlfTextVisual* detailTextVisual =static_cast(viewPortLayout->FindTag(KCoverflowDetail)); + if(detailTextVisual) + { + detailTextVisual->SetColor(aColor); + } + } + // Apply the same color for empty text also + if(mData->mEmptyTextVisual) + { + mData->mEmptyTextVisual->SetColor(aColor); + } + break; + } + default: + break; + } + } + +// --------------------------------------------------------------------------- +// TextColor +// --------------------------------------------------------------------------- +// +TMulVisualColorProperty MulBaseElement::TextColor(TTextVisualType aVisualType) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::TextColor"); + TMulVisualColorProperty colorProperty; + + switch(aVisualType) + { + case ECounterVisual: + { + colorProperty = mData->mCounterColor; + break; + } + case ETilteDetailTextVisual: + { + colorProperty = mData->mTextColor; + break; + } + default: + break; + } + return colorProperty; + } + +// --------------------------------------------------------------------------- +// FlowLayout +// --------------------------------------------------------------------------- +// +CAlfLayout& MulBaseElement::FlowLayout( int aLayoutIndex ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::FlowLayout"); + + return static_cast(mData->mVerticalFlow->Visual( aLayoutIndex )); + } + +// --------------------------------------------------------------------------- +// SetFitMode +// --------------------------------------------------------------------------- +// +void MulBaseElement::SetFitMode(bool aFlag) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetFitMode"); + mData->mFitMode = aFlag; + } + +// ---------------------------------------------------------------------------- +// CreateAndInitializeVisuals +// ---------------------------------------------------------------------------- +// +void MulBaseElement::CreateAndInitializeVisuals(bool aIsOrientationChange) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateAndInitializeVisuals"); + CreateVisuals(); + + // Specific to template 4 don't update the visuals + // during orientation change + // done for performance improvement. + if (!(aIsOrientationChange &&mData->mFitMode)) + { + UpdateVisuals(); + CreateSlider(); + } + + // For template 4 set model case + // cancel the rotation if any. + if (!aIsOrientationChange && mData->mFitMode) + { + if (mData->mRotation.mIsApplied) + { + if (mData->mRotation.mIndex >= 0) + { + CancelRotation(mData->mRotation.mIndex); + } + else + { + // rotation applied on highlight index. + // so cancel it. + mData->mRotation.mIndex = 1; + CancelRotation(mData->mRotation.mIndex); + } + } + } + } + +// ---------------------------------------------------------------------------- +// CreateVisuals +// ---------------------------------------------------------------------------- +// +void MulBaseElement::CreateVisuals() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateVisuals"); + int totalVisual = 2*mData->mVisibleCount + 1; + int visualIndex = 0; + + // if there are less visuals than required tehn create the extra visauls and + // set opacity 1 for already existing visuals + if(totalVisual > mData->mIconFlowLayout->Count()) + { + visualIndex = mData->mIconFlowLayout->Count(); + for(; visualIndex < totalVisual;visualIndex++) + { + CreateIconStructure(mData->mIconFlowLayout); + } + } + // if the number of visuals are more, then set opacity 0 for the extra visuals + else if (totalVisual < mData->mIconFlowLayout->Count()) + { + IMulModelAccessor* accessor = ((MulCoverFlowControl*)&control())->ModelAccessor(); + if(accessor) + { + if(accessor->CurrentItemCount() < totalVisual) + { + for(; visualIndex < totalVisual;visualIndex++) + { + CAlfVisual& visual = mData->mIconFlowLayout->Visual(visualIndex); + static_cast(control()).UpdateItemAtIndex(visualIndex); + } + } + + CAlfTextureManager& textureMgr = control().Env().TextureManager(); + TAlfImage image = TAlfImage(textureMgr.BlankTexture()); + // position those visuals to some other location. + int posX = mData->mHighlightItemStruct.posx + totalVisual * mData->mHighlightItemStruct.width; + for(; visualIndex < mData->mIconFlowLayout->Count();visualIndex++) + { + CAlfVisual& visual = mData->mIconFlowLayout->Visual(visualIndex); + visual.SetPos(TAlfRealPoint(posX,mData->mHighlightItemStruct.posy)); + CAlfImageVisual* imageVisual = static_cast(visual.FindTag(KCoverflowIcon)); + // remove the icon brush if any. + RemoveBrushOnIcon(*imageVisual); + imageVisual->SetImage(image); + CAlfImageVisual* indicatorVisual =static_cast(visual.FindTag(KCoverflowIndicator)); + if(indicatorVisual) + { + indicatorVisual->SetImage(image); + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// UpdateVisuals +// ---------------------------------------------------------------------------- +// +void MulBaseElement::UpdateVisuals() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateVisuals"); + int totalVisual = 2*mData->mVisibleCount + 1; + MulCoverFlowControl* coverflowControl = static_cast(&control()); + IMulModelAccessor* accessor = coverflowControl->ModelAccessor(); + if(accessor) + { + for(int i = 0; i < totalVisual; i++) + { + CAlfVisual& visual = mData->mIconFlowLayout->Visual(i); + coverflowControl->UpdateItemAtIndex(i); + } + } + } + +// ---------------------------------------------------------------------------- +// CreateIconStructure +// ---------------------------------------------------------------------------- +// +CAlfVisual* MulBaseElement::CreateIconStructure(CAlfLayout* aParentLayout) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CreateIconStructure"); + //create the deck layout. + CAlfDeckLayout* deck =CAlfDeckLayout::AddNewL((CAlfControl &)control(),aParentLayout); + CAlfImageVisual* imageVisual =CAlfImageVisual::AddNewL((CAlfControl &)control(),deck); + imageVisual->SetTagL(KCoverflowIcon); + deck->SetFlag( EAlfVisualFlagManualLayout ); + return deck; + } + + +// ---------------------------------------------------------------------------- +// SetHighlight +// This function is used to change the highlight by 1 with animation. +// This function also takes care whether we need to change the size or only the position. +// it takes into consideration the current direction and the current highlight index. +// The logic is , we are always keeping the highlight visual index fixed (its equal to +// the no of visible item in the screen), Depending on the scroll direction we reorder +// the last or first visual and then position all visuals keeping the highlight visual +// in its position. Then update the last or 1st visual with appropriate data. +// ---------------------------------------------------------------------------- +// +void MulBaseElement::SetHighlight(int /*aHighlightIndex*/, int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::SetHighlight"); + int totalVisual = 2*mData->mVisibleCount + 1; + int highlightIndex = mData->mVisibleCount; + CAlfVisual* deckLayout = NULL; + CAlfVisual* imageVisual = NULL; + + int highlightPosX = mData->mHighlightItemStruct.posx; + + if(mData->mScrollDir == EItemScrollLeft) + { + CancelRotation(totalVisual - 1); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); + deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(totalVisual - 1); + mData->mIconFlowLayout->Reorder(*deckLayout,0); + + int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding); + deckLayout->SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + for (int i=1; i < totalVisual ; i++) + { + deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(i); + imageVisual = deckLayout->FindTag(KCoverflowIcon); + if (i != highlightIndex) + { + deckLayout->SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + + // Change the size if required + if((i == highlightIndex+1 || i == highlightIndex-1) && mData->mChangeSize) + { + deckLayout->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + } + } + else + { + deckLayout->SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime)); + posX = posX + mData->mHighlightItemStruct.width + mData->mPadding; + + // Change the size if required + if(mData->mChangeSize) + { + deckLayout->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width, + mData->mHighlightItemStruct.height, + aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width, + mData->mHighlightItemStruct.height, + aAnimationTime)); + } + } + } + control().Env().BatchBufferHandler().FlushBatchBuffer(); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred); + ((MulCoverFlowControl*)&control())->UpdateItemAtIndex(0, aAnimationTime); + + } + else if (mData->mScrollDir == EItemScrollRight) + { + CancelRotation(0); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); + deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(0); + mData->mIconFlowLayout->Reorder(*deckLayout,totalVisual-1); + + int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding); + + for (int i=0; i < totalVisual-1 ; i++) + { + deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(i); + imageVisual = deckLayout->FindTag(KCoverflowIcon); + + if (i != highlightIndex) + { + deckLayout->SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + // Change the size if required + if((i == highlightIndex+1 || i == highlightIndex-1) && mData->mChangeSize) + { + deckLayout->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + } + } + else + { + deckLayout->SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime)); + posX = posX + mData->mHighlightItemStruct.width + mData->mPadding; + // Change the size if required + if(mData->mChangeSize) + { + deckLayout->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width, + mData->mHighlightItemStruct.height, + aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(mData->mHighlightItemStruct.width, + mData->mHighlightItemStruct.height, + aAnimationTime)); + } + } + } + deckLayout = (CAlfVisual*)&mData->mIconFlowLayout->Visual(totalVisual-1); + deckLayout->SetPos( TAlfRealPoint(posX,mData->mItemStruct.posy)); + control().Env().BatchBufferHandler().FlushBatchBuffer(); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred); + ((MulCoverFlowControl*)&control())->UpdateItemAtIndex(totalVisual-1, aAnimationTime); + } + + } + +// ---------------------------------------------------------------------------- +// StartDoodling +// This function is used in doodling case. it calls the appropriate function to +// handle doodling based on whether we have to only change the position or both +// position and size. +// ---------------------------------------------------------------------------- +// +void MulBaseElement::StartDoodling(int aDistance, int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StartDoodling"); + if (mData->mChangeSize) + { + MoveVisualsWithSizeChange(aDistance,aAnimationTime); + } + else + { + MoveVisuals(aDistance,aAnimationTime); + } + } + +// ---------------------------------------------------------------------------- +// StopDoodling +// it calls when we get a gestureunknown or to do a bounce back. +// it basically repositions the visuals based on current highlight. +// it simply calls a startdoodling function with 0 distance and with +// animation time if required. +// ---------------------------------------------------------------------------- +// +void MulBaseElement::StopDoodling(int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::StopDoodling"); + StartDoodling(0,aAnimationTime); + } + + +// ---------------------------------------------------------------------------- +// MoveVisuals +// This function is used in doodling when only position needs to be change, usefull +// in potrait where 1 visible item is in the screen. +// The logic is to change the position of all visuals by doodling distance. +// ---------------------------------------------------------------------------- +// +void MulBaseElement::MoveVisuals(int aDistance, int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MoveVisuals"); + CancelRotation(); + + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushOnlyForced); + int totalVisual = 2*mData->mVisibleCount + 1; + int highlightIndex = mData->mVisibleCount; + + int highlightPosX = mData->mHighlightItemStruct.posx; + + highlightPosX += aDistance; + + int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding); + for (int i=0; i < totalVisual ; i++) + { + CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i); + + if (i != mData->mVisibleCount) + { + deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + } + else + { + deckLayout.SetPos( TAlfTimedPoint(highlightPosX,mData->mHighlightItemStruct.posy,aAnimationTime)); + posX = posX + mData->mHighlightItemStruct.width + mData->mPadding; + } + } + control().Env().BatchBufferHandler().FlushBatchBuffer(); + control().Env().BatchBufferHandler().SetAutoFlushMode(EAlfAutoFlushDeferred); + } + +// ---------------------------------------------------------------------------- +// NumberOfSwipe +// ---------------------------------------------------------------------------- +// +TNumberofSwipes MulBaseElement::NumberOfSwipes() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::NumberOfSwipes"); + return mData->mNumSwipes; + } + +// ---------------------------------------------------------------------------- +// FinalSwipeDirection +// ---------------------------------------------------------------------------- +// +int MulBaseElement::FinalSwipeDirection(int aDistance, int aLastSwipeDirection) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::FinalSwipeDirection"); + + int NewHighlightPos = NearestPoint(FinalMidPoints(ReferenceMidPoints(),aDistance),aLastSwipeDirection); + + int scrollDir = EItemNoDirection; + mData->mNumSwipes = ESingleSwipe; + + // now depending on the new highlight position make a decission + // whether to double swipe or single swipe and in which direction. + if(mData->mVisibleCount == 1) + { + switch(NewHighlightPos) + { + case 0: + { + scrollDir = EItemScrollLeft; + } + break; + case 2: + { + scrollDir = EItemScrollRight; + } + break; + case 1: + default: + break; + } + } + else + { + switch(NewHighlightPos) + { + case 0: + { + mData->mNumSwipes = ETripleSwipe; // triple swipe + scrollDir = EItemScrollLeft; + } + break; + case 1: + { + mData->mNumSwipes = EDoubleSwipe; + scrollDir = EItemScrollLeft; + } + break; + case 2: + { + scrollDir = EItemScrollLeft; + } + break; + case 4: + { + scrollDir = EItemScrollRight; + } + break; + case 5: + { + mData->mNumSwipes = EDoubleSwipe; + scrollDir = EItemScrollRight; + } + break; + case 6: + { + mData->mNumSwipes = ETripleSwipe; // triple swipe + scrollDir = EItemScrollRight; + } + break; + case 3: + default: + break; + } + } + return scrollDir; + } + +// ---------------------------------------------------------------------------- +// NearestPoint +// ---------------------------------------------------------------------------- +// +int MulBaseElement::NearestPoint(std::vector aFinalMidPoints,int aLastSwipeDirection) + { + int referencePoint = mData->mHighlightItemStruct.posx + mData->mHighlightItemStruct.width/2; + int i = 0; + while(i < aFinalMidPoints.size()) + { + int temp = aFinalMidPoints[i]; + if(aFinalMidPoints[i] > referencePoint) + { + break; + } + i++; + } + + if(aLastSwipeDirection == EEventScrollLeft) + { + return --i; + } + return i; + } + +// ---------------------------------------------------------------------------- +// ReferenceMidPoints +// ---------------------------------------------------------------------------- +// +std::vector MulBaseElement::ReferenceMidPoints() + { + std::vector referenceMidPoints; + int highlightMidPoint = mData->mHighlightItemStruct.posx + mData->mHighlightItemStruct.width/2; + int differnce = mData->mHighlightItemStruct.width/2 + + mData->mPadding + mData->mItemStruct.width/2 ; + + int doubleDiff = mData->mPadding + mData->mItemStruct.width; + if(mData->mVisibleCount != 1) + { + referenceMidPoints.push_back(highlightMidPoint - (differnce + + 2 * doubleDiff)); + + referenceMidPoints.push_back(highlightMidPoint - (differnce + + doubleDiff)); + } + referenceMidPoints.push_back(highlightMidPoint - differnce); + referenceMidPoints.push_back(highlightMidPoint); + referenceMidPoints.push_back(highlightMidPoint + differnce); + + if(mData->mVisibleCount != 1) + { + referenceMidPoints.push_back(highlightMidPoint + (differnce + + 2 * doubleDiff)); + + referenceMidPoints.push_back(highlightMidPoint + (differnce + + doubleDiff)); + } + return referenceMidPoints; + } + +// ---------------------------------------------------------------------------- +// FinalMidPoints +// ---------------------------------------------------------------------------- +// +std::vector MulBaseElement::FinalMidPoints(std::vector aReferenceMidPoints,int aDistance) + { + std::vector newMidPoints; + for(int i = 0; i < aReferenceMidPoints.size(); i++) + { + newMidPoints.push_back(aReferenceMidPoints[i] + aDistance); + int temp = newMidPoints[i]; + } + return newMidPoints; + } + +// ---------------------------------------------------------------------------- +// MoveVisualsWithSizeChange +// This function used when during doodling size changes also required. +// ie in case of landscape and visible items are 3 during doodling position as well +// as size change requird. +// The basic logic is we are keeping a reference distance for a complete highlight +// change (that means the highlight becomes nonhighlight and vice versa). so at +// any point of time there will be only two visuals whose size needs to be change. +// one to grow and other to shrink. so we calculate the % of grow and shrink of +// visual keeping the doodling distance and reference distance into consideration. +// ---------------------------------------------------------------------------- +// +void MulBaseElement::MoveVisualsWithSizeChange(int aDistance, int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::MoveVisualsWithSizeChange"); + int totalVisual = 2*mData->mVisibleCount + 1; + int highlightIndex = mData->mVisibleCount; + CAlfVisual* imageVisual = NULL; + int visualIndexToShrink = -1; + int visualIndexToGrow = -1; + int updateSpecialIndex = -1; + int distancefactor = CalculateDistanceChangeFactor (); + + int highlightPosX = mData->mHighlightItemStruct.posx; + highlightPosX += aDistance; + + + if (Abs(aDistance) < distancefactor) + { + // user has doodled to change the highlight by 1.Single swipe. + if (aDistance < 0) + { + visualIndexToGrow = highlightIndex +1; + } + else if (aDistance > 0) + { + visualIndexToGrow = highlightIndex -1; + } + else + { + // for stop doodling case + visualIndexToGrow = highlightIndex - 1; + updateSpecialIndex = highlightIndex + 1; + } + visualIndexToShrink = highlightIndex; + } + else + { + // user has doodled to change the highlight by 2. Double swipe. + if (aDistance < 0) + { + visualIndexToShrink = highlightIndex +1; + visualIndexToGrow = highlightIndex +2; + aDistance +=distancefactor; + } + else + { + visualIndexToShrink = highlightIndex -1; + visualIndexToGrow = highlightIndex -2; + aDistance -=distancefactor; + } + } + int changeInPosY = (((mData->mItemStruct.posy - mData->mHighlightItemStruct.posy)*Abs(aDistance))/distancefactor); + int changeInWidth = (((mData->mHighlightItemStruct.width - mData->mItemStruct.width)*Abs(aDistance))/distancefactor); + int changeInHeight = (((mData->mHighlightItemStruct.height - mData->mItemStruct.height)*Abs(aDistance))/distancefactor); + + + int posX = highlightPosX - mData->mVisibleCount*(mData->mItemStruct.width + mData->mPadding); + for (int i=0; i < totalVisual && i < mData->mIconFlowLayout->Count(); i++) + { + CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(i); + if (i == visualIndexToShrink) + { + int posY = mData->mHighlightItemStruct.posy + changeInPosY; + int width =mData->mHighlightItemStruct.width - changeInWidth; + int height =mData->mHighlightItemStruct.height - changeInHeight; + deckLayout.SetPos( TAlfTimedPoint(posX,posY,aAnimationTime)); + imageVisual = deckLayout.FindTag(KCoverflowIcon); + deckLayout.SetSize(TAlfTimedPoint(width,height,aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(width,height,aAnimationTime)); + posX = posX + width + mData->mPadding; + } + else if (i == visualIndexToGrow) + { + int posY = mData->mItemStruct.posy - changeInPosY; + int width = mData->mItemStruct.width + changeInWidth; + int height = mData->mItemStruct.height + changeInHeight; + deckLayout.SetPos( TAlfTimedPoint(posX,posY,aAnimationTime)); + imageVisual = deckLayout.FindTag(KCoverflowIcon); + deckLayout.SetSize(TAlfTimedPoint(width,height,aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(width,height,aAnimationTime)); + posX = posX + width + mData->mPadding; + } + else if (i == updateSpecialIndex) + { + deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime)); + imageVisual = deckLayout.FindTag(KCoverflowIcon); + deckLayout.SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + imageVisual->SetSize(TAlfTimedPoint(mData->mItemStruct.width,mData->mItemStruct.height,aAnimationTime)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + } + else + { + deckLayout.SetPos( TAlfTimedPoint(posX,mData->mItemStruct.posy,aAnimationTime)); + posX = posX + mData->mItemStruct.width + mData->mPadding; + } + } + } + +// ---------------------------------------------------------------------------- +//RecycleIconVisuals +// ---------------------------------------------------------------------------- +// +void MulBaseElement::RecycleIconVisuals() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RecycleIconVisuals"); + CAlfTextureManager& textureMgr = control().Env().TextureManager(); + TAlfImage image = TAlfImage(textureMgr.BlankTexture()); + + for(int i=0; imIconFlowLayout->Count(); i++) + { + CAlfVisual& visual = mData->mIconFlowLayout->Visual(i); + CAlfImageVisual* imageVisual = static_cast(visual.FindTag(KCoverflowIcon)); + // remove the icon brush if any. + RemoveBrushOnIcon(*imageVisual); + imageVisual->SetImage(image); + + CAlfImageVisual* indicatorVisual =static_cast(visual.FindTag(KCoverflowIndicator)); + if(indicatorVisual) + { + indicatorVisual->SetImage(image); + } + } + // cancel the rotation if any. + if (mData->mRotation.mIsApplied) + { + if (mData->mRotation.mIndex >= 0) + { + CancelRotation(mData->mRotation.mIndex); + } + else + { + // rotation applied on highlight index. + // so cancel it. + mData->mRotation.mIndex = 1; + CancelRotation(mData->mRotation.mIndex); + } + } + } + +// ---------------------------------------------------------------------------- +//IdToTag +// ---------------------------------------------------------------------------- +// +const TDesC8& MulBaseElement::IdToTag( int aId ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::IdToTag"); + switch( aId ) + { + case mulvisualitem::KMulIcon1 : + { + return KCoverflowIcon; + } + case mulvisualitem::KMulTitle : + { + return KCoverflowTitle; + } + case mulvisualitem::KMulDetail : + { + return KCoverflowDetail; + } + case mulvisualitem::KMulIndicator2 : + { + return KCoverflowIndicator; + } + default: + { + return KInvalidID; + } + } + } + +// --------------------------------------------------------------------------- +// RemoveSliderFromLayout +// --------------------------------------------------------------------------- +// +void MulBaseElement::RemoveSliderFromLayout() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RemoveSliderFromLayout"); + IAlfWidget* slider = (static_cast(control())).GetSliderWidget(); + if(slider && slider->control()) + { + IMulSliderWidget* sliderwidget = static_cast(slider); + CAlfLayout* sliderContlyt = const_cast(sliderwidget->control()->ContainerLayout(NULL)); + mData->mVerticalFlow->Remove(sliderContlyt); + } + + } + +// --------------------------------------------------------------------------- +// RotateImage +// --------------------------------------------------------------------------- +// +void MulBaseElement::RotateImage(IMulWidget::TMulRotation aDirection,TSize aImageSize,int aAnimationTime,bool aAdjustSize) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::RotateImage"); + + __MUL_ASSERT( mData->mIconFlowLayout->Count() != 0,KNullPointer); + + if (Template2D()->IsUiOnOffFlagEnabled()) + { + CAlfVisual& visual = mData->mIconFlowLayout->Visual(1); + CAlfImageVisual* imageVisual = static_cast(visual.FindTag(KCoverflowIcon)); + + if (!aAdjustSize) + { + // Take care the case where rotation was + // applied to the previous highlight index + // cancel the rotation on that visual + CancelRotation(mData->mRotation.mIndex); + + switch(aDirection) + { + case IMulWidget::ERotateLeft: + { + mData->mRotation.mImageAngle = (mData->mRotation.mImageAngle + 90)%360; + imageVisual->EnableTransformationL(); + imageVisual->Transformation().Rotate(TAlfTimedValue(90,aAnimationTime)); + mData->mRotation.mIsApplied = true; + break; + } + case IMulWidget::ERotateRight: + { + mData->mRotation.mImageAngle = (mData->mRotation.mImageAngle - 90)%360; + imageVisual->EnableTransformationL(); + imageVisual->Transformation().Rotate(TAlfTimedValue(-90,aAnimationTime)); + mData->mRotation.mIsApplied = true; + break; + } + default: + break; + } + // store the actual texture size of image to be rotated. + mData->mRotation.mTextureSize = aImageSize; + } + + AdjustVisualSizeInRotation(imageVisual, aAnimationTime); + } + } + +// --------------------------------------------------------------------------- +// AdjustVisualSizeInRotation +// --------------------------------------------------------------------------- +// +void MulBaseElement::AdjustVisualSizeInRotation(CAlfImageVisual* aVisual,int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::AdjustVisualSizeInRotation"); + + bool isLandScape = static_cast(control()).IsLandscape(); + int shortEdge = !isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height; + + if( mData->mRotation.mTextureSize.iWidth <= shortEdge && mData->mRotation.mTextureSize.iHeight <= shortEdge) + { + return; + } + else + { + switch(Abs(mData->mRotation.mImageAngle)) + { + case 90: + case 270: + { + HandleRotationOnVerticalAxis(aVisual,aAnimationTime); + } + break; + case 0: + case 180: + { + HandleRotationOnHorizontalAxis(aVisual,aAnimationTime); + } + break; + default: + break; + } + } + } + +// --------------------------------------------------------------------------- +// HandleRotationOnVerticalAxis +// --------------------------------------------------------------------------- +// +void MulBaseElement::HandleRotationOnVerticalAxis(CAlfImageVisual* aVisual,int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleRotationOnVerticalAxis"); + + bool isLandScape = static_cast(control()).IsLandscape(); + int longEdge = isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height; + int shortEdge = !isLandScape ? mData->mHighlightItemStruct.width : mData->mHighlightItemStruct.height; + + if (isLandScape) + { + if(mData->mRotation.mTextureSize.iWidth > shortEdge) + { + // make the visual of shortEdge size and fit the image by width. + aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,0),aAnimationTime); + aVisual->SetSize(TAlfRealSize(shortEdge,shortEdge),aAnimationTime); + aVisual->SetScaleMode(CAlfImageVisual::EScaleFitWidth); + } + else + { + //imageHeight > shortEdge and imageWidth < shortEdge + if (mData->mRotation.mTextureSize.iHeight > longEdge) + { + aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,shortEdge/2 -longEdge/2),aAnimationTime); + aVisual->SetSize(TAlfRealSize(shortEdge,longEdge),aAnimationTime); + } + else + { + aVisual->SetPos(TAlfRealPoint(longEdge/2 - shortEdge/2,shortEdge/2 - mData->mRotation.mTextureSize.iHeight/2),aAnimationTime); + aVisual->SetSize(TAlfRealSize(shortEdge,mData->mRotation.mTextureSize.iHeight),aAnimationTime); + } + aVisual->SetScaleMode(CAlfImageVisual::EScaleFitHeight); + } + } + else + { + if(mData->mRotation.mTextureSize.iHeight > shortEdge) + { + // make the visual of shortEdge size and fit the image by height. + aVisual->SetPos(TAlfRealPoint(0,longEdge/2 - shortEdge/2),aAnimationTime); + aVisual->SetSize(TAlfRealSize(shortEdge,shortEdge),aAnimationTime); + aVisual->SetScaleMode(CAlfImageVisual::EScaleFitHeight); + } + else + { + //imageWidth > shortEdge and imageHeight < shortEdge + if (mData->mRotation.mTextureSize.iWidth > longEdge) + { + aVisual->SetPos(TAlfRealPoint(shortEdge/2 - longEdge/2,longEdge/2 - shortEdge/2),aAnimationTime); + aVisual->SetSize(TAlfRealSize(longEdge,shortEdge),aAnimationTime); + } + else + { + aVisual->SetPos(TAlfRealPoint(shortEdge/2 - mData->mRotation.mTextureSize.iWidth/2,longEdge/2 - shortEdge/2),aAnimationTime); + aVisual->SetSize(TAlfRealSize(mData->mRotation.mTextureSize.iWidth,shortEdge),aAnimationTime); + } + // @todo check if this effective height after fit by width can ever be more than + // the shorter edge. If yes then this fit mode should be chnged to fit inside(check this) + aVisual->SetScaleMode(CAlfImageVisual::EScaleFitWidth); + } + } + } + +// --------------------------------------------------------------------------- +// HandleRotationOnHorizontalAxis +// --------------------------------------------------------------------------- +// +void MulBaseElement::HandleRotationOnHorizontalAxis(CAlfImageVisual* aVisual,int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::HandleRotationOnHorizontalAxis"); + + aVisual->SetPos(TAlfRealPoint(0,0),aAnimationTime); + aVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height),aAnimationTime); + ApplyScaleMode(*aVisual); + } + +// --------------------------------------------------------------------------- +// CancelRotation +// --------------------------------------------------------------------------- +// +void MulBaseElement::CancelRotation(int aIndex) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CancelRotation"); + + if (mData->mRotation.mIsApplied) + { + if (mData->mRotation.mIndex >= 0) + { + // revert it back + mData->mRotation.mImageAngle = 0; + CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(mData->mRotation.mIndex); + CAlfImageVisual* imageVisual = static_cast(deckLayout.FindTag(KCoverflowIcon)); + imageVisual->EnableTransformationL(); + imageVisual->Transformation().LoadIdentity(); + // reset the rotation property + mData->mRotation.mIsApplied = false; + mData->mRotation.mIndex = -1; + imageVisual->SetPos(TAlfRealPoint(0,0)); + imageVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height)); + ApplyScaleMode(*imageVisual); + } + else + { + mData->mRotation.mIndex = aIndex; + } + } + } + +// --------------------------------------------------------------------------- +// CancelRotationOnUpdate +// --------------------------------------------------------------------------- +// +void MulBaseElement::CancelRotationOnUpdate(int aIndex) + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::CancelRotationOnUpdate"); + + if (mData->mRotation.mIsApplied) + { + if (mData->mRotation.mIndex < 0 || mData->mRotation.mIndex == aIndex) + { + // revert it back + mData->mRotation.mImageAngle = 0; + CAlfVisual& deckLayout = mData->mIconFlowLayout->Visual(aIndex); + CAlfImageVisual* imageVisual = static_cast(deckLayout.FindTag(KCoverflowIcon)); + imageVisual->EnableTransformationL(); + imageVisual->Transformation().LoadIdentity(); + // reset the rotation property + mData->mRotation.mIsApplied = false; + mData->mRotation.mIndex = -1; + imageVisual->SetPos(TAlfRealPoint(0,0)); + imageVisual->SetSize(TAlfRealSize(mData->mHighlightItemStruct.width,mData->mHighlightItemStruct.height)); + ApplyScaleMode(*imageVisual); + } + } + } + +// --------------------------------------------------------------------------- +// UpdateRotation +// --------------------------------------------------------------------------- +// +void MulBaseElement::UpdateRotation() + { + MUL_LOG_ENTRY_EXIT("aakash::MulBaseElement::UpdateRotation"); + + if (mData->mRotation.mIsApplied) + { + // rotation applied on the highlight item. + if (mData->mRotation.mIndex < 0) + { + RotateImage(IMulWidget::ERotateLeft,TSize(0,0),0,true); + } + } + } + + } //namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowao.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2007-2008 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: Active Object header for CoverFlow +* +*/ + +// Class Header +#include "mulcoverflowao.h" + +// Alf Headers +#include + +// Local Header +#include "mulcoverflowcontrol.h" +#include "mulbaseelement.h" +#include "mullog.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulCoverFlowAo +// --------------------------------------------------------------------------- +// +MulCoverFlowAo::MulCoverFlowAo( MulCoverFlowControl& aControl ) : CTimer( EPriorityNormal ), mControl(aControl) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::MulCoverFlowAo"); + ConstructL(); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowAo +// --------------------------------------------------------------------------- +// +MulCoverFlowAo::~MulCoverFlowAo() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::~MulCoverFlowAo"); + StopTimer(); + } + +// --------------------------------------------------------------------------- +// StartMoving +// --------------------------------------------------------------------------- +// +void MulCoverFlowAo::StartMoving(TReal32 aSpeedPoint, int aCurrGestureDirection,bool aFastScrollForKey,int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::StartMoving"); + int previosDir = mCurrGestureDirection; + mCurrGestureDirection = aCurrGestureDirection; + + aSpeedPoint = aSpeedPoint < 0 ? aSpeedPoint * -1 : aSpeedPoint; + + // Fast scroll in key event , + // Three steps are there Max(100),150,200(Min). + if (aFastScrollForKey) + { + mTransitionTime = aAnimationTime; + } + else + { + mTransitionTime = 200 *(1 + (1 - aSpeedPoint)*5); + } + + if( !mStarted ) + { + // Cancle any pending requests and start a new request + // this is because the layout direction n speed should be changed according to the current swipe + if( IsActive() ) + { + MUL_LOG_INFO("MUL::MulCF::Cancel Previous Animation "); + Cancel(); + } + + MUL_LOG_INFO("MUL::MulCF::Start New Animation "); + mStarted = true; + After(0); + } + else + { + if (previosDir != mCurrGestureDirection) + { + mTransitionTime = 200; + Cancel(); + After(0); + } + else + { + } + } + + } + +// --------------------------------------------------------------------------- +// StopMoving +// --------------------------------------------------------------------------- +// +void MulCoverFlowAo::StopMoving() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::StopMoving"); + StopTimer(); + mCurrGestureDirection = 0; + mTransitionTime = 0; + mWaitingTime = 0; + mStarted = false; + } + +// --------------------------------------------------------------------------- +// StopTimer +// --------------------------------------------------------------------------- +// +void MulCoverFlowAo::StopTimer() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::StopTimer"); + if( IsActive() ) + { + Cancel(); + } + } +// --------------------------------------------------------------------------- +// RunL +// --------------------------------------------------------------------------- +// +void MulCoverFlowAo::RunL() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::RunL"); + // Check if the layout ahs moved by one complete visaul. + // Then change the highlight and again start moving the layout. + // If it hasnot moved by complete visaul then allow the layout to move to new position but + // dont change the highlight + ChangeHighLight(); + After(fabs(mTransitionTime*600)); + } + +// --------------------------------------------------------------------------- +// ChangeHighLight +// --------------------------------------------------------------------------- +// +void MulCoverFlowAo::ChangeHighLight() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowAo::ChangeHighLight"); + // Inform widget/model that highlight has changed + if(mCurrGestureDirection > 0 ) + { + mControl.HandleNavigationEvent ( EEventScrollLeft ); + } + else if(mCurrGestureDirection < 0 ) + { + mControl.HandleNavigationEvent ( EEventScrollRight ); + } + else + { + // no need to change the highlight + } + } + +// --------------------------------------------------------------------------- +// FastScrollTransitionTime +// --------------------------------------------------------------------------- +// +int MulCoverFlowAo::FastScrollTransitionTime() + { + return mTransitionTime; + } + + } // End of namespace . + +//End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowcontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,2263 @@ +/* +* Copyright (c) 2007-2008 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: Widget Control Implementation + * +*/ + + +// Include Files + +// Class Headers +#include "mulcoverflowcontrol.h" + +#include +// Alf Headers +#include +// for dosetimage func +#include +#include +#include +#include //for resource pooling +#include //for resource pooling +#include +#include + +// Mul Headers +#include +#include + + +// Gesture Helper +#include + +// Local Headers +#include "mulbaseelement.h" +#include "mulcoverflowao.h" +#include "mulcoverflowtemplate.h" +#include "mulcoverflowwidget.h" +#include "mulleave.h" //for leaving function +#include "mullog.h" //for logs +#include "mulassert.h" +#include "imulmodelaccessor.h" + +//Gesture Helper +using namespace GestureHelper; + +namespace Alf + { + +struct TMulCoverFlowControlImpl + { + TMulCoverFlowControlImpl() + { + mHighlightIndex = -1; + mScreenWidth = 0; + mScreenHeight = 0; + mGestureSpeed = 0; + mCoverFlow2DTemplate = NULL; + mIsWidgetVisible = true; //by default widget is visible . + mBaseElement = NULL; + mFastScroll = false; + mNumVisibleItem = 0; + mDefaultTextureId = -1; + mBounceInProgress = false; + mDirectionChanged = false; + mDontBounce = false; + mNumberOfRepeatEvents = 0; + mIsMirrored = false; + } + + /// @bug critical:avanhata:4/7/2008 you should never cache a property that is a property of + /// another class. The model exists to own this type of information. I gave this review comment + /// as "critical", since it is exactly these cached member variables that will + /// yield most of bugs and complexity. Refactor it away. + int mHighlightIndex; + + int mScreenWidth; + int mScreenHeight; + bool mIsWidgetVisible; + MulBaseElement* mBaseElement; + auto_ptr mCoverFlow2DTemplate; // 2D cover flow template //owns + TReal32 mGestureSpeed; + bool mFastScroll; // Flag to indicate wheher in fast scroll mode or not + int mNumVisibleItem; + int mDefaultTextureId; + bool mBounceInProgress; + int mReferencePoint; + bool mDirectionChanged; + int mCurrGestureDir; + bool mDontBounce; + int mNumberOfRepeatEvents; + bool mIsLandscape; + bool mIsMirrored; + }; + +// --------------------------------------------------------------------------- +// MulCoverFlowControl +// --------------------------------------------------------------------------- +// +MulCoverFlowControl::MulCoverFlowControl(CAlfEnv& aEnv ) + { + //Call the base class method + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::MulCoverFlowControl"); + CAlfWidgetControl::construct ( aEnv); + + mData.reset( new (EMM)TMulCoverFlowControlImpl ); + + mFeedback = MTouchFeedback::Instance(); + + if (AknLayoutUtils::LayoutMirrored()) + { + mData->mIsMirrored = true; + } + else + { + mData->mIsMirrored = false; + } + + mData->mIsLandscape = IsLandscape(); + + THROW_IF_LEAVES + ( + /// @bug critical:avanhata:30/9/2008 this is a symbian code section. don't call throwing osn code here. + /// Throwing within a TRAP is at best undefined + mCoverFlowAo.reset( new(EMM) MulCoverFlowAo( *this ) ); + + mHelper.reset(GestureHelper::CGestureHelper::NewL( *this )); + mHelper->InitAlfredPointerCaptureL( aEnv, aEnv.PrimaryDisplay(), KGroupId ); + mHelper->SetHoldingEnabled( EFalse ); + ) + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowControl +// --------------------------------------------------------------------------- +// +MulCoverFlowControl::~MulCoverFlowControl() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::~MulCoverFlowControl"); + + if( ModelAccessor() != NULL ) + { + ModelAccessor()->RemoveModelObserver(this); + } + + DestroySlider(); + + } + +// --------------------------------------------------------------------------- +// makeInterface +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulCoverFlowControl::makeInterface( const IfId& aType ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::makeInterface"); + UString param(aType.mImplementationId); + return CAlfWidgetControl::makeInterface( aType ); + } + +// --------------------------------------------------------------------------- +// ResetShowWidgetFlag +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::ResetShowWidgetFlag( bool aNewResetValue ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ResetShowWidgetFlag"); + mData->mIsWidgetVisible = aNewResetValue; + if( aNewResetValue) + { + mHelper->AddObserver(this); + } + } + +// --------------------------------------------------------------------------- +// Template2D +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate* MulCoverFlowControl::Template2D() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::Template2D"); + return mData->mCoverFlow2DTemplate.get(); + } + +// --------------------------------------------------------------------------- +// IsFastScrollMode +// --------------------------------------------------------------------------- +// +bool MulCoverFlowControl::IsFastScrollMode() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::IsFastScrollMode"); + return mData->mFastScroll; + } + + +//-----------------------Event Handling API's ------------------------------- +// --------------------------------------------------------------------------- +// handleEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulCoverFlowControl::handleEvent(const TAlfEvent& aEvent) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::handleEvent"); + if( aEvent.IsCustomEvent() ) + { + return HandleCustomEvent( aEvent ); + } + else if( aEvent.IsKeyEvent() && mData->mIsWidgetVisible ) + { + if(TotalModelCount() <= KMinNumItemForFastScroll || + aEvent.KeyEvent().iRepeats == 0 ) + { + return HandleKeyEvent( aEvent ); + } + else + { + return HandleRepeatKeyEvent( aEvent ); + } + } + else if( aEvent.IsPointerEvent() && mData->mIsWidgetVisible ) + { + MUL_LOG_INFO("MUL::MulCoverFlowControl: handleEvent ::pointer event"); + //commented as gives warning in armv5 + //THROW_IF_LEAVES + //( + TBool result = mHelper->OfferEventL(aEvent); + MUL_LOG_INFO1("MUL::MulCoverFlowControl: handleEvent::result %d ",result); + return result ? EEventConsumed :EEventNotHandled ; + // ) + } + return EEventNotHandled; + } +// --------------------------------------------------------------------------- +// HandleCustomEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulCoverFlowControl::HandleCustomEvent( const TAlfEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleCustomEvent"); + AlfEventStatus eventConsumed = EEventNotHandled; + switch( aEvent.CustomParameter() ) + { + case ECustomEventBounceBack: + { + MUL_LOG_INFO("MUL::MulCF:Handle custom event Compensate Bounce"); + mFeedback->InstantFeedback(ETouchFeedbackBasic); + mData->mBaseElement->StopDoodling(/*3*KBounceTime*/500); + if ((TotalModelCount() > 1 && mData->mNumVisibleItem == 1) || + (TotalModelCount() > 2)) + { + Env().Send(TAlfCustomEventCommand(ECustomEventScroll, this),500/*3*KBounceTime*/ + 30); + } + else + { + //start marquee in case of text is visible. + if(mData->mBaseElement->IsTextVisibile()) + { + //start marquee after 1 sec (after doodle completed) + Env().Send(TAlfCustomEventCommand( + ECustomEventMarqueeStart, this),500/*3*KBounceTime*/ + KMarqueeTime1000); + } + // if only one item is there then no need to scroll. + mData->mBounceInProgress = false; + } + eventConsumed = EEventConsumed; + break; + } + case ECustomEventScroll: + { + MUL_LOG_INFO("MUL::MulCF:Handle custom event Compensate Bounce"); + Env().Send(TAlfCustomEventCommand(ECustomEventBounceCompleted,this),600); + + if (mData->mHighlightIndex == 0) + { + DoSetFocusIndex(TotalModelCount() -1,/*4*KBounceTime*/800); + } + else + { + DoSetFocusIndex(0,800); + } + SetSliderTickPosition(); + eventConsumed = EEventConsumed; + break; + } + case ECustomEventBounceCompleted: + { + mData->mBounceInProgress = false; + eventConsumed = EEventConsumed; + break; + } + case ECustomEventMarqueeStart: + { + mData->mBaseElement->StartMarquee(mulvisualitem::KMulTitle); + eventConsumed = EEventConsumed; + break; + } + case ECustomEventTitleMarqueeFinished: + { + mData->mBaseElement->StopMarquee(mulvisualitem::KMulTitle); + eventConsumed = EEventConsumed; + break; + } + case ECustomEventDetailMarqueeStart: + { + mData->mBaseElement->StartMarquee(mulvisualitem::KMulDetail); + eventConsumed = EEventConsumed; + break; + } + case ECustomEventMarqueeFinished: + { + mData->mBaseElement->StopMarquee(mulvisualitem::KMulDetail); + eventConsumed = EEventConsumed; + break; + } + default: break; + } + return eventConsumed; + } + +// --------------------------------------------------------------------------- +// HandleKeyEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulCoverFlowControl::HandleKeyEvent( const TAlfEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleKeyEvent"); + AlfEventStatus eventConsumed = EEventNotHandled; + if( aEvent.Code() == EEventKey) + { + switch ( aEvent.KeyEvent().iCode ) + { + case EKeyEnter: + // Event when selection key is pressed .( key event ) + case EKeyDeviceA: + case EKeyDevice3: + { + if(aEvent.KeyEvent().iRepeats == 0) + { + if(TotalModelCount() <= 0 && mData->mBaseElement->IsEmptyText() ) + { + SetSelection(mData->mHighlightIndex); + eventConsumed = EEventConsumed; + } + else if( TotalModelCount() > 0 ) + { + SetSelection(mData->mHighlightIndex); + eventConsumed = EEventConsumed; + } + break; + } + } + case EKeyRightArrow: + { + // Send event to inform that the Right Key is pressed + if (mData->mIsMirrored) + { + HandleNavigationEvent ( EEventScrollLeft ); + } + else + { + HandleNavigationEvent ( EEventScrollRight ); + } + eventConsumed = EEventConsumed; + break; + } + + case EKeyLeftArrow: + { + // Send event to inform that the Left Key is pressed + if (mData->mIsMirrored) + { + HandleNavigationEvent ( EEventScrollRight ); + } + else + { + HandleNavigationEvent ( EEventScrollLeft ); + } + eventConsumed = EEventConsumed; + break; + } + case EKeyBackspace: + //case EKeyDelete: + { + CAlfWidgetControl::processEvent( TAlfEvent( ETypeRemove,mData->mHighlightIndex)); + eventConsumed = EEventConsumed; + break; + } + default: + { + break; + } + } + } + + else if(aEvent.Code() == EEventKeyUp) + { + mData->mNumberOfRepeatEvents = 0; + switch ( aEvent.KeyEvent().iScanCode ) + { + case EStdKeyRightArrow: + case EStdKeyLeftArrow: + { + if(mData->mFastScroll) + { + HandleEnhancedStop(); + eventConsumed = EEventConsumed; + } + break; + } + default: + { + break; + } + } + } + + return eventConsumed; + } + +// --------------------------------------------------------------------------- +// HandleRepeatKeyEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulCoverFlowControl::HandleRepeatKeyEvent( const TAlfEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleHoldGestureEvents"); + + AlfEventStatus eventConsumed = EEventNotHandled; + if( aEvent.Code() == EEventKey) + { + switch ( aEvent.KeyEvent().iCode ) + { + case EKeyRightArrow: + { + if (mData->mIsMirrored) + { + HandleFastScrollWithKeyEvents(1); + } + else + { + HandleFastScrollWithKeyEvents(-1); + } + eventConsumed = EEventConsumed; + break; + } + + case EKeyLeftArrow: + { + if (mData->mIsMirrored) + { + HandleFastScrollWithKeyEvents(-1); + } + else + { + HandleFastScrollWithKeyEvents(1); + } + eventConsumed = EEventConsumed; + break; + } + default: + { + break; + } + } + } + return eventConsumed; + } + +// --------------------------------------------------------------------------- +// HandleFastScrollWithKeyEvents +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleFastScrollWithKeyEvents(int aDirection) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleFastScrollWithKeyEvents"); + mData->mNumberOfRepeatEvents++; + if(mData->mNumberOfRepeatEvents == 1 ) + { + CAlfWidgetControl::processEvent( TAlfEvent( ETypeFastScroll,EScrollStart )); + mData->mFastScroll = true; + mCoverFlowAo->StartMoving(1, aDirection,true,200); + } + else if(mData->mNumberOfRepeatEvents == KNumberOfRepeatsForMediumSpeed && mData->mFastScroll ) + { + mCoverFlowAo->StartMoving(1, aDirection,true,150); + } + else if(mData->mNumberOfRepeatEvents == KNumberOfRepeatsForFastSpeed && mData->mFastScroll ) + { + mCoverFlowAo->StartMoving(1, aDirection,true,100); + } + } + +// --------------------------------------------------------------------------- +// HandleNavigationEvent +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleNavigationEvent( int aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleNavigationEvent"); + + // During bounce ignore all the events + if (mData->mBounceInProgress) + { + return; + } + + int highlightIndex = mData->mHighlightIndex; + int totalcount = TotalModelCount(); + if(totalcount <= 0 && highlightIndex == -1 ) + { + return; + } + //stop marquee if the navigation is happening. + if(mData->mBaseElement->IsTextVisibile()) + { + mData->mBaseElement->StopMarquee(mulvisualitem::KMulTitle); + mData->mBaseElement->StopMarquee(mulvisualitem::KMulDetail); + } + Env().CancelCustomCommands(this); + + //Update the highlight index + switch( aEvent ) + { + case EEventScrollRight: + { + // boundary check + if( highlightIndex == totalcount - 1 ) + { + if( !mData->mBounceInProgress && !mData->mDontBounce) + { + mData->mBounceInProgress = true; + mData->mBaseElement->StartBounce(KBounceRight); + } + else + { + mData->mBounceInProgress = false; + mData->mDontBounce = false; + highlightIndex = 0; + } + } + else + { + highlightIndex++; + } + + mData->mBaseElement->SetScrollDir(EItemScrollRight); + } + break; + + case EEventScrollLeft: + { + //boundary check + if( highlightIndex == 0 ) + { + if( !mData->mBounceInProgress && !mData->mDontBounce) + { + mData->mBounceInProgress = true; + mData->mBaseElement->StartBounce(KBounceLeft); + } + else + { + mData->mBounceInProgress = false; + mData->mDontBounce = false; + highlightIndex = totalcount - 1; + } + } + else + { + highlightIndex--; + } + } + mData->mBaseElement->SetScrollDir(EItemScrollLeft); + break; + } + + // to handle bounce checks + if( !mData->mBounceInProgress ) + { + DoSetFocusIndex( highlightIndex ); + SetSliderTickPosition(); + } + } +// --------------------------------------------------------------------------- +// SendEventToBaseElement +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SendEventToBaseElement( const TAlfEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SendEventToBaseElement"); + mData->mBaseElement->offerEvent( *this, aEvent); + } + +//----------------------------Highlight and Selection API's ----------------- + +// --------------------------------------------------------------------------- +// SetHighlightIndex +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetHighlightIndex( int aIndex, bool aUpdateSlider) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetHighlightIndex"); + // Throw Out of Bound Exception if index is negative + __MUL_ASSERT (aIndex > -1 && aIndex < TotalModelCount(), KOutOfBound); + //set the highlight in model + if(aIndex > mData->mHighlightIndex) + { + mData->mBaseElement->SetScrollDir(EItemScrollRight); + } + else + { + mData->mBaseElement->SetScrollDir(EItemScrollLeft); + } + DoSetFocusIndex( aIndex ); + if (aUpdateSlider) + { + SetSliderTickPosition(); + } + } +// --------------------------------------------------------------------------- +// DoSetFocusIndex +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::DoSetFocusIndex( int aNewIndex, int aAnimationTime ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::DoSetFocusIndex"); + + if(aNewIndex < 0 ) + { + return; + } + + int oldindex = mData->mHighlightIndex; + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + if( oldindex == aNewIndex ) + { + accessor->SetHighlight( aNewIndex ); + + // When one item case to cancel the drag effect + mData->mBaseElement->StopDoodling(200); + return; + } + // handling of cancelling bounce in 2 items case + if(TotalModelCount() == 2) + { + if((mData->mBaseElement->ScrollDir() == EItemScrollRight && aNewIndex == 1 && oldindex == 2)|| + (mData->mBaseElement->ScrollDir() == EItemScrollLeft && aNewIndex == 2 && oldindex == 1)) + { + mData->mBaseElement->StopDoodling(200); + return; + } + } + + accessor->SetHighlight( aNewIndex ); + accessor->ScrollWindow( WindowTop(aNewIndex) ); + + // Set the new focused item + mData->mHighlightIndex = aNewIndex; + + // Throw Out of Bound Exception if index is negative + __MUL_ASSERT( mData->mHighlightIndex > -1 , KOutOfBound ); + mData->mBaseElement->offerEvent(*this,TAlfEvent(ETypeHighlight,aAnimationTime)); + + if( mData->mIsWidgetVisible ) + { + // If the widget is in hidden mode no event will be sent to the application/client + CAlfWidgetControl::processEvent( TAlfEvent( ETypeHighlight,mData->mHighlightIndex)); + } + } + } + +// ---------------------------------------------------------------------------- +// SetSelection +// ---------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetSelection(int aHighlight) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetSelection"); + CAlfWidgetControl::processEvent ( TAlfEvent ( ETypeSelect, aHighlight)); + } + +// --------------------------------------------------------------------------- +// HighlightIndex +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::HighlightIndex() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HighlightIndex"); + return mData->mHighlightIndex; + } + +// --------------------------------------------------------------------------- +// SetSliderTickPosition +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetSliderTickPosition( ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetSliderTickPosition"); + if (mData->mCoverFlow2DTemplate->IsSliderVisible()) + { + IMulSliderModel* mulSliderModel = GetSliderModel(); + if( mulSliderModel && mData->mHighlightIndex >= KInitialvalueZero ) + { + mulSliderModel->SetPrimaryValue( mData->mHighlightIndex ); + } + } + } + +//----------------------Model Change Related API's---------------------------- +// ---------------------------------------------------------------------------- +// ModelStateChanged +// ---------------------------------------------------------------------------- +// +void MulCoverFlowControl::ModelStateChanged( TMulChangedState aState, IMulVariantType& aData ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ModelStateChanged"); + switch( aState ) + { + case EItemUpdated: + { + int index = aData.integer(); + if(TotalModelCount() < 2*mData->mNumVisibleItem+1) + { + HandleLessItemsUpdate(index); + } + else + { + int relativeIndex = 0; + if (IsIndexInVisibleWindow(index, relativeIndex)) + { + UpdateCoverflowItem(index,relativeIndex); + mData->mBaseElement->CancelRotationOnUpdate(relativeIndex); + } + } + break; + } + case EHighlightChanged: + { + if (mData->mHighlightIndex != aData.integer()) + { + mData->mHighlightIndex = aData.integer(); + IMulModelAccessor* accessor = static_cast(widget()->model()); + if( mData->mHighlightIndex == 0 ) + { + mData->mBaseElement->ShowEmptyText(false); + } + if( mData->mHighlightIndex >= 0) + { + // the same things have to be done for highlight>0 and highlight = 0 + // the only diff is at highlight 0 dont show empty text + accessor->ScrollWindow(WindowTop(mData->mHighlightIndex)); + mData->mBaseElement->UpdateVisuals(); + mData->mBaseElement->SetCounterText(); + SetSliderTickPosition(); + } + else + { + // remove the visualisation and hide counter. + mData->mBaseElement->RecycleIconVisuals(); + mData->mBaseElement->ShowEmptyText( true ); + } + } + break; + } + case EItemsInserted: + { + HandleModelCountChange(); + break; + } + case EItemsRemoved: + { + HandleModelCountChange(); + CAlfWidgetControl::processEvent( TAlfEvent( ETypeItemRemoved )); + break; + } + + } + } + +// --------------------------------------------------------------------------- +// HandleLessItemsUpdate +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleLessItemsUpdate(int aIndex) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleLessItemsUpdate"); + + int highlight = mData->mHighlightIndex; + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + highlight = accessor->Highlight(); + } + + if(aIndex == highlight) + { + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem); + if(mData->mNumVisibleItem != 1 && TotalModelCount() == 3) + { + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem + 3); + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem - 3); + } + } + else + { + // fulscreen tempalte and 2d in portrait + if(mData->mNumVisibleItem == 1) + { + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem+1); + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem-1); + } + else + { + // 2d template landscape mode + if(TotalModelCount() == 2) + { + UpdateCoverflowItem(aIndex,mData->mNumVisibleItem+(aIndex - highlight)); + } + else + { + int relativeIndex = (aIndex - highlight) + mData->mNumVisibleItem; + if(relativeIndex >= 0 && relativeIndex < 2*mData->mNumVisibleItem+1) + { + UpdateCoverflowItem(aIndex,relativeIndex); + } + relativeIndex = relativeIndex + TotalModelCount(); + if(relativeIndex >= 0 && relativeIndex < 2*mData->mNumVisibleItem+1) + { + UpdateCoverflowItem(aIndex,relativeIndex); + } + + relativeIndex = mData->mNumVisibleItem - (TotalModelCount() - aIndex + highlight); + if(relativeIndex >= 0 && relativeIndex < 2*mData->mNumVisibleItem+1) + { + UpdateCoverflowItem(aIndex,relativeIndex); + } + relativeIndex = relativeIndex - TotalModelCount(); + if(relativeIndex >= 0 && relativeIndex < 2*mData->mNumVisibleItem+1) + { + UpdateCoverflowItem(aIndex,relativeIndex); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// IsIndexInVisibleWindow +// --------------------------------------------------------------------------- +// +bool MulCoverFlowControl::IsIndexInVisibleWindow(const int aIndex, int& aRelativeIndex) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::IsIndexInVisibleWindow"); + + int totalVisual = TotalModelCount(); + int noOfVisuals = mData->mNumVisibleItem; + int highlightRelativeIndex = mData->mNumVisibleItem; + int highlight = mData->mHighlightIndex; + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + highlight = accessor->Highlight(); + } + + int leftIndex = highlight - noOfVisuals; + int rightIndex = highlight + noOfVisuals; + + if (leftIndex >= 0) + { + if ((aIndex <= highlight) && (aIndex >= leftIndex)) + { + aRelativeIndex = highlightRelativeIndex - (highlight - aIndex); + return true; + } + } + else + { + if (aIndex <= highlight) + { + aRelativeIndex = highlightRelativeIndex - (highlight - aIndex); + return true; + } + else + { + leftIndex = totalVisual + leftIndex ; + if (aIndex >= leftIndex) + { + aRelativeIndex = highlightRelativeIndex - noOfVisuals + (aIndex - leftIndex); + return true; + } + } + } + + if (rightIndex < totalVisual) + { + if ((aIndex >= highlight) && (aIndex <= rightIndex)) + { + aRelativeIndex = highlightRelativeIndex + (aIndex - highlight); + return true; + } + } + else + { + if (aIndex >= highlight) + { + aRelativeIndex = highlightRelativeIndex + (aIndex - highlight); + return true; + } + rightIndex = rightIndex - totalVisual; + if (aIndex <= rightIndex) + { + aRelativeIndex = highlightRelativeIndex + noOfVisuals - (rightIndex - aIndex); + return true; + } + } + + return false; + } + + +// --------------------------------------------------------------------------- +// RelativeToAbsolute +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::RelativeToAbsolute(const int aRelativeIndex) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::RelativeToAbsolute"); + int highlightRelativeIndex = mData->mNumVisibleItem; + int absolute = -1; + int totalVisuals = TotalModelCount(); + + int highlight = mData->mHighlightIndex; + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + highlight = accessor->Highlight(); + } + + if(totalVisuals <= 0) + { + // absolute index is always -1, so no need of any calculations + } + else if(totalVisuals < 2*mData->mNumVisibleItem + 1) + { + if(aRelativeIndex == highlightRelativeIndex) + { + absolute = highlight; + } + else + { + if(mData->mNumVisibleItem == 1) + { + if (totalVisuals == 1) + { + absolute = -1; + } + else if(totalVisuals == 2) + { + absolute = highlight + 1; + absolute = absolute >= totalVisuals ? 0 : absolute; + } + } + else + { + if (totalVisuals == 1) + { + absolute = -1; + } + else if(totalVisuals == 2) + { + absolute = highlight + (aRelativeIndex - highlightRelativeIndex); + absolute = absolute >= totalVisuals ? -1 : absolute; + } + else // totalvisuals > 3 + { + if(aRelativeIndex - highlightRelativeIndex > 0) + { + absolute = highlight + aRelativeIndex - highlightRelativeIndex; + } + else + { + absolute = highlight + aRelativeIndex - highlightRelativeIndex + + TotalModelCount(); + } + absolute = absolute >= totalVisuals ? absolute - totalVisuals : absolute; + } + } + } + } + else + { + if(aRelativeIndex == highlightRelativeIndex) + { + absolute = highlight; + } + else if (aRelativeIndex > highlightRelativeIndex) + { + absolute = highlight + (aRelativeIndex - highlightRelativeIndex); + absolute = absolute >= totalVisuals ? (absolute - totalVisuals) : absolute; + } + else + { + absolute = highlight - (highlightRelativeIndex - aRelativeIndex); + absolute = absolute <0 ? (totalVisuals + absolute) : absolute; + absolute = absolute > totalVisuals - 1 ? -1 : absolute; + } + } + return absolute; + } + + +// --------------------------------------------------------------------------- +// TotalModelCount +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::TotalModelCount() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::TotalModelCount"); + + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + return accessor->CurrentItemCount(); + } + return -1; + } + +// --------------------------------------------------------------------------- +// HandleModelCountChange +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleModelCountChange() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleModelCountChange"); + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + if(TotalModelCount() < (2*mData->mNumVisibleItem + 1)) + { + mData->mBaseElement->UpdateVisuals(); + } + mData->mBaseElement->UpdateSliderTick( TotalModelCount() ); + mData->mBaseElement->SetCounterText(); + } + } + +// --------------------------------------------------------------------------- +// modelAccessor +// --------------------------------------------------------------------------- +// +IMulModelAccessor* MulCoverFlowControl::ModelAccessor() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ModelAccessor"); + if(widget()) + { + return static_cast(widget()->model()); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// ModelChanged +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::ModelChanged( IMulModelAccessor* aAccessor ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ModelChanged"); + Env().CancelCustomCommands(this); + // update the highlight index as well as the no of item. + mData->mHighlightIndex = aAccessor->Highlight(); + + CAlfLayout* main = (CAlfLayout*) mData->mBaseElement->findVisual( KMainLayoutIndex ); + TSize mainSize = main->Size().Target().AsSize(); + int width = mainSize.iWidth; + int height = mainSize.iHeight; + + if( width == 0 && height == 0 ) + { + return; + } + else + { + // @todo check if we are setting a new model with the same old template, + // then should we call CreateTemplateElement + mData->mScreenWidth = width; + mData->mScreenHeight = height; + CreateTemplateElement(aAccessor->Template()); + mData->mBaseElement->CreateAndInitializeVisuals(); + aAccessor->SetVisibleWindow( 2 * mData->mCoverFlow2DTemplate->MaxVisibleCount() + 1 + ,WindowTop(mData->mHighlightIndex)); + // For setting or clearing empty text if depending on the new modle count + SendEventToBaseElement( TAlfEvent( EEventWidgetInitialized ) ); + } + } + + + +//-----------------Template Element Creation API's -------------------------- + +// --------------------------------------------------------------------------- +// CreateTemplateElement +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::CreateTemplateElement( mulwidget::TLogicalTemplate aTemplateName) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::CreateTemplateElement"); + if (aTemplateName == mulwidget::KTemplate1) + { + mData->mCoverFlow2DTemplate.reset( new(EMM) MulCoverFlowTemplate1(*this, *mData->mBaseElement)); + } + else if(aTemplateName == mulwidget::KTemplate4) + { + mData->mCoverFlow2DTemplate.reset( new(EMM) MulCoverFlowTemplate4(*this, *mData->mBaseElement)); + } + else + { + // Invalid template + return; + } + mData->mCoverFlow2DTemplate->CreateVisualisation(IsLandscape()); + // set holding mode to gesture helper. + SetHoldingEnabled(); + } + + + +//--------------Orientation Change Related API's----------------------------- +// --------------------------------------------------------------------------- +// VisualLayoutUpdated +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::VisualLayoutUpdated (CAlfVisual& aVisual) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::VisualLayoutUpdated"); + + TSize topLayoutSize = aVisual.Size().Target().AsSize(); ; + int height = topLayoutSize.iHeight; + int width = topLayoutSize.iWidth; + + // to avoid unnecessary visual layout updated calls . + // in order to check if the orientation has changed really or not this is done . + if( mData->mScreenWidth == width && height == mData->mScreenHeight ) + { + return; + } + + mData->mScreenWidth = width; + mData->mScreenHeight = height; + + + IMulModelAccessor* accessor = ModelAccessor(); + if(IsLandscape() == mData->mIsLandscape) + { + if(accessor) + { + CreateTemplateElement(accessor->Template()); + mData->mBaseElement->CreateAndInitializeVisuals(); + accessor->SetVisibleWindow( 2 * mData->mCoverFlow2DTemplate->MaxVisibleCount() + 1 + ,WindowTop(mData->mHighlightIndex)); + // For setting or clearing empty text if depending on the new modle count + SendEventToBaseElement( TAlfEvent( EEventWidgetInitialized ) ); + } + else + { + // For null model + // reset the coverflow 2d template to NULL + mData->mCoverFlow2DTemplate.reset(NULL); + } + } + else + { + mData->mIsLandscape = IsLandscape(); + + if(!accessor) + { + mData->mBaseElement->SetDefaultSize(TSize(mData->mScreenWidth,mData->mScreenHeight)); + return; + } + + mData->mBaseElement->OrientationChange(); + // enable or disable hold events depending on whether ECF enabled + SetHoldingEnabled(); + } + + } + +// --------------------------------------------------------------------------- +// RecycleVisuals +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::RecycleVisuals() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::RecycleVisuals"); + // reset the coverflow 2d template to NULL + mData->mCoverFlow2DTemplate.reset(NULL); + + if(mData->mBaseElement) + { + mData->mBaseElement->RecycleIconVisuals(); + mData->mHighlightIndex = -1; + } + } + +//--------------------------- Gesture ---------------------------------------- + +// --------------------------------------------------------------------------- +// SetHoldingEnabled +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetHoldingEnabled() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetHoldingEnabled"); + + mHelper->SetHoldingEnabled(EnhancedModeCondition()); + } + +// --------------------------------------------------------------------------- +// SetDoubleTapEnabled +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetDoubleTapEnabled( bool aValue) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetDoubleTapEnabled"); + + mHelper->SetDoubleTapEnabled( aValue ); + } + +// --------------------------------------------------------------------------- +// HandleGestureL +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleGestureL( const MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleGestureL"); + if(aEvent.IsHolding()) + { + HandleHoldGestureEvents(aEvent); + } + else + { + HandleNormalGestureEvents(aEvent); + } + } + +// --------------------------------------------------------------------------- +// HandleNormalGestureEvents +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleNormalGestureEvents( const MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleNormalGestureEvents"); + + switch ( aEvent.Code(MGestureEvent::EAxisHorizontal) ) + { + case EGestureStart: + { + SendFeedbackOnTouchDown(aEvent); + } + break; + case EGestureDrag: // fall through + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureDrag"); + if( aEvent.CurrentPos().iX > mData->mScreenWidth ) + { + return; + } + + if(TotalModelCount() > 0 ) + { + // if ui is on send event to applications + if( mData->mCoverFlow2DTemplate->IsUiOnOffFlagEnabled() && + (mData->mBaseElement->IsUiOnMode()) ) + { + CAlfWidgetControl::processEvent( TAlfEvent( ETypeSwitchUiStateOnDrag )); + } + + if (mData->mBounceInProgress && TotalModelCount() > 2) + { + mData->mBounceInProgress = false; + Env().CancelCustomCommands(this); + // bounce canceled once .dont bounce again for the next swipe. + mData->mDontBounce = true; + } + + int distance = aEvent.Distance().iX ; + mData->mCurrGestureDir = distance;//CovertDistAnceToDirection(distance); + if (mData->mIsMirrored) + { + distance = -distance; + } + mData->mReferencePoint = aEvent.CurrentPos().iX - 10; //pointerDownPos + distanceTravelled/2; + + mData->mBaseElement->StartDoodling(distance); + } + break; + } + + case EGestureTap: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureTap "); + HandleSingleTap(aEvent); + mFeedback->InstantFeedback(ETouchFeedbackList); + break; + } + + case EGestureDoubleTap: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureDoubleTap "); + if(TotalModelCount() <= 0 ) + { + //find out whether event should be sent on double tap or not + // in case of empty model and the feedback too. + break; + } + MulDoubleTapData doubleTapData; + // Finding the visual which has been hit . + CAlfVisual* hitVisual = aEvent.Visual(); + if(hitVisual && (hitVisual->Tag() == KCoverflowIndicator) ) + { + doubleTapData.mTapVisualIndex = mData->mHighlightIndex ; + } + else + { + int hitVisualIndex = GetHitVisualIndex( hitVisual ); + if( hitVisualIndex == -1 ) + { + break; + } + doubleTapData.mTapVisualIndex = hitVisualIndex; + } + doubleTapData.mDoubleTapPoint = aEvent.CurrentPos(); + + mFeedback->InstantFeedback(ETouchFeedbackList); + CAlfWidgetControl::processEvent ( TAlfEvent ( ETypeDoubleTap, + uint(&doubleTapData))); + break; + } + + case EGestureUnknown : + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureUnknown"); + if(TotalModelCount() > 0 ) + { + // this will revert to the original position if gesture get cancelled + // with some animation time. + // @TODO animation time should be same as set by application. + mData->mBaseElement->StopDoodling(200); + } + break; + } + + case EGestureSwipeLeft: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureSwipeLeft"); + if(TotalModelCount() > 0 ) + { + // do the calculations for changing teh higlight left or right depnding on last direction + // and the total direction moved. + int finalSwipeDirection = mData->mBaseElement->FinalSwipeDirection( + TotalSwipeDistance(aEvent),EEventScrollRight); + + HandleSwipe(finalSwipeDirection); + } + break; + } + + case EGestureSwipeRight: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureSwipeRight"); + if(TotalModelCount() > 0 ) + { + int finalSwipeDirection = mData->mBaseElement->FinalSwipeDirection( + TotalSwipeDistance(aEvent),EEventScrollLeft); + + HandleSwipe(finalSwipeDirection); + } + break; + } + case EGestureMultiTouchStart: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureMultiTouchStart"); + mData->mBaseElement->StopDoodling(0); + mFeedback->InstantFeedback(ETouchFeedbackMultiTouchRecognized); + break; + } + case EGestureMultiTouchReleased: + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureMultiTouchReleased"); + break; + case EGesturePinch: + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGesturePinch"); + CAlfWidgetControl::processEvent ( TAlfEvent ( ETypePinch,aEvent.PinchPercent())); + break; + case EGestureReleased: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleNormalGestureEvents EGestureReleased"); + break; + } + default: + break; + } // end of switch + } + +// --------------------------------------------------------------------------- +// TotalSwipeDistance +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::TotalSwipeDistance( const GestureHelper::MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::TotalSwipeDistance"); + if( aEvent.CurrentPos().iX > mData->mScreenWidth ) + { + return aEvent.Distance().iX - (aEvent.CurrentPos().iX - mData->mScreenWidth); + } + return aEvent.Distance().iX; + } + +// --------------------------------------------------------------------------- +// GetHitVisualIndex +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::GetHitVisualIndex( CAlfVisual* aHitVisual ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::GetHitVisualIndex"); + int visualIndex = -1; + + if(!aHitVisual) + { + // no visual found + return -1; + } + #ifdef _DEBUG + const TDesC8& buffer = aHitVisual->Tag(); + #endif + + if ((aHitVisual->Tag() != KCoverflowIcon)) + { + visualIndex = -1; + } + else + { + if(mData->mNumVisibleItem > 1) + { + CAlfLayout& iconFlow =mData->mBaseElement->FlowLayout( KIconFlowLayoutIndex ); + CAlfVisual* imgVisual = NULL; + for(int i=2; i<=4;i++) + { + imgVisual = iconFlow.Visual(i).FindTag(KCoverflowIcon); + if (imgVisual == aHitVisual) + { + visualIndex = RelativeToAbsolute(i); + break; + } + } + } + else + { + visualIndex = mData->mHighlightIndex; + } + } + return visualIndex; + } + + +// --------------------------------------------------------------------------- +// HandleSingleTap +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleSingleTap(const MGestureEvent& aEvent) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleSingleTap"); + + if(TotalModelCount() <= 0 ) + { + // in case of empty model and null model only when the empty text is set + // then only the selection event should be sent to the applications. + if( mData->mBaseElement->IsEmptyText() ) + { + SetSelection(-1); + } + // In case of null model and empty model if the empty text is not set then no need to calculate + //the hit visual index . Doest serve any purpose. + } + else + { + // Finding the visual which has been hit . + CAlfVisual* hitVisual = aEvent.Visual(); + if(hitVisual && (hitVisual->Tag() == KCoverflowIndicator) ) + { + CAlfWidgetControl::processEvent( TAlfEvent( EVideoIconSelect )); + return; + } + int hitVisualIndex = GetHitVisualIndex( hitVisual ); + if( hitVisualIndex > -1 ) + { + if( hitVisualIndex == mData->mHighlightIndex ) + { + SetSelection(mData->mHighlightIndex ); + } + else + { + //set the highlight in model + if(TotalModelCount() > 2 && hitVisualIndex == TotalModelCount()-1 + && mData->mHighlightIndex == 0) + { + HandleNavigationEvent ( EEventScrollLeft ); + } + else if(TotalModelCount() > 2 && mData->mHighlightIndex == TotalModelCount()-1 + && hitVisualIndex == 0) + { + HandleNavigationEvent ( EEventScrollRight ); + } + else if(hitVisualIndex > mData->mHighlightIndex) + { + HandleNavigationEvent ( EEventScrollRight ); + } + else + { + HandleNavigationEvent ( EEventScrollLeft ); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// SendFeedbackOnTouchDown +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SendFeedbackOnTouchDown(const MGestureEvent& aEvent) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SendFeedbackOnTouchDown"); + + IMulModelAccessor* modelaccessor = ModelAccessor(); + if(!modelaccessor || modelaccessor->CurrentItemCount() == 0) + { + return; + } + CAlfVisual* hitVisual = aEvent.Visual(); + if((hitVisual && hitVisual->Tag() == KCoverflowIcon) || (mData->mCoverFlow2DTemplate->IsUiOnOffFlagEnabled() )) + { + mFeedback->InstantFeedback(ETouchFeedbackList); + } + } +// --------------------------------------------------------------------------- +// HandleSwipe +// Handle the swipe events (swipe left and swipe right) provided by the gesture helper. +// Also handles the extreme doodling case (it may happen that in doodling you can move two +// or three highlight before doing a pointer up) but gesture only gives us a swipe left and +// swipe right event. so we have to decide the no of highlight movement to do while getting +// left or right event. +// Also for 2 or 3 highlight movement if the 1st or 2nd highlight movement is the cycling case +// then we have to cancel the bounce as its already happend because of swipe. But the bounce +// will happen if the final highlight change is a cyclic case. +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleSwipe(int aEvent) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleSwipe"); + int event; + if(aEvent == EItemScrollLeft) + { + if (mData->mIsMirrored) + { + event = EEventScrollRight; + } + else + { + event = EEventScrollLeft; + } + } + else if(aEvent == EItemScrollRight) + { + if (mData->mIsMirrored) + { + event = EEventScrollLeft; + } + else + { + event = EEventScrollRight; + } + } + else + { + mData->mBaseElement->StopDoodling(200); + return; + } + + if(mData->mBaseElement->NumberOfSwipes() == EDoubleSwipe || mData->mBaseElement->NumberOfSwipes() == ETripleSwipe) + { + // done to avoid undesirable ui behaviour when we move the pointer little back. + // check if it can be done in another way. + CAlfEnv& env = Env(); + TAlfRefreshMode oldRefreshMode = env.RefreshMode(); + env.SetRefreshMode(EAlfRefreshModeManual); + if(mData->mBaseElement->NumberOfSwipes() == ETripleSwipe) + { + HandleNavigationEvent( event ); + } + HandleNavigationEvent( event ); + env.SetRefreshMode(oldRefreshMode); + } + + HandleNavigationEvent( event ); + // Feedback for swipe event + mFeedback->InstantFeedback(ETouchFeedbackList); + } + +// --------------------------------------------------------------------------- +// HandleHoldGestureEvents +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleHoldGestureEvents( const MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleHoldGestureEvents"); + + switch ( aEvent.Code(MGestureEvent::EAxisHorizontal) ) + { + case EGestureDrag: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleHoldGestureEvents EGestureDrag"); + + ReverseDirectionInFastScroll(aEvent); + + /// @todo The strip direction intially should start with the current gesture direction. + // But if u keep dragging without releasing the pointer tehn the directioon should chnage whenever + // the pointer crosses the centre of the screen. + + // if the pointer has crossed the centre position after holding started then the + // direction should depend on which half of teh screen + // else + // the direction should depend on the swipe direction + StartMoving(aEvent); + break; + } + + case EGestureReleased: + case EGestureTap: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleHoldGestureEvents EGestureReleased"); + HandleEnhancedStop(); + break; + } + + case EGestureHoldLeft: + case EGestureHoldRight: + { + MUL_LOG_INFO("MUL::MulCoverFlowControl:HandleHoldGestureEvents EGestureHoldLeft"); + if( EnhancedModeCondition() ) + { + EnhancedStarted( aEvent ); + } + break; + } + + default: + break; + } // end of switch + + } + +// --------------------------------------------------------------------------- +// ReverseDirectionInFastSrroll +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::ReverseDirectionInFastScroll(const MGestureEvent& aEvent) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ReverseDirectionInFastScroll"); + + int distTravelled = aEvent.Distance().iX; + int pointerDownPos = aEvent.StartPos().iX; + int currPosition = aEvent.CurrentPos().iX; + int prevGestureDir = ConvertDistanceToDirection(mData->mCurrGestureDir); + + // if the distance travelled is negative i.e from right to left and the start position is on + // the right half of the screen and the direction has not changed yet , then special case to handle reference point. and vice versa + // case for left half of the screen. + if( ((distTravelled < 0 && pointerDownPos > mData->mScreenWidth/2 ) || (distTravelled > 0 && + pointerDownPos < mData->mScreenWidth/2 )) && mData->mReferencePoint != mData->mScreenWidth/2) + { + if( mData->mDirectionChanged ) + { + return; + } + + ChangeDirReferencePoint(currPosition,distTravelled); + } + else + { + // else the reference point will be the middle of the screen. + + // if the direction is not equal .. just check whether it has crossed the reference point. + // how to check whether it has crossed the reference point. + if(( prevGestureDir < 0 && currPosition > mData->mReferencePoint )||(prevGestureDir > 0 && currPosition < mData->mReferencePoint)) + { + mData->mCurrGestureDir *= -1; + } + + mData->mReferencePoint = mData->mScreenWidth/2; + } + } + +// --------------------------------------------------------------------------- +// ChangeDirReferencePoint +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::ChangeDirReferencePoint(int aCurrPosition, int aDistanceTravelled ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ChangeDirReferencePoint"); + + int prevGestureDir = ConvertDistanceToDirection(mData->mCurrGestureDir); + int currGestureDir = ConvertDistanceToDirection(aDistanceTravelled); + + if( prevGestureDir != currGestureDir ) + { + // if the direction is not equal .. just check whether it has crossed the reference point. + // how to check whether it has crossed the reference point. + if(( prevGestureDir < 0 && aCurrPosition > mData->mReferencePoint )||(prevGestureDir > 0 && aCurrPosition < mData->mReferencePoint)) + { + //crossed the reference point first time .now no need to maintain the reference point .its always half of the screen + mData->mReferencePoint = mData->mScreenWidth/2; + mData->mDirectionChanged = true; + mData->mCurrGestureDir = aDistanceTravelled; + } + else + { + // not crossed the reference point yet + // still going in the same direction . + mData->mReferencePoint = aCurrPosition - 10; + } + } + else + { + // still going in the same direction . + if(( prevGestureDir < 0 && aCurrPosition < mData->mScreenWidth/2 )||(prevGestureDir > 0 + && aCurrPosition > mData->mScreenWidth/2)) + { + mData->mReferencePoint = mData->mScreenWidth/2; + } + else if(Abs(mData->mCurrGestureDir) < Abs(aDistanceTravelled) ) + { + // moving in the same direction in the increasing side towards the middle of the screen but hasnt + // crossed the reference point yet. + mData->mReferencePoint = aCurrPosition - 10; + } + } + } + +// --------------------------------------------------------------------------- +// ConvertDistanceToDirection +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::ConvertDistanceToDirection( int aDistance ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::ConvertDistanceToDirection"); + return aDistance>0?1:-1; + } + +// --------------------------------------------------------------------------- +// HandleEnhancedStop +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::HandleEnhancedStop() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::HandleEnhancedStop"); + + CAlfWidgetControl::processEvent( TAlfEvent( ETypeFastScroll,EScrollStop )); + mCoverFlowAo->StopMoving(); + mData->mFastScroll = false; + mData->mGestureSpeed = 0; + // @TODO animation time should be same as set by the application. + mData->mBaseElement->MoveVisuals(0,200); + } + +// --------------------------------------------------------------------------- +// FastScrollTransitionTime +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::FastScrollTransitionTime() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::FastScrollTransitionTime"); + if (mData->mBounceInProgress) + { + return 800; + } + else + { + return mCoverFlowAo->FastScrollTransitionTime(); + } + } + + +// --------------------------------------------------------------------------- +// EnhancedModeCondition +// --------------------------------------------------------------------------- +// +bool MulCoverFlowControl::EnhancedModeCondition() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::EnhancedMode"); + if( !mData->mCoverFlow2DTemplate.get() ) + { + return false; + } + UString orientation = IsLandscape() ? UString(KLandscape) : UString(KPortrait); + + // If EMulWidgetFlagFastScroll is not set, + // or the current orientation is not landscape + // or in teh current template enhanced mode is not supported + if( !(((MulCoverFlowWidget*)widget())->IsFlagSet(IMulMultiItemWidget::EMulWidgetFlagFastScroll) + && !orientation.compare(KLandscape) + && mData->mCoverFlow2DTemplate->EnhancedTagParsed()) ) + { + return false; + } + // If template4(i.e. ui on off mode is anabled) then if ui on mode then ecf canot be launched,so return false + else if( mData->mCoverFlow2DTemplate->IsUiOnOffFlagEnabled() && + (mData->mBaseElement->IsUiOnMode()) ) + { + return false; + } + else + { + return true; // enhanced mode enabled + } + } + +// --------------------------------------------------------------------------- +// EnhancedStarted +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::EnhancedStarted(const GestureHelper::MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::EnhancedStarted"); + CAlfWidgetControl::processEvent( TAlfEvent( ETypeFastScroll,EScrollStart )); + mData->mFastScroll = true; + StartMoving(aEvent); + } + +// --------------------------------------------------------------------------- +// StartMoving +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::StartMoving( const GestureHelper::MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::StartMoving"); + + TRealPoint speedPoint = GestureSpeed( aEvent ); + int distance = mData->mCurrGestureDir; + if (mData->mIsMirrored) + { + distance = -distance; + } + mCoverFlowAo->StartMoving(speedPoint.iX, ConvertDistanceToDirection(distance) ); + mData->mGestureSpeed = speedPoint.iX; + } + +// --------------------------------------------------------------------------- +// GestureSpeed +// --------------------------------------------------------------------------- +// +TRealPoint MulCoverFlowControl::GestureSpeed( const MGestureEvent& aEvent ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::GestureSpeed"); + + TRect area(this->DisplayArea()); + TRect rect(TPoint(0,0),TPoint(area.Width(),area.Height())); + return aEvent.SpeedPercent( rect ); + } + +//--------------------Slider related functions---------------------------- + +// --------------------------------------------------------------------------- +// CreateSliderWidget +// --------------------------------------------------------------------------- +// +IAlfWidget* MulCoverFlowControl::CreateSliderWidget() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::CreateSliderWidget"); + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(Env()); + IAlfWidget* sliderWidget = widgetFactory.findWidget( KNameSliderWidget ); + + if( sliderWidget ) + { + mSliderWidget = static_cast(sliderWidget); + mData->mBaseElement->UpdateSliderTick( 1 ); + } + else + { + // Get the template Id in Integer from your template data + //NOTE: Set template takes int as parameter not UString + + // Slider Widget creation + mSliderWidget = widgetFactory.createWidget ( KNameSliderWidget, KNameSliderWidget, *widget()->parent(), NULL); + IMulSliderModel* mSliderModel = widgetFactory.createModel ("mulslidermodel"); + mSliderWidget->setModel(mSliderModel, true); + mSliderModel->SetTemplate(ESliderTemplate1); + mSliderWidget->SetHandleKeyEvent(false); + mSliderWidget->control()->disableState(IAlfWidgetControl::Focusable); + } + + IAlfWidgetEventHandler* coverFlowEventHandler = static_cast ( + mData->mBaseElement->makeInterface( IAlfWidgetEventHandler::type() ) ); + + //Register the slidereventhandler and coverfloweventhandler with one another + mSliderWidget->control()->addEventHandler((coverFlowEventHandler)); + + return mSliderWidget; + } + +// --------------------------------------------------------------------------- +// GetSliderWidget +// --------------------------------------------------------------------------- +// +IAlfWidget* MulCoverFlowControl::GetSliderWidget() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::GetSliderWidget"); + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*(CAlfEnv::Static())); + return widgetFactory.findWidget( KNameSliderWidget ); + } + +// --------------------------------------------------------------------------- +// GetSliderModel +// --------------------------------------------------------------------------- +// +IMulSliderModel* MulCoverFlowControl::GetSliderModel() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::GetSliderModel"); + if( mSliderWidget ) + { + IMulSliderWidget* mulSliderWidget = static_cast(mSliderWidget); + IMulSliderModel* mulSliderModel = static_cast(mulSliderWidget->model()); + return mulSliderModel; + } + return NULL; + } + +// --------------------------------------------------------------------------- +// DestroySlider +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::DestroySlider() + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::DestroySlider"); + + MulBaseElement* baseelement = static_cast(findElement(KBase)); + if(baseelement) + { + baseelement->RemoveSliderFromLayout(); + } + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(Env()); + IAlfWidget* sliderWidget = widgetFactory.findWidget( KNameSliderWidget ); + if( sliderWidget ) + { + IAlfElement* baseelement = findElement(KBase); + if(baseelement) + { + + IAlfWidgetEventHandler* coverFlowEventHandler = static_cast ( + baseelement->makeInterface( IAlfWidgetEventHandler::type() ) ); + + if( sliderWidget->control() ) + { + sliderWidget->control()->removeEventHandler(*(coverFlowEventHandler)); + } + + } + } + } + +// --------------------------------------------------------------------------- +// UpdateItemAtIndex +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::UpdateItemAtIndex(const int aRelativeIndex, int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::UpdateItemAtIndex"); + int absoluteIndex = RelativeToAbsolute(aRelativeIndex); + if(absoluteIndex >= 0) + { + UpdateCoverflowItem( absoluteIndex,aRelativeIndex, aAnimationTime ); + } + else + { + SetBlankTexture(aRelativeIndex); + } + } + +// --------------------------------------------------------------------------- +// SetBlankTexture +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetBlankTexture(int aRelativeIndex) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetBlankTexture"); + CAlfFlowLayout& iconFlow = static_cast(mData->mBaseElement->FlowLayout( KIconFlowLayoutIndex )); + + CAlfDeckLayout& layout = static_cast(iconFlow.Visual(aRelativeIndex)); + CAlfImageVisual* visual =static_cast(layout.FindTag(KCoverflowIcon)); + + CAlfTextureManager& textureMgr = Env().TextureManager(); + TAlfImage blankTexture = textureMgr.BlankTexture(); + visual->SetImage(blankTexture); + + // remove the icon brush if any. + mData->mBaseElement->RemoveBrushOnIcon(*visual); + + CAlfImageVisual* indicatorVisual =static_cast(layout.FindTag(KCoverflowIndicator)); + if(indicatorVisual) + { + indicatorVisual->SetImage(blankTexture); + } + } + +// --------------------------------------------------------------------------- +// UpdateCoverflowItem +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::UpdateCoverflowItem( int aItemIndex,int aVisualIndex, int aAnimationTime ) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::UpdateCoverflowItem"); + + CAlfFlowLayout& iconFlow = static_cast(mData->mBaseElement->FlowLayout( KIconFlowLayoutIndex )); + IMulModelAccessor* accessor = static_cast(widget()->model()); + + try + { + const MulVisualItem& item = accessor->Item(aItemIndex); + + CAlfDeckLayout& layout = static_cast(iconFlow.Visual(aVisualIndex)); + CAlfImageVisual* visual =static_cast(layout.FindTag(KCoverflowIcon)); + IMulVariantType* varData = item.Attribute(mulvisualitem::KMulIcon1); + if(varData && visual) + { + DoSetImage(varData,visual); + mData->mBaseElement->ApplyScaleMode(*visual); + } + else + { + if (mData->mDefaultTextureId >= 0) + { + const CAlfTexture* texture = Env().TextureManager().Texture (mData->mDefaultTextureId); + if(visual) + { + visual->SetImage (TAlfImage (*texture)); + } + mData->mBaseElement->ApplyScaleMode(*visual); + } + else + { + if(visual) + { + visual->SetImage(Env().TextureManager().BlankTexture()); + } + } + } + if(mData->mCoverFlow2DTemplate->IsUiOnOffFlagEnabled() ) + { + mData->mBaseElement->DisplayIndicatorIcon(item,aVisualIndex); + } + } + catch(...) + { + CAlfDeckLayout& layout = static_cast(iconFlow.Visual(aVisualIndex)); + CAlfImageVisual* visual =static_cast(layout.FindTag(KCoverflowIcon)); + if (mData->mDefaultTextureId >= 0) + { + const CAlfTexture* texture = Env().TextureManager().Texture (mData->mDefaultTextureId); + visual->SetImage (TAlfImage (*texture)); + mData->mBaseElement->ApplyScaleMode(*visual); + } + else + { + visual->SetImage(Env().TextureManager().BlankTexture()); + } + + }//catch ends + // if the item is the highlight item then update the text if required. + if (aVisualIndex == mData->mNumVisibleItem) + { + mData->mBaseElement->UpdateTextValue(aAnimationTime); + } + } + + +// --------------------------------------------------------------------------- +// DoSetImage +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::DoSetImage(IMulVariantType* aData,CAlfImageVisual* aImgVisual) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::DoSetImage"); + + if ( aData && aData->Type() == IMulVariantType::EDes) + { + TAlfImage image = AlfWidgetEnvExtension::resourcePool( + aImgVisual->Env()).getImageResource((char*)(aData->DesC().Ptr())); + if(image.HasTexture()) + { + aImgVisual->SetImage(image); + } + else if(IsSVGImage(aData->DesC())) + { + LoadImageFromSvg(aData->DesC(),*aImgVisual); + } + else + { + // check if the texture is already loaded + CAlfTextureManager& textureMgr = aImgVisual->Env().TextureManager(); + const TInt existingTextureId = textureMgr.TextureId( aData->DesC() ); + const CAlfTexture* texture = NULL; + + if ( existingTextureId != KErrNotFound ) + { + texture = textureMgr.Texture( existingTextureId ); + } + else + { + TRAPD( err, texture = &( textureMgr.LoadTextureL(aData->DesC(), + EAlfTextureFlagLoadAnimAsImage, KAlfAutoGeneratedTextureId ) ) ); + if( err != KErrNone ) + { + // means the texture is invalid. + //draw a blank texture here. + texture = &( textureMgr.BlankTexture() ); + } + } + aImgVisual->SetImage( TAlfImage( *texture ) ); + } + } + else if ( aData && aData->Type ()== IMulVariantType::EInt) + { + const CAlfTexture* texture = Env().TextureManager().Texture (aData->integer()); + aImgVisual->SetImage (TAlfImage (*texture)); + } + } + +// --------------------------------------------------------------------------- +// IsSVGImage +// --------------------------------------------------------------------------- +// +bool MulCoverFlowControl::IsSVGImage(const TDesC& aImagePath) + { + MUL_LOG_INFO("MUL:MulCoverFlowControl::IsSVGImage"); + _LIT(KSvgFile,".svg"); + + return (KErrNotFound != aImagePath.FindC(KSvgFile)); + } + +// --------------------------------------------------------------------------- +// LoadImageFromSvg +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::LoadImageFromSvg(const TDesC& aImagePath, + CAlfImageVisual& aImageVisual ) + { + MUL_LOG_INFO("MUL:MulCoverFlowControl::LoadImageFromSvg"); + + CAlfImageLoaderUtil imgLoaderUtil; + imgLoaderUtil.SetSize (TSize (50, 50)); + + MAlfBitmapProvider* iSvgBitMapProv= imgLoaderUtil.CreateSVGImageLoaderL (aImagePath); + CAlfTexture &texture = aImageVisual.Env().TextureManager().CreateTextureL ( + KAlfAutoGeneratedTextureId, + iSvgBitMapProv, + EAlfTextureFlagLoadAnimAsImage); + aImageVisual.SetImage (TAlfImage (texture)); + + } + +// --------------------------------------------------------------------------- +// StoreVisibleItemCount +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::StoreVisibleItemCount(int aVisibleItemCount) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::StoreVisibleItemCount"); + mData->mNumVisibleItem = aVisibleItemCount; + } + +// --------------------------------------------------------------------------- +// SetDefaultImage +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::SetDefaultImage(int aTextureId) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::SetDefaultImage"); + mData->mDefaultTextureId = aTextureId; + } + +// --------------------------------------------------------------------------- +// WindowTop +// --------------------------------------------------------------------------- +// +int MulCoverFlowControl::WindowTop(int aHighlightIndex) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::WindowTop"); + int visibleItems = 2 * mData->mNumVisibleItem + 1; + int windowTop = aHighlightIndex - (visibleItems / 2); + IMulModelAccessor* accessor = static_cast(widget()->model()); + if(accessor) + { + windowTop = (windowTop + visibleItems - 1) >= TotalModelCount() ? + TotalModelCount() - visibleItems : windowTop; + windowTop = windowTop > 0 ? windowTop : 0; + } + + return windowTop; + } + +// --------------------------------------------------------------------------- +// UpdateBaseElement +// --------------------------------------------------------------------------- +// +void MulCoverFlowControl::UpdateBaseElement(MulBaseElement* aBaseElement) + { + MUL_LOG_ENTRY_EXIT("MUL:MulCoverFlowControl::UpdateBaseElement"); + mData->mBaseElement = aBaseElement; + } + +// --------------------------------------------------------------------------- +// IsLandscape +// --------------------------------------------------------------------------- +// +bool MulCoverFlowControl::IsLandscape() + { + bool ret; + TSize ScreenSz = AlfUtil::ScreenSize(); + if (ScreenSz.iWidth > ScreenSz.iHeight) + { + ret = true; + } + else + { + ret = false; + } + return ret; + } + +// --------------------------------------------------------------------------- +// Gesturehelper +// --------------------------------------------------------------------------- +// +GestureHelper::CGestureHelper* MulCoverFlowControl::Gesturehelper() + { + return mHelper.get(); + } + + } // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowenhancedtemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowenhancedtemplate.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2007-2008 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: CoverFlow templates Implementation + * +*/ + +// Include Files + +// Class Headers +#include "mulcoverflowcontrol.h" + +// DUI headers for xml parser +#include +#include +#include + +// Local Headers +#include "mulutility.h" +#include "mulbaseelement.h" +#include "mulcoverflowenhancedtemplate.h" +#include "mulcoverflowdefinitions.h" //defines all the strings +#include "mullog.h" + +using namespace duiuimodel; + +namespace Alf + { + +struct TMulCoverFlowEnhancedTemplateImpl + { + + TMulCoverFlowEnhancedTemplateImpl() + { + } + + //Structure used to store the position and sizes of the counter. + TMulCoverFlowItem mEnhancedMinSize; // minimum size of images in enhanced mode + TMulCoverFlowItem mEnhancedMaxSize; // maximum size of images in enhanced mode + TMulCoverFlowItem mEnhacedCounterPos; // The position and size of the counter in enhaced mode + UString mEnhancedBorderImagePath; + + ~TMulCoverFlowEnhancedTemplateImpl() + { + } + }; + +// --------------------------------------------------------------------------- +// MulCoverFlowEnhancedTemplate +// --------------------------------------------------------------------------- +// +MulCoverFlowEnhancedTemplate::MulCoverFlowEnhancedTemplate(MulCoverFlowControl &aControl, + UString &aTemplateID, MulXmlUtility& aMulXmlUtility,DuiNode* aRootNode):MulCoverFlowBaseTemplate( + aControl, aTemplateID, aMulXmlUtility,aRootNode ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::MulCoverFlowEnhancedTemplate"); + mData.reset(new (EMM)TMulCoverFlowEnhancedTemplateImpl); + + // Parses the xml from the oreientation node. + ParseNode( *GetOrientationNode() ); + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowWidget +// --------------------------------------------------------------------------- +// +MulCoverFlowEnhancedTemplate::~MulCoverFlowEnhancedTemplate() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::~MulCoverFlowEnhancedTemplate"); + //Nothing to delete . + } + +// --------------------------------------------------------------------------- +// EnhancedMaxSize +// --------------------------------------------------------------------------- +// +const TMulCoverFlowItem& MulCoverFlowEnhancedTemplate::EnhancedMaxSize() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::EnhancedMaxSize"); + return mData->mEnhancedMaxSize; + } + +// --------------------------------------------------------------------------- +// EnhancedMinSize +// --------------------------------------------------------------------------- +// +const TMulCoverFlowItem& MulCoverFlowEnhancedTemplate::EnhancedMinSize() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::EnhancedMinSize"); + return mData->mEnhancedMinSize; + } + +// --------------------------------------------------------------------------- +// EnhacedCounterPos +// --------------------------------------------------------------------------- +// +const TMulCoverFlowItem& MulCoverFlowEnhancedTemplate::EnhacedCounterPos() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::EnhacedCounterPos"); + return mData->mEnhacedCounterPos; + } + +// --------------------------------------------------------------------------- +// EnhancedBorderImagePath +// --------------------------------------------------------------------------- +// +const UString& MulCoverFlowEnhancedTemplate::EnhancedBorderImagePath() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::EnhancedBorderImagePath"); + return mData->mEnhancedBorderImagePath; + } + +// --------------------------------------------------------------------------- +// ParseNode +// --------------------------------------------------------------------------- +// +void MulCoverFlowEnhancedTemplate::ParseNode( DuiNode& aNode ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::ParseNode"); + int nChildCount = aNode.childCount (); + for (int index = 0; index < nChildCount; index++) + { + DuiNode& item = aNode.child (index); + + //parse the elements + if ( !item.type().compare(KElement) ) + { + if( !item.nodeId().compare(KEnhancedSize) ) + { + ParseEnhancedTag( item ); + } + else if( !item.nodeId().compare(KCounter) ) + { + ParseCounterTag( item ); + } + } + } + } + +// --------------------------------------------------------------------------- +// ParseEnhancedTag +// --------------------------------------------------------------------------- +// +void MulCoverFlowEnhancedTemplate::ParseEnhancedTag( DuiNode& aNode ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::ParseEnhancedTag"); + int totalitems = aNode.childCount(); + for( int index = 0; index < totalitems; index++ ) + { + DuiNode& childItem = aNode.child(index); + if( !childItem.type().compare(KSize) ) + { + // for enhanced mode xmls. + ProcessSizeTag( childItem ); + } + else + { + bool pathFound = GetStaticImagePath(childItem, mData->mEnhancedBorderImagePath); + TPtrC8 src((TUint8*)mData->mEnhancedBorderImagePath.getUtf8()); + } + } + } + +// --------------------------------------------------------------------------- +// ParseCounterTag +// --------------------------------------------------------------------------- +// +void MulCoverFlowEnhancedTemplate::ParseCounterTag( DuiNode& aNode ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::ParseCounterTag"); + int totalItems = aNode.childCount(); + for( int index = 0; index < totalItems; index++ ) + { + DuiNode& childItem = aNode.child(index); + if( !childItem.type().compare(KSize) ) + { + // for enhanced mode xmls. + ProcessSizeTag( childItem ); + } + } + } + +// --------------------------------------------------------------------------- +// ProcessSizeTag +// --------------------------------------------------------------------------- +// +void MulCoverFlowEnhancedTemplate::ProcessSizeTag( DuiNode& aNode ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowEnhancedTemplate::ProcessSizeTag"); + int totalitems = aNode.childCount(); + + auto_ptr itemstruct = ProcessItemPos( aNode ); + if( !aNode.nodeId().compare(KMinSize) ) + { + // Store the maximum and minimum sizes for enhanced mode. + mData->mEnhancedMinSize = *itemstruct; + } + else if( !aNode.nodeId().compare(KMaxSize) ) + { + // Store the maximum and minimum sizes for enhanced mode. + mData->mEnhancedMaxSize = *itemstruct; + } + else if( !aNode.nodeId().compare(KCounterSize) ) + { + // Store the position and sizes for the counter in enhanced mode. + mData->mEnhacedCounterPos = *itemstruct; + } + //delete itemstruct; + } +//----------------------------------------------------------------------------- +// GetStaticImagePath +//----------------------------------------------------------------------------- +// +bool MulCoverFlowEnhancedTemplate::GetStaticImagePath(DuiNode& aNode, UString& aPath) + { + MUL_LOG_ENTRY_EXIT("aakash::MulXmlTemplate::GetStaticImagePath"); + + int aAttrSetterCount = aNode.childCount (); + + for (int index = 0; index < aAttrSetterCount; index++) + { + DuiNode& attrSetterNode = aNode.child (index); + const UString& aNodeType = attrSetterNode.type (); + + DuiXmlAttributeList& attSetterList = attrSetterNode.attributeList (); + const UString& attrName = attSetterList.attributeValue (UString (attributesetter::KName)); + const UString& category = attSetterList.attributeValue (UString (KCategory)); + + if ( aNodeType == nodetypes::KAttributeSetter ) + { + if ( attrName == duiuimodel::imagevisualattributes::KImagePath && category == attributesetter::typevalues::KStatic ) + { + aPath = attSetterList.attributeValue(UString(attributesetter::KTargetValue)); + MulUtility::AbsolutePath(aPath); + return true; + } + } + } + return false; + } + + }//namespace Alf + +// End of file. + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowitemelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowitemelement.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2007-2008 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: Item element implementation for Cover Flow. +* +*/ + + +// This file defines the API for mulcoverflowwidget.dll + +// Includes +#include +#include +#include +#include +#include + +// Local headers +#include "mulvisualtemplate.h" +#include "mulcoverflowcontrol.h" +#include "mulcoverflowdefinitions.h" +#include "mulbaseelement.h" +#include "mullog.h" + +// Mul headers +#include "imulmodelaccessor.h" +#include +#include + + +//Class header +#include "mulcoverflowitemelement.h" + +namespace Alf + { + +//----------------------------------------------------------------------------- +// Constructor +//----------------------------------------------------------------------------- +// +MulCoverFlowItemElement::MulCoverFlowItemElement( CAlfWidgetControl& aControl, const char* aName, MulTemplateInterface& aControlInterface ) + { + //Call the base class method + construct(aControl,aName); + + mVisualRecycled = false; + mNumVisualsRecycled = 0; + mIconFlow = NULL; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +// +MulCoverFlowItemElement::~MulCoverFlowItemElement() + { + // Nothind to delete . + } + +//----------------------------------------------------------------------------- +// accept +//----------------------------------------------------------------------------- +// +bool MulCoverFlowItemElement::accept(CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent) const + { + + if(!aEvent.IsCustomEvent()) + { + return false; + } + return true; + } + +//----------------------------------------------------------------------------- +// setActiveStates +//----------------------------------------------------------------------------- +// +void MulCoverFlowItemElement::setActiveStates(unsigned int /*aStates*/) + { + + } + +// offerEvent +//----------------------------------------------------------------------------- +// +AlfEventStatus MulCoverFlowItemElement::offerEvent(CAlfWidgetControl& /*aControl*/, const TAlfEvent& /*aEvent*/) + { + return EEventNotHandled; + } + +//----------------------------------------------------------------------------- +// makeInterface +//----------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulCoverFlowItemElement::makeInterface(const IfId& /*aType*/) + { + return NULL; + } + +//----------------------------------------------------------------------------- +// setEventHandlerData +//----------------------------------------------------------------------------- +// +void MulCoverFlowItemElement::setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + +//----------------------------------------------------------------------------- +// eventHandlerData +//----------------------------------------------------------------------------- +// +AlfWidgetEventHandlerInitData* MulCoverFlowItemElement::eventHandlerData() + { + return NULL; + } + +// ---------------------------------------------------------------------------- +// eventHandlerType +// ---------------------------------------------------------------------------- +// + IAlfWidgetEventHandler::AlfEventHandlerType MulCoverFlowItemElement::eventHandlerType() + { + return IAlfWidgetEventHandler::ELogicalEventHandler ; + } +// ---------------------------------------------------------------------------- +// eventExecutionPhase +// ---------------------------------------------------------------------------- +// + +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulCoverFlowItemElement::eventExecutionPhase() + { + return EBubblingPhaseEventHandler; + } + + +CAlfVisual* MulCoverFlowItemElement::CreateIconStructure(CAlfLayout* aParentLayout, const UString& aTemplateId) + { + return (static_cast(getVisualTemplate()))->CreateIconStructure(aParentLayout, aTemplateId); + + } + +void MulCoverFlowItemElement::DoSetImage(IAlfVariantType* data,CAlfImageVisual* aImgVisual) +{ + static_cast(getVisualTemplate())->DoSetImage(data, aImgVisual ); +} + + + } // namespace ends here + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowtemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowtemplate.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007-2008 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: CoverFlow templates Implementation + * +*/ + +// Include Files + +#include + +// Alf Headers +#include +#include +#include +#include + +// Class Header +#include "mulcoverflowtemplate.h" + +// Local Headers +#include "mulcoverflowcontrol.h" +#include "mulbaseelement.h" +#include "mulleave.h" +#include "mullog.h" //for logs + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulCoverFlowTemplate +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate::MulCoverFlowTemplate(MulCoverFlowControl &aControl, + MulBaseElement &aBaseElement) + { + MUL_LOG_ENTRY_EXIT("Mul::MulCoverFlowTemplate::MulCoverFlowTemplate"); + + mData.reset( new (EMM)TMulCoverFlowTemplateImpl); + mData->mControl = &aControl; + mData->mBaseElement = &aBaseElement; + } + + + void MulCoverFlowTemplate::CreateVisualisation(bool /*aIsLandscape*/,bool /*aIsOrientationChange*/) + { + + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowWidget +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate::~MulCoverFlowTemplate() + { + + } + +// --------------------------------------------------------------------------- +// ApplyBrush +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate::ApplyBrush( CAlfTextVisual& aVisual, + const TRgb& aBrushColour, float aBrushOpacity ) + { + MUL_LOG_ENTRY_EXIT("Mul::MulCoverFlowTemplate::ApplyBrush"); + + // Enable brush on the text visual + aVisual.EnableBrushesL( ETrue ); + CAlfBrushArray* brushArray = aVisual.Brushes(); + if(brushArray) + { + if( brushArray->Count()!=0) + { + //brushArray->Reset(); + CAlfGradientBrush& brush = static_cast( + brushArray->At(0)); + brush.SetColor( aBrushColour ); + brush.SetOpacity(aBrushOpacity); + } + else + { + THROW_IF_LEAVES + ( + CAlfGradientBrush* brush = CAlfGradientBrush::NewL( + mData->mControl->Env() ); + // Set the brush colour + brush->SetColor( aBrushColour ); + // Apply brush and set the opacity . + aVisual.Brushes()->AppendL( brush, EAlfHasOwnership ); + brush->SetOpacity(aBrushOpacity); + ); + } + } + } + + +// --------------------------------------------------------------------------- +// GetFontId +// --------------------------------------------------------------------------- +// +TInt MulCoverFlowTemplate::GetFontId(const UString &aFontStyle,CAlfTextStyleManager& manager)const + { + MUL_LOG_ENTRY_EXIT("Mul::MulCoverFlowTemplate::GetFontId"); + TInt fontId = 0; + if ( aFontStyle == "qfn_secondary" ) + { + THROW_IF_LEAVES + ( + fontId = manager.CreatePlatformTextStyleL(EAknLogicalFontSecondaryFont, -1); + ); + } + else // by default it assumes the primary font. + { + THROW_IF_LEAVES + ( + fontId = manager.CreatePlatformTextStyleL(EAknLogicalFontPrimaryFont, -1); + ); + } + return fontId; + } + +// --------------------------------------------------------------------------- +// IconWindowRect +// --------------------------------------------------------------------------- +// +TRect MulCoverFlowTemplate::IconWindowRect( + const TAknWindowLineLayout &aLayout, + const TRect& aParentRect) + { + TAknLayoutRect layoutRect ; + layoutRect.LayoutRect( aParentRect, aLayout ); + TRect rect(layoutRect.Rect()); + return rect; + } + +// --------------------------------------------------------------------------- +// TextWindowRect +// --------------------------------------------------------------------------- +// +TRect MulCoverFlowTemplate::TextWindowRect( + const TAknTextLineLayout& aLayout, + const TRect& aParentRect) + { + TAknLayoutText layoutText; + layoutText.LayoutText( aParentRect, aLayout ); + TRect rect(layoutText.TextRect()); + return rect; + } + + +// --------------------------------------------------------------------------- +// UpdateMaxFontWidth +// --------------------------------------------------------------------------- +// +int MulCoverFlowTemplate ::UpdateMaxFontWidth(CAlfTextVisual* textVisual) + { + int maxCharWidth = 0; + int fontId = textVisual->TextStyle(); + const CFont* font = AknLayoutUtils::FontFromId(fontId, NULL); + TFontSpec curfontSpec = font->FontSpecInTwips(); + curfontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); + maxCharWidth = font->MaxCharWidthInPixels(); + return maxCharWidth; + } + +// --------------------------------------------------------------------------- +// SetTextStyle +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate:: SetTextStyle(int aTextFontId, CAlfTextVisual& aTextVisual) + { + MUL_LOG_ENTRY_EXIT("Mul::MulCoverFlowTemplate::SetTextStyle"); + UString textStyle; + switch(aTextFontId) + { + case 0: textStyle=UString("qfn_primary"); + break; + + case 1: textStyle=UString("qfn_primary"); + break; + + case 2: textStyle=UString("qfn_secondary"); + break; + + } + CAlfTextStyleManager& manager = aTextVisual.Env().TextStyleManager(); + aTextVisual.SetTextStyle(GetFontId(textStyle, manager)); + } + + }//namespace Alf + +// End of file. diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,552 @@ +/* +* Copyright (c) 2007-2008 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: Widget Implementation +* +*/ + +// Include Files +#include +#include + +// Class headers +#include "mulcoverflowwidget.h" + +// Mul Headers +#include "imulmodelaccessor.h" +#include "mulassert.h" +#include "mullog.h" //for logs +#include + +// Local Headers +#include "mulbaseelement.h" +#include "mulcoverflowcontrol.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulCoverFlowWidget +// --------------------------------------------------------------------------- +// +MulCoverFlowWidget::MulCoverFlowWidget( CAlfEnv& aEnv, + const char* aWidgetId, IAlfContainerWidget& aContainerWidget):AlfWidget(aWidgetId,aContainerWidget,aEnv) + { + mMulModelAccessor = NULL; + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::MulCoverFlowWidget"); + mWidgetPropertyFlag = 0; //Initialization + + //Create default control + mCoverflowControl = new (EMM) MulCoverFlowControl( aEnv ); + setControl( mCoverflowControl,true ); + + // create Base element + mBaseElement = new (EMM) MulBaseElement( *mCoverflowControl, KBase ); + mTakesModelOwnership = false; + + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowWidget +// --------------------------------------------------------------------------- +// +MulCoverFlowWidget::~MulCoverFlowWidget() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::~MulCoverFlowWidget"); + // Control will be destroyed in the Widget deletion sequence. In that sequence + // Control's owner widget will be set to NULL. So,We cannot access the widget in + // the Coverflow control's destructor. So,This will be the right place to remove the + // model Observer. + + if( control() && model()) + { + ((IMulModelAccessor*)model())->RemoveModelObserver(static_cast( control())); + } + if (mMulModelAccessor && mTakesModelOwnership) + { + delete mMulModelAccessor; + } + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*(CAlfEnv::Static())); + IAlfWidget* sliderWidget = widgetFactory.findWidget( KNameSliderWidget ); + + if(control()) + { + (static_cast(control()))->DestroySlider(); + } + + if(sliderWidget) + { + widgetFactory.destroyWidget(sliderWidget); + } + } + +// --------------------------------------------------------------------------- +// parent +// --------------------------------------------------------------------------- +// +IAlfContainerWidget* MulCoverFlowWidget::parent() const + { + return AlfWidget::parent (); //return container widget + } + +// --------------------------------------------------------------------------- +// control +// --------------------------------------------------------------------------- +// +CAlfWidgetControl* MulCoverFlowWidget::control() const + { + //Call the base class method + return AlfWidget::control(); + } + +// --------------------------------------------------------------------------- +// setControl +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::setControl( CAlfWidgetControl* aControl,bool aDeletePreviousControl ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::setControl"); + AlfWidget::setControl( aControl,aDeletePreviousControl ); + } + +// --------------------------------------------------------------------------- +// model +// --------------------------------------------------------------------------- +// +IAlfModel* MulCoverFlowWidget::model() + { + return mMulModelAccessor; + } + +// --------------------------------------------------------------------------- +// setModel +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::setModel( IAlfModel* /*aModel*/ , bool /*aTakeOwnership*/ ) + { + } + +// --------------------------------------------------------------------------- +// widgetName +// --------------------------------------------------------------------------- +// +const char* MulCoverFlowWidget::widgetName() const + { + return AlfWidget::widgetName(); + } + + +// --------------------------------------------------------------------------- +// SetBackground +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetBackground(const TRgb& aColor) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetBackground"); + + mBaseElement->SetBackground( aColor ); + } + +// --------------------------------------------------------------------------- +// SetBackground +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetBackground(const TAknsItemID& aItemID) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetBackground"); + + mBaseElement->SetBackground( aItemID ); + } +// --------------------------------------------------------------------------- +// SetFlags +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetFlags( unsigned int aAnyFlag ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetFlags"); + mWidgetPropertyFlag |= aAnyFlag; + + // When the IMulMultiItemWidget::EMulWidgetFlagFastScroll flag is modified we should + // set the enable holding flag to gesture helper to recieve the hold events. + if(aAnyFlag == IMulMultiItemWidget::EMulWidgetFlagFastScroll) + { + mCoverflowControl->SetHoldingEnabled(); + } + else if(aAnyFlag == IMulMultiItemWidget::EMulWidgetDoubleTap) + { + mCoverflowControl->SetDoubleTapEnabled(true); + } + } + +// --------------------------------------------------------------------------- +// ClearFlags +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::ClearFlags( unsigned int aAnyFlag ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::ClearFlags"); + mWidgetPropertyFlag &= ~aAnyFlag; + if(aAnyFlag == IMulMultiItemWidget::EMulWidgetDoubleTap) + { + mCoverflowControl->SetDoubleTapEnabled(false); + } + else if(aAnyFlag == IMulMultiItemWidget::EMulWidgetFlagFastScroll) + { + mCoverflowControl->SetHoldingEnabled(); + } + } + +// --------------------------------------------------------------------------- +// IsFlagSet +// --------------------------------------------------------------------------- +// +bool MulCoverFlowWidget::IsFlagSet( TMulWidgetPropertiesFlag aAnyFlag ) const + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::IsFlagSet"); + + return (mWidgetPropertyFlag & aAnyFlag); + + } + +// --------------------------------------------------------------------------- +// GetFlags +// --------------------------------------------------------------------------- +// +unsigned int MulCoverFlowWidget::GetFlags() const + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::GetFlags"); + return mWidgetPropertyFlag; + } + +// --------------------------------------------------------------------------- +// SetRect +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetRect( int /*aLeftMargin*/, int /*aTopmargin*/, int /*aHeight*/, + int /*aWidth*/, int /*aTransitionTime*/ ) + { + //@todo need to be removed once its removed from imulwidget. + } +// --------------------------------------------------------------------------- +// ShowWidget +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::ShowWidget( bool aShow, int aTransitionTime ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::ShowWidget"); + mBaseElement->ShowWidget( aShow,aTransitionTime ); + + // Reset the flag . Event handling gets disabled once the flag is reset to false. + mCoverflowControl->ResetShowWidgetFlag( aShow ); + } + +// --------------------------------------------------------------------------- +// SetModel +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetModel( IMulModelAccessor* aAccessor, bool aFlag ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetModel"); + + //remove from observing change from old model + if ( mMulModelAccessor != aAccessor ) + { + if (mMulModelAccessor && control()) + { + ((IMulModelAccessor*)model())->RemoveModelObserver(static_cast( control())); + } + // Release the old model. + if (mTakesModelOwnership) + { + delete mMulModelAccessor; + } + // Set the new model. + mMulModelAccessor = aAccessor; + mTakesModelOwnership=aFlag; + } + else // just copy the ownership flag + { + if (mMulModelAccessor != NULL) + { + mTakesModelOwnership=aFlag; + } + } + + IMulSliderWidget* sliderWidget = static_cast(mCoverflowControl->GetSliderWidget()); + // cancel all previous commands (like marquee and bounce) + mCoverflowControl->Env().CancelCustomCommands(mCoverflowControl); + + if( aAccessor ) + { + mMulModelAccessor = aAccessor; + MUL_LOG_INFO("MUL::MulCoverFlowWidget::SetModel()::SetVisibleWindow "); + aAccessor->AddModelObserver(mCoverflowControl); + // Notify the control regarding model change. + mCoverflowControl->ModelChanged(aAccessor); + + if( aAccessor->CurrentItemCount() <= 0 ) + { + if(sliderWidget) + { + mBaseElement->ShowSlider(false); + } + } + } + else // For Null Model case + { + mCoverflowControl->RecycleVisuals(); + mBaseElement->ShowEmptyText( true ); + + if( sliderWidget ) + { + mBaseElement->ShowSlider(false); + } + } + } + +// --------------------------------------------------------------------------- +// GetIconSize +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::GetIconSize( mulwidget::TLogicalTemplate aTemplateId, + mulvisualitem::TVisualAttribute aAttribute, int& aHeight, int& aWidth) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::GetIconSize"); + if((aAttribute == mulvisualitem::KMulIcon1) || + (aAttribute == mulvisualitem::KMulIndicator2)) + { + mBaseElement->GetIconSize(aTemplateId,aAttribute,aHeight,aWidth); + } + else + { + __MUL_ASSERT( false,KInvalidArgument); + } + } + +// --------------------------------------------------------------------------- +// GetIconSize +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::GetIconSize(mulvisualitem::TVisualAttribute aAttribute, + int& aHeight, int& aWidth) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::GetIconSize"); + __MUL_ASSERT( mMulModelAccessor != 0,KTemplateNotFound); + if((aAttribute == mulvisualitem::KMulIcon1) || + (aAttribute == mulvisualitem::KMulIndicator2)) + { + mBaseElement->GetIconSize(mMulModelAccessor->Template(),aAttribute, + aHeight,aWidth); + } + else + { + __MUL_ASSERT( false,KInvalidArgument); + } + } + + // --------------------------------------------------------------------------- + // makeInterface + // --------------------------------------------------------------------------- + // +IAlfInterfaceBase* MulCoverFlowWidget::makeInterface( const IfId& /*aType*/ ) + { + return static_cast( this ); + } + +// --------------------------------------------------------------------------- +// setChildFocus +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::setChildFocus( bool /*aFocus*/ ) + { + // pure virtual function of base Class. + // not usefull for this widget + } + +void MulCoverFlowWidget::setPresentation(const char* /*aFilePath*/) + { + // pure virtual function of base Class. + // not usefull for this widget + } + +// --------------------------------------------------------------------------- +// AddEventHandler +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::AddEventHandler( IAlfWidgetEventHandler& aObserver ) + { + control()->addEventHandler( &aObserver ); + } + +// --------------------------------------------------------------------------- +// RemoveEventHandler +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::RemoveEventHandler( IAlfWidgetEventHandler& aObserver ) + { + control()->removeEventHandler( aObserver ); + } +// --------------------------------------------------------------------------- +// ContainerLayout +// --------------------------------------------------------------------------- +// +const CAlfLayout& MulCoverFlowWidget::ContainerLayout() + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::ContainerLayout"); + CAlfLayout* layout=(CAlfLayout*)mBaseElement->findVisual(0); + return *layout; + } +// --------------------------------------------------------------------------- +// SetEmptyText +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetEmptyText( const UString& aDefaultText) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetEmptyText"); + mBaseElement->SetEmptyText(aDefaultText); + } + +// --------------------------------------------------------------------------- +// SetMarkMode +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetMarkMode(bool /*aFlag*/) + { + // Marking mode is not supported by coverflow widget. + } + +// --------------------------------------------------------------------------- +// IsMarkMode +// --------------------------------------------------------------------------- +// +bool MulCoverFlowWidget::IsMarkMode()const + { + // Marking mode is not supported by coverflow widget. + return false; + } + +// --------------------------------------------------------------------------- +// SetReorderMode +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetReorderMode(TMulReOrderMode /*aReorderMode*/) + { + // reorder mode is not supported by coverflow widget. + } + +// --------------------------------------------------------------------------- +// IsReorderMode +// --------------------------------------------------------------------------- +// +bool MulCoverFlowWidget::IsReorderModeOn() const + { + // reorder mode is not supported by coverflow widget. + return false; + } + +// --------------------------------------------------------------------------- +// SetOverlay +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetOverlay(TMulAttributeDataType /*aType*/, const UString& /*aAttribute*/, + const UString& /*aFormat*/) + { + // No implementation . + } + +// --------------------------------------------------------------------------- +// SetAnimationTime +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetAnimationTime( TMulVisualEffect aVisualEffect, int aTransitionTime ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetAnimationTime"); + // EHighlightTransition is used to set coverflow step scroll animation time. + if( aVisualEffect == EHighlightTransition ) + { + mBaseElement->SetScrollAnimationTime(aTransitionTime); + } + } +// --------------------------------------------------------------------------- +// SetUIOnOFF +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetUIMode(bool UIOn, int aTransition ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetUIMode"); + mBaseElement->UIOnOffMode( UIOn,aTransition ); + } + +// --------------------------------------------------------------------------- +// SetVisualColor +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetVisualColor( TMulVisualType aVisualType , const TRgb& aColor ) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetVisualColor"); + switch(aVisualType) + { + case EItemBackgroundBrush: + { + mBaseElement->SetItemBrush(aColor); + } + break; + case ECoverflowCounterVisual: + { + mBaseElement->SetTextColor(ECounterVisual,aColor); + } + break; + case ETextVisual: + { + mBaseElement->SetTextColor(ETilteDetailTextVisual,aColor); + } + break; + default: + break; + + } + } + +// --------------------------------------------------------------------------- +// SetDefaultImage +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::SetDefaultImage(int aTextureId) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::SetDefaultImage"); + mCoverflowControl->SetDefaultImage(aTextureId); + } + +// --------------------------------------------------------------------------- +// RotateImage +// --------------------------------------------------------------------------- +// +void MulCoverFlowWidget::RotateImage(TMulRotation aDirection,TSize aImageSize,int aAnimationTime) + { + MUL_LOG_ENTRY_EXIT("aakash::MulCoverFlowWidget::RotateImage"); + mBaseElement->RotateImage(aDirection,aImageSize,aAnimationTime); + } + +// --------------------------------------------------------------------------- +// Gesturehelper +// --------------------------------------------------------------------------- +// +GestureHelper::CGestureHelper* MulCoverFlowWidget::Gesturehelper() + { + return mCoverflowControl->Gesturehelper(); + } + + } //namespace alf + +//End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverflowwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverflowwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2007-2008 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: factory plugin Implementation +* +*/ + +// Include Files + +#include "mulcoverflowwidgetfactoryplugin.h" +#include "mulcoverflowwidget.h" + +namespace Alf + { + +const TInt KCoverFlowWidgetFactoryPluginUid = + { + 0x2000D241 + }; + +const int KProductCount = 1; + +static const char* const KWidget = "mulcoverflowwidget"; + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +MulCoverFlowWidgetFactoryPlugin* MulCoverFlowWidgetFactoryPlugin::NewL() + { + return new(ELeave)MulCoverFlowWidgetFactoryPlugin; + } + +// --------------------------------------------------------------------------- +// ~MulCoverFlowWidgetFactoryPlugin +// --------------------------------------------------------------------------- +// +MulCoverFlowWidgetFactoryPlugin::~MulCoverFlowWidgetFactoryPlugin() + { + } + +// --------------------------------------------------------------------------- +// createProduct +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulCoverFlowWidgetFactoryPlugin::createProduct( + const char* aProduct, + void* aInitData) + { + IAlfInterfaceBase* ret(0); + + //Creates the instance of the CoverFlow widget + if(!strcmp(aProduct,KWidget)) + { + AlfWidgetInitData* initData = reinterpret_cast(aInitData); + auto_ptr Widget (new (EMM) MulCoverFlowWidget(*initData->mEnv, + initData->mWidgetId,*initData->mContainerWidget) ); + ret = Widget->makeInterface(IMulCoverFlowWidget::Type()); + Widget.release(); + } + return ret; + } + +// --------------------------------------------------------------------------- +// makeInterface +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulCoverFlowWidgetFactoryPlugin::makeInterface( + const IfId& aType) + { + if( UString(aType.mImplementationId) == UString(IAlfFactoryPlugin::type().mImplementationId) ) + { + return static_cast(this); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// productCount +// --------------------------------------------------------------------------- +// +int MulCoverFlowWidgetFactoryPlugin::productCount()const + { + return KProductCount; + } + +// --------------------------------------------------------------------------- +// productInfo +// --------------------------------------------------------------------------- +// +const char* MulCoverFlowWidgetFactoryPlugin::productInfo(int aIndex)const + { + /// @bug minor:avanhata:3/7/2008 good old if would be clearer + /// (Surely it is a caller error to call this function with aIndex >= productCount() + /// anyway, so can simply assert) + switch(aIndex) + { + case 0: + return KWidget; + + default: + break; + } + + return 0; + } + + } //namespace Alf +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +using namespace Alf; + +const TImplementationProxy + ImplementationTable[] = + { + #ifdef __EABI__ + + IMPLEMENTATION_PROXY_ENTRY(KCoverFlowWidgetFactoryPluginUid, MulCoverFlowWidgetFactoryPlugin::NewL) + + #else + + { {KCoverFlowWidgetFactoryPluginUid},MulCoverFlowWidgetFactoryPlugin::NewL } + + #endif + }; + +OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +//End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcoverlogicaltemplatebase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcoverlogicaltemplatebase.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2008 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: Description of various grid templates + * +*/ + + +#include "mulcoverlogicaltemplatebase.h" + +namespace Alf + { + + MulCoverLogicalTemplateBase::~MulCoverLogicalTemplateBase() + { + for(int i =0; i < mTemplatePrtStruct.size(); ++i) + { + delete mTemplatePrtStruct[i]; + } + + for(int i =0; i < mTemplateLscStruct.size(); ++i) + { + delete mTemplateLscStruct[i]; + } + } + //---------------------------------------------------------------- + // GetElementStructure + //---------------------------------------------------------------- + // + const LCTElementStructure* MulCoverLogicalTemplateBase::GetElementStructure( + TMulCurrentOrientation aCurOrient, + const char* aElemId) + { + + LCTElementStructure* returnElem = NULL; + + if(aCurOrient == EMulPortrait) + { + + for (vector::const_iterator itP = mTemplatePrtStruct.begin(); + itP!=mTemplatePrtStruct.end(); ++itP) + { + if(!strcmp(((*itP)->GetId()).getUtf8(),aElemId)) + returnElem = (*itP); + } + } + else if(aCurOrient == EMulLandScape) + { + for (vector::const_iterator itL = mTemplateLscStruct.begin(); + itL!=mTemplateLscStruct.end(); ++itL) + { + if(!strcmp(((*itL)->GetId()).getUtf8(),aElemId)) + returnElem = (*itL); + } + } + return returnElem; + + } + + void MulCoverLogicalTemplateBase::PopulateData () + { + } + }// End of Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcovertemplate1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcovertemplate1.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,533 @@ +/* +* Copyright (c) 2007-2008 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: Description of various grid templates + * +*/ + + +// Class Header +#include "mulcoverflowtemplate.h" + +// system includes +#include +#include +#include +#include + +// Local includes +#include "mulassert.h" +#include "mulcoverflowcontrol.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulCoverLogicalTemplate1 +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate1::MulCoverFlowTemplate1(MulCoverFlowControl &aControl, + MulBaseElement &aBaseElement):MulCoverFlowTemplate(aControl, aBaseElement) + { + + } + +// --------------------------------------------------------------------------- +// ~MulCoverLogicalTemplate1 +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate1::~MulCoverFlowTemplate1() + { + + } + +// --------------------------------------------------------------------------- +// GetIconSize +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, int& aHeight, int& aWidth) + { + int appMainPaneVerityId; + int coverFlowPaneVarietyId; + int imagePaneVerityId ; + if (aIslandscape) + { + appMainPaneVerityId = 3; + coverFlowPaneVarietyId = 2; + imagePaneVerityId = 4; + } + else + { + appMainPaneVerityId = 5; + coverFlowPaneVarietyId = 0; + imagePaneVerityId = 0; + } + + // Get the size of the appwindow + TAknWindowLineLayout appMainLayout = + AknLayoutScalable_UiAccel::main_pane(appMainPaneVerityId).LayoutLine(); + TAknLayoutRect appMainRect; + appMainRect.LayoutRect( AlfUtil::ScreenSize(), appMainLayout ); + TSize appMainSize(appMainRect.Rect().Size()); + + // Get the size of the coverflow main window + TAknWindowLineLayout mainLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(coverFlowPaneVarietyId).LayoutLine(); + TAknLayoutRect mainRect; + mainRect.LayoutRect( appMainSize, mainLayout ); + TSize mainSize(mainRect.Rect().Size()); + + switch(aAttribute) + { + case mulvisualitem::KMulIcon1: + { + TAknWindowLineLayout centerLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneVerityId).LayoutLine(); + TAknLayoutRect centerRect; + centerRect.LayoutRect( TSize(mainSize), centerLayout ); + aHeight = centerRect.Rect().Size().iHeight; + aWidth = centerRect.Rect().Size().iWidth; + break; + } + default: + { + // invalid attribute + // raise exception. + __MUL_ASSERT(false,KInvalidAttribute); + + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CreateVisualisation +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange) + { + mData->mOrientationChange = aIsOrientationChange; + + // set the default attribue of the template + // irrespective of the orientation + mData->mUiOnOffFlag = false; + mData->mMaxVisibleCount = 3; + mData->mEnhancedSupportFlag = false; + + // store the default attribute in base element + mData->mBaseElement->SetFitMode(false); + + if (aIsLandscape) + { + // create visualisation for landscape + CreateLscStructure(); + } + else + { + // create visualisation for potrait + CreatePrtStructure(); + } + mData->mOrientationChange = false; + } + +// --------------------------------------------------------------------------- +// CreatePrtStructure +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::CreatePrtStructure() + { + // list of all component lct verity id. + int mainPaneVerityId = 0; + int imagePaneCenterVerityId = 0; + int counterPaneVerityId = 0; + + CAlfVisual* main = mData->mBaseElement->findVisual(KMainLayoutIndex); + CAlfLayout* parentLayout = main->Layout(); + TSize mainSize = parentLayout->Size().Target().AsSize(); + + // get for main layout + TAknWindowLineLayout componentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(mainPaneVerityId).LayoutLine(); + TRect mainRect = IconWindowRect(componentLayout, mainSize); + main->SetPos(TAlfRealPoint(0,0)); + main->SetSize(mainRect.Size()); + + + // for deck layout + CAlfDeckLayout& deckLayout = static_cast( + static_cast(main)->Visual(KMainLayoutIndex) ); + deckLayout.SetSize(mainRect.Size(),0); + + // if set background with some skin id is called before calling set model + // then the visual and texture would be created with 0,0 sizes + // hence we need to resize them + CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual); + if(backgroundVisual) + { + backgroundVisual->SetSize(mainRect.Size(),0); + } + + // for center item + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneCenterVerityId).LayoutLine(); + TRect centerRect = IconWindowRect(componentLayout,mainRect); + + TMulCoverFlowItem highlightItem(centerRect.iTl.iX, + centerRect.iTl.iY,centerRect.Size().iWidth,centerRect.Size().iHeight); + + // apply attribute + mData->mBaseElement->StoreVisualDimensions(highlightItem,highlightItem,1); + + ApplyCounterAttribute(counterPaneVerityId,mainRect); + ApplyTextAttribute(mainRect); + + // set the status of the slider + mData->mSliderEnabled = true; + ApplySliderAttribute(mainRect); + } + +// --------------------------------------------------------------------------- +// CreateLscStructure +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::CreateLscStructure() + { + // list of all component lct verity id. + int mainPaneVerityId = 2; + int imagePaneCenterVerityId = 4; + int imagePaneRightVerityId = 3; + int counterPaneVerityId = 4; + + CAlfVisual* main = mData->mBaseElement->findVisual(KMainLayoutIndex); + CAlfLayout* parentLayout = main->Layout(); + TSize mainSize = parentLayout->Size().Target().AsSize(); + + // get for main layout + TAknWindowLineLayout componentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(mainPaneVerityId).LayoutLine(); + TRect mainRect = IconWindowRect(componentLayout, mainSize); + main->SetPos(TAlfRealPoint(0,0)); + main->SetSize(mainRect.Size()); + + + // for deck layout + CAlfDeckLayout& deckLayout = static_cast( + static_cast(main)->Visual(KMainLayoutIndex) ); + deckLayout.SetSize(mainRect.Size(),0); + + // if set background with some skin id is called before calling set model + // then the visual and texture would be created with 0,0 sizes + // hence we need to resize them + CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual); + if(backgroundVisual) + { + backgroundVisual->SetSize(mainRect.Size(),0); + } + + // for center item + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneCenterVerityId).LayoutLine(); + TRect centerRect = IconWindowRect(componentLayout,mainRect); + + TMulCoverFlowItem highlightItem(centerRect.iTl.iX, + centerRect.iTl.iY,centerRect.Size().iWidth,centerRect.Size().iHeight); + + // for right item + if (AknLayoutUtils::LayoutMirrored()) + { + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane_cp001(imagePaneRightVerityId).LayoutLine(); + } + else + { + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane_cp002(imagePaneRightVerityId).LayoutLine(); + } + TRect rightItemRect = IconWindowRect(componentLayout,mainRect); + + TMulCoverFlowItem nonHighlightItem(rightItemRect.iTl.iX, + rightItemRect.iTl.iY,rightItemRect.Size().iHeight,rightItemRect.Size().iHeight); + + // apply attribute + mData->mBaseElement->StoreVisualDimensions(highlightItem,nonHighlightItem,3); + + ApplyCounterAttribute(counterPaneVerityId,mainRect); + ApplyTextAttribute(mainRect); + + // set the status of the slider + mData->mSliderEnabled = false; + } + +// --------------------------------------------------------------------------- +// ApplyCounterAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect) + { + TAknTextLineLayout counterComponentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane_t1(acounterPaneVerityId).LayoutLine(); + + TRect counterRect = TextWindowRect(counterComponentLayout,aMainRect); + TSize counterSize(counterRect.Size()); + mData->mCounterDimensions.posx = counterRect.iTl.iX; + mData->mCounterDimensions.posy = counterRect.iTl.iY; + mData->mCounterDimensions.width = counterSize.iWidth; + mData->mCounterDimensions.height = counterSize.iHeight; + + // Set Properties to Counter Visual if we are creating. + // no need to apply attribute for orientation change + // as all are same. + if(!mData->mOrientationChange) + { + // Create a Counter visual if it is not Created. + CAlfTextVisual& counterVisual = mData->mBaseElement->CounterVisual(); + + //get font Id for counter + int fontId = counterComponentLayout.FontId(); + int counterFontId = 0x000000FF & fontId; + // apply default attribute + counterVisual.SetAlign(EAlfAlignHCenter,EAlfAlignVCenter); + SetTextStyle(counterFontId, counterVisual); + + // check if user has set some different attribute. + TMulVisualColorProperty counterColor = mData->mBaseElement->TextColor(ECounterVisual); + if (counterColor.mIsColorSet) + { + // apply the color set by the application + counterVisual.SetColor(counterColor.mColor); + } + else + { + // apply the default color + counterVisual.SetColor(KRgbWhite); + } + mData->mCounterFontMaxCharLength = UpdateMaxFontWidth(&counterVisual); + } + } + +// --------------------------------------------------------------------------- +// ApplyTextAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::ApplyTextAttribute(const TRect& aMainRect) + { + // list of all component lct verity id. + int textPaneVerityId ; + int textPaneBgVerityId ; + int textPaneTitleVerityId ; + int textPaneDetailVerityId ; + float bgTextOpacity; + + if (mData->mControl->IsLandscape()) + { + textPaneVerityId = 3; + textPaneBgVerityId = 0; + textPaneTitleVerityId = 0; + textPaneDetailVerityId = 0; + bgTextOpacity = 0.5; + } + else + { + textPaneVerityId = 0; + textPaneBgVerityId = 0; + textPaneTitleVerityId = 0; + textPaneDetailVerityId = 0; + bgTextOpacity = 0; + } + + // set text visibility + mData->mBaseElement->StoreTextVisibility( true ); + + // Create and apply attribute for text visual. + + CAlfLayout& textLayout = mData->mBaseElement->TextLayout(); + + // for parent text layout + TAknWindowLineLayout windowLineLayout = + AknLayoutScalable_UiAccel::aacf_image_title_pane(textPaneVerityId).LayoutLine(); + TRect textRect = IconWindowRect(windowLineLayout, aMainRect); + TRect textLayoutRect = TRect(0,0,textRect.Width(),textRect.Height()); + + // set the position of parent text layout. + textLayout.SetPos(textRect.iTl); + textLayout.SetSize(textRect.Size()); + + // for the background visual + CAlfTextVisual* bkgTextVisual = static_cast( + textLayout.FindTag(KLitMulBackGround)); + if(!bkgTextVisual) + { + bkgTextVisual = CAlfTextVisual::AddNewL(*mData->mControl, &textLayout); + bkgTextVisual->SetTagL(KLitMulBackGround); + bkgTextVisual->SetFlag(EAlfVisualFlagIgnorePointer); + } + windowLineLayout = + AknLayoutScalable_UiAccel::aacf_image_title_pane_g1(textPaneBgVerityId).LayoutLine(); + TRect bkgRect = IconWindowRect(windowLineLayout , textLayoutRect); + bkgTextVisual->SetSize(bkgRect.Size()); + bkgTextVisual->SetPos(bkgRect.iTl); + + ApplyBrush(*bkgTextVisual,KRgbBlack,bgTextOpacity); + + ApplyTitleTextAttribute(textPaneTitleVerityId,textLayoutRect); + ApplyDetailTextAttribute(textPaneDetailVerityId,textLayoutRect); + + } + +// --------------------------------------------------------------------------- +// ApplyTitleTextAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::ApplyTitleTextAttribute(int atextPaneTitleVerityId,const TRect& aTextLayoutRect) + { + + // get the main text layout + CAlfLayout& textLayout = mData->mBaseElement->TextLayout(); + + // for title visual + CAlfViewportLayout *viewPortLayout =static_cast( + textLayout.FindTag(KTitleViewPortLayout)); + if(viewPortLayout == NULL) + { + viewPortLayout = CAlfViewportLayout::AddNewL(*mData->mControl, + &textLayout); + viewPortLayout->SetTagL(KTitleViewPortLayout); + viewPortLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + viewPortLayout->SetFlag(EAlfVisualFlagIgnorePointer); + } + else + { + viewPortLayout = static_cast ( + textLayout.FindTag(KTitleViewPortLayout)); + } + TAknTextLineLayout textWindowLayout = + AknLayoutScalable_UiAccel::aacf_image_title_pane_t1(atextPaneTitleVerityId).LayoutLine(); + TRect titleRect = TextWindowRect(textWindowLayout, aTextLayoutRect); + mData->mTitleParentSize = titleRect.Size(); + viewPortLayout->SetSize(titleRect.Size()); + viewPortLayout->SetPos(titleRect.iTl); + viewPortLayout->SetViewportSize(TAlfRealSize(titleRect.Size()),0); + viewPortLayout->SetClipping(true); + CAlfTextVisual* textVisual = static_cast( + &mData->mBaseElement->CreateTextVisual(KCoverflowTitle,*viewPortLayout)); + + if(!mData->mOrientationChange) + { + //Get font ID + int fontId = textWindowLayout.FontId(); + int textFontId = 0x000000FF & fontId; + SetTextStyle(textFontId, *textVisual); + mData->mTitleFontMaxCharLength = UpdateMaxFontWidth(textVisual); + // Apply default attribute. + textVisual->SetAlign(EAlfAlignHLocale,EAlfAlignVCenter); + textVisual->SetOpacity(1); + + // check if user has set some different attribute. + TMulVisualColorProperty textColor = mData->mBaseElement->TextColor(ETilteDetailTextVisual); + if (textColor.mIsColorSet) + { + // apply the color set by the application + textVisual->SetColor(textColor.mColor); + } + else + { + // apply the default color + textVisual->SetColor(KRgbWhite); + } + } + } + +// --------------------------------------------------------------------------- +// ApplyDetailTextAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::ApplyDetailTextAttribute(int aTextPaneDetailVerityId,const TRect& aTextLayoutRect) + { + // get the main text layout + CAlfLayout& textLayout = mData->mBaseElement->TextLayout(); + + CAlfViewportLayout *viewPortLayout = NULL; + CAlfTextVisual* textVisual = NULL; + viewPortLayout =static_cast( + textLayout.FindTag(KDetailViewPortLayout)); + if(viewPortLayout == NULL) + { + viewPortLayout = CAlfViewportLayout::AddNewL(*mData->mControl, + &textLayout); + viewPortLayout->SetTagL(KDetailViewPortLayout); + viewPortLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + viewPortLayout->SetFlag(EAlfVisualFlagIgnorePointer); + } + else + { + viewPortLayout = static_cast ( + textLayout.FindTag(KDetailViewPortLayout)); + } + TAknTextLineLayout textWindowLayout = + AknLayoutScalable_UiAccel::aacf_image_title_pane_t2(aTextPaneDetailVerityId).LayoutLine(); + TRect detailRect = TextWindowRect(textWindowLayout, aTextLayoutRect); + mData->mDetailParentSize = detailRect.Size(); + viewPortLayout->SetSize(detailRect.Size()); + viewPortLayout->SetPos(detailRect.iTl); + viewPortLayout->SetViewportSize(TAlfRealSize(detailRect.Size()),0); + + viewPortLayout->SetClipping(true); + textVisual = static_cast( + &mData->mBaseElement->CreateTextVisual(KCoverflowDetail , *viewPortLayout )); + if(!mData->mOrientationChange) + { + //Get font ID + int fontId = textWindowLayout.FontId(); + int textFontId = 0x000000FF & fontId; + SetTextStyle(textFontId, *textVisual); + mData->mDetailFontMaxCharLength = UpdateMaxFontWidth(textVisual); + // Apply default attribute. + textVisual->SetAlign(EAlfAlignHLocale,EAlfAlignVCenter); + textVisual->SetOpacity(0.7); + + // check if user has set some different attribute. + TMulVisualColorProperty textColor = mData->mBaseElement->TextColor(ETilteDetailTextVisual); + if (textColor.mIsColorSet) + { + // apply the color set by the application + textVisual->SetColor(textColor.mColor); + } + else + { + // apply the default color + textVisual->SetColor(KRgbWhite); + } + } + + } + +// --------------------------------------------------------------------------- +// ApplySliderAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate1::ApplySliderAttribute(const TRect& aMainRect) + { + int sliderPaneVerityId = 1; + + TAknWindowLineLayout componentLayout = + AknLayoutScalable_UiAccel::aacf_slider_pane(sliderPaneVerityId).LayoutLine(); + TRect sliderRect = IconWindowRect(componentLayout, aMainRect); + TSize sliderSize(sliderRect.Size()); + mData->mSliderDimensions.height = sliderSize.iHeight; + mData->mSliderDimensions.width = sliderSize.iWidth; + mData->mSliderDimensions.posx = sliderRect.iTl.iX; + mData->mSliderDimensions.posy = sliderRect.iTl.iY; + } + + }//namespace ends diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcovertemplate2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcovertemplate2.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,604 @@ +/* +* Copyright (c) 2007-2008 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: Description of various grid templates + * +*/ + + +#include "mulcovertemplates.h" +#include "mulcoverflowdefinitions.h" +#include "mulvisualutility.h" +#include "mulutility.h" +#include + +namespace Alf + { + +MulCoverLogicalTemplate2::~MulCoverLogicalTemplate2() + { + + } + +//---------------------------------------------------------------- +// PopulateData +//---------------------------------------------------------------- +// +void MulCoverLogicalTemplate2::PopulateData () + { + //For base element + LCTElementStructure* prtBaseElem = new (EMM) LCTElementStructure(); + //for main layout + prtBaseElem->SetId(UString(KBase)); + LCTVisualStructure* mainPrtVS = new (EMM) LCTVisualStructure(); + mainPrtVS->SetId(UString(KMainLayout)); + //@todo:: later these need to be retrieved from LCT utility + mainPrtVS->SetPositions(0,0); + mainPrtVS->SetDimensions(360,441); + mainPrtVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + mainPrtVS->SetVarietyId(3); + CustomAttributeStructure* mainPrtOpacity = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + mainPrtVS->AddAttribute(mainPrtOpacity); + prtBaseElem->AddVisualStructure(mainPrtVS); + //for item_center + LCTVisualStructure* item_centerPrtVS = new (EMM) LCTVisualStructure(); + item_centerPrtVS->SetId(UString(KItemCentre)); + item_centerPrtVS->SetPositions(10,22); + item_centerPrtVS->SetDimensions(340,340); + item_centerPrtVS->SetLCTId(UString("uiaccel_aacf_image_pane")); + item_centerPrtVS->SetVarietyId(0); + + CustomAttributeStructure* item_centerPrtFM = new (EMM) CustomAttributeStructure( + UString("fitmode"), UString("off")); + item_centerPrtVS->AddAttribute(item_centerPrtFM); + prtBaseElem->AddVisualStructure(item_centerPrtVS); + //for counter visual + LCTVisualStructure* counterPrtVS = new (EMM) LCTVisualStructure(); + counterPrtVS->SetId(UString(KMulCount)); + counterPrtVS->SetPositions(238,0); + counterPrtVS->SetDimensions(112,21); + counterPrtVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane_t1")); + counterPrtVS->SetVarietyId(0); + //add extra attributes to the gridlayout + + CustomAttributeStructure* stylePrtC = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + + CustomAttributeStructure* opacityPrtC = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + + CustomAttributeStructure* redPrtC = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + + CustomAttributeStructure* greenPrtC = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + + CustomAttributeStructure* bluePrtC = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + + CustomAttributeStructure* alphaPrtC = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + + CustomAttributeStructure* horizontalalignPrtC = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("2")); + + counterPrtVS->AddAttribute(stylePrtC); + counterPrtVS->AddAttribute(opacityPrtC); + counterPrtVS->AddAttribute(redPrtC); + counterPrtVS->AddAttribute(greenPrtC); + counterPrtVS->AddAttribute(bluePrtC); + counterPrtVS->AddAttribute(alphaPrtC); + counterPrtVS->AddAttribute(horizontalalignPrtC); + + //for text layout + LCTVisualStructure* textPrtLtVS = new (EMM) LCTVisualStructure(); + textPrtLtVS->SetId(UString(KText)); + textPrtLtVS->SetPositions(10,230); + textPrtLtVS->SetDimensions(340,82); + textPrtLtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane")); + textPrtLtVS->SetVarietyId(0); + prtBaseElem->AddVisualStructure(textPrtLtVS); + + //for text background + LCTVisualStructure* textPrtBgVS = new (EMM) LCTVisualStructure(); + textPrtBgVS->SetId(UString(KMulBackGround)); + textPrtBgVS->SetPositions(0,0); + textPrtBgVS->SetDimensions(340,82); + textPrtBgVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_g1")); + textPrtBgVS->SetVarietyId(0); + //Add attributes to the text background visual + CustomAttributeStructure* bgHaPrtTV = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textPrtBgVS->AddAttribute(bgHaPrtTV); + CustomAttributeStructure* bgoPrtTV = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("0.5")); + textPrtBgVS->AddAttribute(bgoPrtTV); + CustomAttributeStructure* bgcPrtTV = new (EMM) CustomAttributeStructure( + UString("colour"), UString("0")); + textPrtBgVS->AddAttribute(bgcPrtTV); + prtBaseElem->AddVisualStructure(textPrtBgVS); + + //for text title + LCTVisualStructure* textTPrtVS = new (EMM) LCTVisualStructure(); + textTPrtVS->SetId(UString(KMulTitle)); + textTPrtVS->SetPositions(10,9); + textTPrtVS->SetDimensions(320,27); + textTPrtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t1")); + textTPrtVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textTStylePrt = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + textTPrtVS->AddAttribute(textTStylePrt); + + CustomAttributeStructure* textTFtcPrt = new (EMM) CustomAttributeStructure( + UString("fontthemecolor"), UString("9")); + textTPrtVS->AddAttribute(textTFtcPrt); + + CustomAttributeStructure* textTHaPrt = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textTPrtVS->AddAttribute(textTHaPrt); + + CustomAttributeStructure* textTVaPrt = new (EMM) CustomAttributeStructure( + UString("verticalalign"), UString("1")); + textTPrtVS->AddAttribute(textTVaPrt); + + CustomAttributeStructure* textTRedPrt = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + textTPrtVS->AddAttribute(textTRedPrt); + + CustomAttributeStructure* textTGreenPrt = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + textTPrtVS->AddAttribute(textTGreenPrt); + + CustomAttributeStructure* textTBluePrt = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + textTPrtVS->AddAttribute(textTBluePrt); + + CustomAttributeStructure* textTAlphaPrt = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + textTPrtVS->AddAttribute(textTAlphaPrt); + + CustomAttributeStructure* textTTsciPrt = new (EMM) CustomAttributeStructure( + UString("textskincolorid"), UString("KAknsIIDQsnTextColors")); + textTPrtVS->AddAttribute(textTTsciPrt); + + CustomAttributeStructure* textTTcsiPrt = new (EMM) CustomAttributeStructure( + UString("textcolorskinindex"), UString("5")); + textTPrtVS->AddAttribute(textTTcsiPrt); + + CustomAttributeStructure* textTOpacityPrt = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + textTPrtVS->AddAttribute(textTOpacityPrt); + + prtBaseElem->AddVisualStructure(textTPrtVS); + + //for text detail + LCTVisualStructure* textDPrtVS = new (EMM) LCTVisualStructure(); + textDPrtVS->SetId(UString(KMulDetail)); + textDPrtVS->SetPositions(10,46); + textDPrtVS->SetDimensions(320,27); + textDPrtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t2")); + textDPrtVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textDStylePrt = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + textDPrtVS->AddAttribute(textDStylePrt); + + CustomAttributeStructure* textDFtcPrt = new (EMM) CustomAttributeStructure( + UString("fontthemecolor"), UString("9")); + textDPrtVS->AddAttribute(textDFtcPrt); + + CustomAttributeStructure* textDHaPrt = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textDPrtVS->AddAttribute(textDHaPrt); + + CustomAttributeStructure* textDVaPrt = new (EMM) CustomAttributeStructure( + UString("verticalalign"), UString("1")); + textDPrtVS->AddAttribute(textDVaPrt); + + CustomAttributeStructure* textDRedPrt = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + textDPrtVS->AddAttribute(textTRedPrt); + + CustomAttributeStructure* textDGreenPrt = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + textDPrtVS->AddAttribute(textTGreenPrt); + + CustomAttributeStructure* textDBluePrt = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + textDPrtVS->AddAttribute(textTBluePrt); + + CustomAttributeStructure* textDAlphaPrt = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + textDPrtVS->AddAttribute(textTAlphaPrt); + + CustomAttributeStructure* textDTsciPrt = new (EMM) CustomAttributeStructure( + UString("textskincolorid"), UString("KAknsIIDQsnTextColors")); + textDPrtVS->AddAttribute(textTTsciPrt); + + CustomAttributeStructure* textDTcsiPrt = new (EMM) CustomAttributeStructure( + UString("textcolorskinindex"), UString("5")); + textDPrtVS->AddAttribute(textDTcsiPrt); + + CustomAttributeStructure* textDOpacityPrt = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("0.7")); + textDPrtVS->AddAttribute(textDOpacityPrt); + + CustomAttributeStructure* textDMarqueePrt = new (EMM) CustomAttributeStructure( + UString("marquee"), UString("yes")); + textDPrtVS->AddAttribute(textDMarqueePrt); + + prtBaseElem->AddVisualStructure(textDPrtVS); + + prtBaseElem->AddVisualStructure(counterPrtVS); + + mTemplatePrtStruct.push_back(prtBaseElem); + + //now populate data for prtNonhilightElem element + //---------------------------------------------------------------------- + LCTElementStructure* prtNonhilightElem = new (EMM) LCTElementStructure(); + prtNonhilightElem->SetId(UString("nohighlight")); + + //for backgroung of non-highlighted imagevisual + LCTVisualStructure* nHPrtDeckVs = new (EMM) LCTVisualStructure(); + nHPrtDeckVs->SetId(UString("deck")); + CustomAttributeStructure* nHPrtDeckOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1.0"),EAttributeOpacity); + nHPrtDeckVs->AddAttribute(nHPrtDeckOpacity); + prtNonhilightElem->AddVisualStructure(nHPrtDeckVs); + + //for non-highlighted imagevisual + LCTVisualStructure* nonHPrtIcon = new (EMM) LCTVisualStructure(); + nonHPrtIcon->SetVisualType(EVisualImage); + nonHPrtIcon->SetId(UString("mul_icon")); + nonHPrtIcon->SetPositions(0,0); + nonHPrtIcon->SetDimensions(340,340); + nonHPrtIcon->SetLCTId(UString("uiaccel_aacf_image_pane_g1")); + nonHPrtIcon->SetVarietyId(0); + + //ADD EXTRA ATTRIBUTE FOR FITMODE + + CustomAttributeStructure* nonHIPath = new CustomAttributeStructure( + UString("imagepath"),UString("mul_icon"),EAttributeNone, + ECategoryData); + nonHPrtIcon->AddAttribute(nonHIPath); + + CustomAttributeStructure* nHIOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1.0"),EAttributeOpacity); + nonHPrtIcon->AddAttribute(nHIOpacity); + + prtNonhilightElem->AddVisualStructure(nonHPrtIcon); + + mTemplatePrtStruct.push_back(prtNonhilightElem); + + //now populate data for prthilightElem element + //---------------------------------------------------------------------- + LCTElementStructure* prtHilightElem = new (EMM) LCTElementStructure(); + prtHilightElem->SetId(UString("highlight")); + + //for backgroung of non-highlighted imagevisual + LCTVisualStructure* hPrtDeckVs = new (EMM) LCTVisualStructure(); + hPrtDeckVs->SetId(UString("deck")); + CustomAttributeStructure* hDeckOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1.0"),EAttributeOpacity); + hPrtDeckVs->AddAttribute(hDeckOpacity); + prtHilightElem->AddVisualStructure(hPrtDeckVs); + + //for non-highlighted imagevisual + LCTVisualStructure* hPrtIcon = new (EMM) LCTVisualStructure(); + hPrtIcon->SetVisualType(EVisualImage); + hPrtIcon->SetId(UString("mul_icon")); + hPrtIcon->SetPositions(0,0); + hPrtIcon->SetDimensions(340,340); + hPrtIcon->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + hPrtIcon->SetVarietyId(0); + + //ADD EXTRA ATTRIBUTE FOR FITMODE + + CustomAttributeStructure* hIPath = new CustomAttributeStructure( + UString("mul_icon"),UString("imagepath"),EAttributeNone, + ECategoryData); + hPrtIcon->AddAttribute(hIPath); + + CustomAttributeStructure* hIOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1.0"),EAttributeOpacity); + hPrtIcon->AddAttribute(hIOpacity); + + prtHilightElem->AddVisualStructure(hPrtIcon); + + mTemplatePrtStruct.push_back(prtHilightElem); + + //========================================================================== + //same procedure for filling up of LSC + //========================================================================== + //for main layout + LCTElementStructure* lscBaseElem = new (EMM) LCTElementStructure(); + lscBaseElem->SetId(UString("base")); + LCTVisualStructure* mainLscVS2 = new (EMM) LCTVisualStructure(); + mainLscVS2->SetId(UString("mainlayout")); + mainLscVS2->SetPositions(0,0); + mainLscVS2->SetDimensions(502,299); + mainLscVS2->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + mainLscVS2->SetVarietyId(0); + CustomAttributeStructure* mainLscOpacity = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + mainLscVS2->AddAttribute(mainLscOpacity); + lscBaseElem->AddVisualStructure(mainLscVS2); + //for item_center + LCTVisualStructure* item_centerLscVs = new (EMM) LCTVisualStructure(); + item_centerLscVs->SetId(UString("item_center")); + item_centerLscVs->SetPositions(114,16); + item_centerLscVs->SetDimensions(266,266); + item_centerLscVs->SetLCTId(UString("uiaccel_aacf_image_pane")); + item_centerLscVs->SetVarietyId(1); + CustomAttributeStructure* item_centerLscFM = new (EMM) CustomAttributeStructure( + UString("fitmode"), UString("off")); + item_centerLscVs->AddAttribute(item_centerLscFM); + lscBaseElem->AddVisualStructure(item_centerLscVs); + // For Counter + LCTVisualStructure* counterLscVS = new (EMM) LCTVisualStructure(); + counterLscVS->SetId(UString("mul_count")); + counterLscVS->SetPositions(420,32); + counterLscVS->SetDimensions(112,21); + counterLscVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane_t1")); + counterLscVS->SetVarietyId(1); + //add extra attributes to the gridlayout + CustomAttributeStructure* styleLscC = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + + CustomAttributeStructure* opacityLscC = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + + CustomAttributeStructure* redLscC = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + + CustomAttributeStructure* greenLscC = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + + CustomAttributeStructure* blueLscC = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + + CustomAttributeStructure* alphaLscC = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + + CustomAttributeStructure* horizontalalignLscC = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("2")); + + counterLscVS->AddAttribute(styleLscC); + counterLscVS->AddAttribute(opacityLscC); + counterLscVS->AddAttribute(redLscC); + counterLscVS->AddAttribute(greenLscC); + counterLscVS->AddAttribute(blueLscC); + counterLscVS->AddAttribute(alphaLscC); + counterLscVS->AddAttribute(horizontalalignLscC); + + lscBaseElem->AddVisualStructure(counterLscVS); + + //for text layout + LCTVisualStructure* textLscLtVS = new (EMM) LCTVisualStructure(); + textLscLtVS->SetId(UString(KText)); + textLscLtVS->SetPositions(114,210); + textLscLtVS->SetDimensions(266,72); + textLscLtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane")); + textLscLtVS->SetVarietyId(1); + lscBaseElem->AddVisualStructure(textLscLtVS); + + //for text background + LCTVisualStructure* textLscBgVS = new (EMM) LCTVisualStructure(); + textLscBgVS->SetId(UString(KMulBackGround)); + textLscBgVS->SetPositions(0,0); + textLscBgVS->SetDimensions(266,72); + textLscBgVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_g1")); + textLscBgVS->SetVarietyId(0); + //Add attributes to the text background visual + CustomAttributeStructure* bgHaLscTV = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textLscBgVS->AddAttribute(bgHaLscTV); + CustomAttributeStructure* bgoLscTV = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("0.5")); + textLscBgVS->AddAttribute(bgoLscTV); + CustomAttributeStructure* bgcLscTV = new (EMM) CustomAttributeStructure( + UString("colour"), UString("0")); + textLscBgVS->AddAttribute(bgcLscTV); + lscBaseElem->AddVisualStructure(textLscBgVS); + + //for text title + LCTVisualStructure* textTLscVS = new (EMM) LCTVisualStructure(); + textTLscVS->SetId(UString(KMulTitle)); + textTLscVS->SetPositions(3,4); + textTLscVS->SetDimensions(260,27); + textTLscVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t1")); + textTLscVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textTStyleLsc = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + textTLscVS->AddAttribute(textTStyleLsc); + + CustomAttributeStructure* textTFtcLsc = new (EMM) CustomAttributeStructure( + UString("fontthemecolor"), UString("9")); + textTLscVS->AddAttribute(textTFtcLsc); + + CustomAttributeStructure* textTHaLsc = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textTLscVS->AddAttribute(textTHaLsc); + + CustomAttributeStructure* textTVaLsc = new (EMM) CustomAttributeStructure( + UString("verticalalign"), UString("1")); + textTLscVS->AddAttribute(textTVaLsc); + + CustomAttributeStructure* textTRedLsc = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + textTLscVS->AddAttribute(textTRedLsc); + + CustomAttributeStructure* textTGreenLsc = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + textTLscVS->AddAttribute(textTGreenLsc); + + CustomAttributeStructure* textTBlueLsc = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + textTLscVS->AddAttribute(textTBlueLsc); + + CustomAttributeStructure* textTAlphaLsc = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + textTLscVS->AddAttribute(textTAlphaLsc); + + CustomAttributeStructure* textTTsciLsc = new (EMM) CustomAttributeStructure( + UString("textskincolorid"), UString("KAknsIIDQsnTextColors")); + textTLscVS->AddAttribute(textTTsciLsc); + + CustomAttributeStructure* textTTcsiLsc = new (EMM) CustomAttributeStructure( + UString("textcolorskinindex"), UString("5")); + textTLscVS->AddAttribute(textTTcsiLsc); + + CustomAttributeStructure* textTOpacityLsc = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("1.0")); + textTLscVS->AddAttribute(textTOpacityLsc); + + lscBaseElem->AddVisualStructure(textTLscVS); + + //for text detail + LCTVisualStructure* textDLscVS = new (EMM) LCTVisualStructure(); + textDLscVS->SetId(UString(KMulDetail)); + textDLscVS->SetPositions(4,38); + textDLscVS->SetDimensions(260,27); + textDLscVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t2")); + textDLscVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textDStyleLsc = new (EMM) CustomAttributeStructure( + UString("style"), UString("qfn_secondary")); + textDLscVS->AddAttribute(textDStyleLsc); + + CustomAttributeStructure* textDFtcLsc = new (EMM) CustomAttributeStructure( + UString("fontthemecolor"), UString("9")); + textDLscVS->AddAttribute(textDFtcLsc); + + CustomAttributeStructure* textDHaLsc = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("1")); + textDLscVS->AddAttribute(textDHaLsc); + + CustomAttributeStructure* textDVaLsc = new (EMM) CustomAttributeStructure( + UString("verticalalign"), UString("1")); + textDLscVS->AddAttribute(textDVaLsc); + + CustomAttributeStructure* textDRedLsc = new (EMM) CustomAttributeStructure( + UString("red"), UString("255")); + textDLscVS->AddAttribute(textDRedLsc); + + CustomAttributeStructure* textDGreenLsc = new (EMM) CustomAttributeStructure( + UString("green"), UString("255")); + textDLscVS->AddAttribute(textDGreenLsc); + + CustomAttributeStructure* textDBlueLsc = new (EMM) CustomAttributeStructure( + UString("blue"), UString("255")); + textDLscVS->AddAttribute(textDBlueLsc); + + CustomAttributeStructure* textDAlphaLsc = new (EMM) CustomAttributeStructure( + UString("alpha"), UString("0")); + textDLscVS->AddAttribute(textDAlphaLsc); + + CustomAttributeStructure* textDTsciLsc = new (EMM) CustomAttributeStructure( + UString("textskincolorid"), UString("KAknsIIDQsnTextColors")); + textDLscVS->AddAttribute(textDTsciLsc); + + CustomAttributeStructure* textDTcsiLsc = new (EMM) CustomAttributeStructure( + UString("textcolorskinindex"), UString("5")); + textDLscVS->AddAttribute(textDTcsiLsc); + + CustomAttributeStructure* textDOpacityLsc = new (EMM) CustomAttributeStructure( + UString("opacity"), UString("0.7")); + textDLscVS->AddAttribute(textDOpacityLsc); + + CustomAttributeStructure* textDMarqueeLsc = new (EMM) CustomAttributeStructure( + UString("marquee"), UString("yes")); + textDLscVS->AddAttribute(textDMarqueeLsc); + + lscBaseElem->AddVisualStructure(textDLscVS); + mTemplateLscStruct.push_back(lscBaseElem); + + //now populate data for prtNonhilightElem element + //---------------------------------------------------------------------- + LCTElementStructure* lscNonhilightElem = new (EMM) LCTElementStructure(); + lscNonhilightElem->SetId(UString("nohighlight")); + + //for backgroung of non-highlighted imagevisual + LCTVisualStructure* nHLscDeckVs = new (EMM) LCTVisualStructure(); + nHLscDeckVs->SetId(UString("deck")); + CustomAttributeStructure* nHDeckOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1"),EAttributeOpacity); + nHLscDeckVs->AddAttribute(nHDeckOpacity); + lscNonhilightElem->AddVisualStructure(nHLscDeckVs); + + //for non-highlighted imagevisual + LCTVisualStructure* nonHLscIcon = new (EMM) LCTVisualStructure(); + nonHLscIcon->SetVisualType(EVisualImage); + nonHLscIcon->SetId(UString("mul_icon")); + nonHLscIcon->SetPositions(0,0); + nonHLscIcon->SetDimensions(640,360); + nonHLscIcon->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + nonHLscIcon->SetVarietyId(1); + + //ADD EXTRA ATTRIBUTE FOR FITMODE + + CustomAttributeStructure* nonHLscIPath = new CustomAttributeStructure( + UString("imagepath"),UString("mul_icon"),EAttributeNone, + ECategoryData); + nonHLscIcon->AddAttribute(nonHLscIPath); + + CustomAttributeStructure* nHLscIOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1"),EAttributeOpacity); + nonHLscIcon->AddAttribute(nHLscIOpacity); + + lscNonhilightElem->AddVisualStructure(nonHLscIcon); + + mTemplateLscStruct.push_back(lscNonhilightElem); + + //now populate data for prthilightElem element + //---------------------------------------------------------------------- + LCTElementStructure* lscHilightElem = new (EMM) LCTElementStructure(); + lscHilightElem->SetId(UString("highlight")); + + //for backgroung of non-highlighted imagevisual + LCTVisualStructure* hLscDeckVs = new (EMM) LCTVisualStructure(); + hLscDeckVs->SetId(UString("deck")); + CustomAttributeStructure* hLscDeckOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1"),EAttributeOpacity); + hLscDeckVs->AddAttribute(hLscDeckOpacity); + lscHilightElem->AddVisualStructure(hLscDeckVs); + + //for non-highlighted imagevisual + LCTVisualStructure* hLscIcon = new (EMM) LCTVisualStructure(); + hLscIcon->SetVisualType(EVisualImage); + hLscIcon->SetId(UString("mul_icon")); + hLscIcon->SetPositions(0,0); + hLscIcon->SetDimensions(360,640); + hLscIcon->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + hLscIcon->SetVarietyId(1); + + //ADD EXTRA ATTRIBUTE FOR FITMODE + + CustomAttributeStructure* hLscIPath = new CustomAttributeStructure( + UString("imagepath"),UString("mul_icon"),EAttributeNone, + ECategoryData); + hLscIcon->AddAttribute(hLscIPath); + + CustomAttributeStructure* hLscIOpacity = new CustomAttributeStructure( + UString("opacity"),UString("1"),EAttributeOpacity); + hLscIcon->AddAttribute(hLscIOpacity); + + lscHilightElem->AddVisualStructure(hLscIcon); + + mTemplateLscStruct.push_back(lscHilightElem); + } + + }//namespace ends diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcovertemplate3.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcovertemplate3.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,499 @@ +/* +* Copyright (c) 2007-2008 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: Description of various grid templates + * +*/ + + +#include "mulcovertemplates.h" +#include "mulcoverflowdefinitions.h" +#include "mulvisualutility.h" +#include "mulutility.h" +#include + +namespace Alf + { + +MulCoverLogicalTemplate3::~MulCoverLogicalTemplate3() + { + + } + +//---------------------------------------------------------------- +// PopulateData +//---------------------------------------------------------------- +// +void MulCoverLogicalTemplate3::PopulateData () + { + //For base element + LCTElementStructure* prtBaseElem = new (EMM) LCTElementStructure(); + //for main layout + prtBaseElem->SetId(UString(KBase)); + LCTVisualStructure* mainPrtVS = new (EMM) LCTVisualStructure(); + mainPrtVS->SetId(UString(KMainLayout)); + //@todo:: later these need to be retrieved from LCT utility + mainPrtVS->SetPositions(0,0); + mainPrtVS->SetDimensions(360,519); + mainPrtVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + mainPrtVS->SetVarietyId(0); + CustomAttributeStructure* mainPrtOpacity = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + mainPrtVS->AddAttribute(mainPrtOpacity); + CustomAttributeStructure* mainPrtMCount = new (EMM) CustomAttributeStructure( + UString(KTempMaxCount), UString("3")); + mainPrtVS->AddAttribute(mainPrtMCount); + prtBaseElem->AddVisualStructure(mainPrtVS); + //for item_center + LCTVisualStructure* item_centerPrtVS = new (EMM) LCTVisualStructure(); + item_centerPrtVS->SetId(UString(KItemCentre)); + item_centerPrtVS->SetPositions(10,22); + item_centerPrtVS->SetDimensions(340,340); + item_centerPrtVS->SetLCTId(UString("uiaccel_aacf_image_pane")); + item_centerPrtVS->SetVarietyId(0); + + CustomAttributeStructure* item_centerPrtFM = new (EMM) CustomAttributeStructure( + UString(KFitMode), UString(KOff)); + item_centerPrtVS->AddAttribute(item_centerPrtFM); + prtBaseElem->AddVisualStructure(item_centerPrtVS); + //for counter visual + LCTVisualStructure* counterPrtVS = new (EMM) LCTVisualStructure(); + counterPrtVS->SetId(UString(KMulCount)); + counterPrtVS->SetPositions(238,0); + counterPrtVS->SetDimensions(112,21); + counterPrtVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane_t1")); + counterPrtVS->SetVarietyId(0); + //add extra attributes to the countervisual + + CustomAttributeStructure* stylePrtC = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + + CustomAttributeStructure* opacityPrtC = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + + CustomAttributeStructure* redPrtC = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + + CustomAttributeStructure* greenPrtC = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + + CustomAttributeStructure* bluePrtC = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + + CustomAttributeStructure* alphaPrtC = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + + CustomAttributeStructure* horizontalalignPrtC = new (EMM) CustomAttributeStructure( + UString("horizontalalign"), UString("2")); + + counterPrtVS->AddAttribute(stylePrtC); + counterPrtVS->AddAttribute(opacityPrtC); + counterPrtVS->AddAttribute(redPrtC); + counterPrtVS->AddAttribute(greenPrtC); + counterPrtVS->AddAttribute(bluePrtC); + counterPrtVS->AddAttribute(alphaPrtC); + counterPrtVS->AddAttribute(horizontalalignPrtC); + + prtBaseElem->AddVisualStructure(counterPrtVS); + + //for text layout + LCTVisualStructure* textPrtLtVS = new (EMM) LCTVisualStructure(); + textPrtLtVS->SetId(UString(KText)); + textPrtLtVS->SetPositions(20,360); + textPrtLtVS->SetDimensions(340,82); + textPrtLtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane")); + textPrtLtVS->SetVarietyId(4); + prtBaseElem->AddVisualStructure(textPrtLtVS); + + //for text background + LCTVisualStructure* textPrtBgVS = new (EMM) LCTVisualStructure(); + textPrtBgVS->SetId(UString(KMulBackGround)); + textPrtBgVS->SetPositions(0,0); + textPrtBgVS->SetDimensions(340,82); + textPrtBgVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_g1")); + textPrtBgVS->SetVarietyId(0); + //Add attributes to the text background visual + CustomAttributeStructure* bgHaPrtTV = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textPrtBgVS->AddAttribute(bgHaPrtTV); + CustomAttributeStructure* bgoPrtTV = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("0.0")); + textPrtBgVS->AddAttribute(bgoPrtTV); + CustomAttributeStructure* bgcPrtTV = new (EMM) CustomAttributeStructure( + UString(KColor), UString("0")); + textPrtBgVS->AddAttribute(bgcPrtTV); + prtBaseElem->AddVisualStructure(textPrtBgVS); + + //for text title + LCTVisualStructure* textTPrtVS = new (EMM) LCTVisualStructure(); + textTPrtVS->SetId(UString(KMulTitle)); + textTPrtVS->SetPositions(15,9); + textTPrtVS->SetDimensions(310,27); + textTPrtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t1")); + textTPrtVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textTStylePrt = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + textTPrtVS->AddAttribute(textTStylePrt); + + CustomAttributeStructure* textTFtcPrt = new (EMM) CustomAttributeStructure( + UString(KFontThemeColor), UString("9")); + textTPrtVS->AddAttribute(textTFtcPrt); + + CustomAttributeStructure* textTHaPrt = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textTPrtVS->AddAttribute(textTHaPrt); + + CustomAttributeStructure* textTVaPrt = new (EMM) CustomAttributeStructure( + UString(KVertAlign), UString("1")); + textTPrtVS->AddAttribute(textTVaPrt); + + CustomAttributeStructure* textTRedPrt = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + textTPrtVS->AddAttribute(textTRedPrt); + + CustomAttributeStructure* textTGreenPrt = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + textTPrtVS->AddAttribute(textTGreenPrt); + + CustomAttributeStructure* textTBluePrt = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + textTPrtVS->AddAttribute(textTBluePrt); + + CustomAttributeStructure* textTAlphaPrt = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + textTPrtVS->AddAttribute(textTAlphaPrt); + + CustomAttributeStructure* textTTsciPrt = new (EMM) CustomAttributeStructure( + UString(KTextSkinColorId), UString("KAknsIIDQsnTextColors")); + textTPrtVS->AddAttribute(textTTsciPrt); + + CustomAttributeStructure* textTTcsiPrt = new (EMM) CustomAttributeStructure( + UString(KTextColorSkinIndex), UString("5")); + textTPrtVS->AddAttribute(textTTcsiPrt); + + CustomAttributeStructure* textTOpacityPrt = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + textTPrtVS->AddAttribute(textTOpacityPrt); + + prtBaseElem->AddVisualStructure(textTPrtVS); + + //for text detail + LCTVisualStructure* textDPrtVS = new (EMM) LCTVisualStructure(); + textDPrtVS->SetId(UString(KMulDetail)); + textDPrtVS->SetPositions(15,46); + textDPrtVS->SetDimensions(310,27); + textDPrtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t2")); + textDPrtVS->SetVarietyId(0); + //add extra attributes to the countervisual + CustomAttributeStructure* textDStylePrt = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + textDPrtVS->AddAttribute(textDStylePrt); + + CustomAttributeStructure* textDFtcPrt = new (EMM) CustomAttributeStructure( + UString(KFontThemeColor), UString("9")); + textDPrtVS->AddAttribute(textDFtcPrt); + + CustomAttributeStructure* textDHaPrt = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textDPrtVS->AddAttribute(textDHaPrt); + + CustomAttributeStructure* textDVaPrt = new (EMM) CustomAttributeStructure( + UString(KVertAlign), UString("1")); + textDPrtVS->AddAttribute(textDVaPrt); + + CustomAttributeStructure* textDRedPrt = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + textDPrtVS->AddAttribute(textDRedPrt); + + CustomAttributeStructure* textDGreenPrt = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + textDPrtVS->AddAttribute(textDGreenPrt); + + CustomAttributeStructure* textDBluePrt = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + textDPrtVS->AddAttribute(textDBluePrt); + + CustomAttributeStructure* textDAlphaPrt = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + textDPrtVS->AddAttribute(textDAlphaPrt); + + CustomAttributeStructure* textDTsciPrt = new (EMM) CustomAttributeStructure( + UString(KTextSkinColorId), UString("KAknsIIDQsnTextColors")); + textDPrtVS->AddAttribute(textDTsciPrt); + + CustomAttributeStructure* textDTcsiPrt = new (EMM) CustomAttributeStructure( + UString(KTextColorSkinIndex), UString("5")); + textDPrtVS->AddAttribute(textDTcsiPrt); + + CustomAttributeStructure* textDOpacityPrt = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("0.7")); + textDPrtVS->AddAttribute(textDOpacityPrt); + + CustomAttributeStructure* textDMarqueePrt = new (EMM) CustomAttributeStructure( + UString(KMarquee), UString("yes")); + textDPrtVS->AddAttribute(textDMarqueePrt); + + prtBaseElem->AddVisualStructure(textDPrtVS); + + mTemplatePrtStruct.push_back(prtBaseElem); + + //now populate data for slider element + //---------------------------------------------------------------------- + LCTElementStructure* prtSliderElem = new (EMM) LCTElementStructure(); + prtSliderElem->SetId(UString(KSlider)); + + LCTVisualStructure* prtSliderVis = new (EMM)LCTVisualStructure(); + prtSliderVis->SetPositions(0,441); + prtSliderVis->SetDimensions(340,78); + prtSliderVis->SetLCTId(UString("uiaccel_aacf_slider_pane")); + prtSliderVis->SetVarietyId(0); + + CustomAttributeStructure* sliderPrtOpacity = new CustomAttributeStructure( + UString(KTemplateId),UString("1")); + prtSliderVis->AddAttribute(sliderPrtOpacity); + + CustomAttributeStructure* sliderPrtTemplate = new CustomAttributeStructure( + UString(KOpacity),UString("1.0"),EAttributeOpacity); + prtSliderVis->AddAttribute(sliderPrtTemplate); + + prtSliderElem->AddVisualStructure(prtSliderVis); + + mTemplatePrtStruct.push_back(prtSliderElem); + //========================================================================== + //same procedure for filling up of LSC + //========================================================================== + //for main layout + LCTElementStructure* lscBaseElem = new (EMM) LCTElementStructure(); + lscBaseElem->SetId(UString(KBase)); + LCTVisualStructure* mainLscVS2 = new (EMM) LCTVisualStructure(); + mainLscVS2->SetId(UString(KMainLayout)); + mainLscVS2->SetPositions(0,0); + mainLscVS2->SetDimensions(640,360); + mainLscVS2->SetLCTId(UString("uiaccel_main_aa_coverflow_pane")); + mainLscVS2->SetVarietyId(1); + CustomAttributeStructure* mainLscOpacity = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + mainLscVS2->AddAttribute(mainLscOpacity); + CustomAttributeStructure* mainLscMCount = new (EMM) CustomAttributeStructure( + UString(KTempMaxCount), UString("3")); + mainLscVS2->AddAttribute(mainLscMCount); + CustomAttributeStructure* mainLscFScroll = new (EMM) CustomAttributeStructure( + UString(KFastScroll), UString("0")); + mainLscVS2->AddAttribute(mainLscFScroll); + lscBaseElem->AddVisualStructure(mainLscVS2); + //for item_center + LCTVisualStructure* item_centerLscVs = new (EMM) LCTVisualStructure(); + item_centerLscVs->SetId(UString(KCentreItem)); + item_centerLscVs->SetPositions(198,37); + item_centerLscVs->SetDimensions(242,242); + item_centerLscVs->SetLCTId(UString("uiaccel_aacf_image_pane")); + item_centerLscVs->SetVarietyId(2); + CustomAttributeStructure* item_centerLscFM = new (EMM) CustomAttributeStructure( + UString(KFitMode), UString(KOff)); + item_centerLscVs->AddAttribute(item_centerLscFM); + lscBaseElem->AddVisualStructure(item_centerLscVs); + + //For item right + LCTVisualStructure* item_rightLscVs = new (EMM) LCTVisualStructure(); + item_rightLscVs->SetId(UString(KRightItem)); + item_rightLscVs->SetPositions(480,50); + item_rightLscVs->SetDimensions(214,214); + item_rightLscVs->SetLCTId(UString("uiaccel_aacf_image_pane_cp002")); + item_rightLscVs->SetVarietyId(2); + lscBaseElem->AddVisualStructure(item_rightLscVs); + // For Counter + LCTVisualStructure* counterLscVS = new (EMM) LCTVisualStructure(); + counterLscVS->SetId(UString(KMulCount)); + counterLscVS->SetPositions(522,6); + counterLscVS->SetDimensions(112,21); + counterLscVS->SetLCTId(UString("uiaccel_main_aa_coverflow_pane_t1")); + counterLscVS->SetVarietyId(2); + //add extra attributes to the gridlayout + + CustomAttributeStructure* styleLscC = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + + CustomAttributeStructure* opacityLscC = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + + CustomAttributeStructure* redLscC = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + + CustomAttributeStructure* greenLscC = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + + CustomAttributeStructure* blueLscC = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + + CustomAttributeStructure* alphaLscC = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + + CustomAttributeStructure* horizontalalignLscC = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("2")); + + counterLscVS->AddAttribute(styleLscC); + counterLscVS->AddAttribute(opacityLscC); + counterLscVS->AddAttribute(redLscC); + counterLscVS->AddAttribute(greenLscC); + counterLscVS->AddAttribute(blueLscC); + counterLscVS->AddAttribute(alphaLscC); + counterLscVS->AddAttribute(horizontalalignLscC); + + lscBaseElem->AddVisualStructure(counterLscVS); + + //for text layout + LCTVisualStructure* textLscLtVS = new (EMM) LCTVisualStructure(); + textLscLtVS->SetId(UString(KText)); + textLscLtVS->SetPositions(161,284); + textLscLtVS->SetDimensions(318,72); + textLscLtVS->SetLCTId(UString("uiaccel_aacf_image_title_pane")); + textLscLtVS->SetVarietyId(2); + lscBaseElem->AddVisualStructure(textLscLtVS); + + //for text background + LCTVisualStructure* textLscBgVS = new (EMM) LCTVisualStructure(); + textLscBgVS->SetId(UString(KMulBackGround)); + textLscBgVS->SetPositions(0,0); + textLscBgVS->SetDimensions(318,72); + textLscBgVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_g1")); + textLscBgVS->SetVarietyId(1); + //Add attributes to the text background visual + CustomAttributeStructure* bgHaLscTV = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textLscBgVS->AddAttribute(bgHaLscTV); + CustomAttributeStructure* bgoLscTV = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("0.0")); + textLscBgVS->AddAttribute(bgoLscTV); + CustomAttributeStructure* bgcLscTV = new (EMM) CustomAttributeStructure( + UString(KColor), UString("0")); + textLscBgVS->AddAttribute(bgcLscTV); + lscBaseElem->AddVisualStructure(textLscBgVS); + + //for text title + LCTVisualStructure* textTLscVS = new (EMM) LCTVisualStructure(); + textTLscVS->SetId(UString(KMulTitle)); + textTLscVS->SetPositions(4,4); + textTLscVS->SetDimensions(310,27); + textTLscVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t1")); + textTLscVS->SetVarietyId(1); + //add extra attributes to the countervisual + CustomAttributeStructure* textTStyleLsc = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + textTLscVS->AddAttribute(textTStyleLsc); + + CustomAttributeStructure* textTFtcLsc = new (EMM) CustomAttributeStructure( + UString(KFontThemeColor), UString("9")); + textTLscVS->AddAttribute(textTFtcLsc); + + CustomAttributeStructure* textTHaLsc = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textTLscVS->AddAttribute(textTHaLsc); + + CustomAttributeStructure* textTVaLsc = new (EMM) CustomAttributeStructure( + UString(KVertAlign), UString("1")); + textTLscVS->AddAttribute(textTVaLsc); + + CustomAttributeStructure* textTRedLsc = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + textTLscVS->AddAttribute(textTRedLsc); + + CustomAttributeStructure* textTGreenLsc = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + textTLscVS->AddAttribute(textTGreenLsc); + + CustomAttributeStructure* textTBlueLsc = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + textTLscVS->AddAttribute(textTBlueLsc); + + CustomAttributeStructure* textTAlphaLsc = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + textTLscVS->AddAttribute(textTAlphaLsc); + + CustomAttributeStructure* textTTsciLsc = new (EMM) CustomAttributeStructure( + UString(KTextSkinColorId), UString("KAknsIIDQsnTextColors")); + textTLscVS->AddAttribute(textTTsciLsc); + + CustomAttributeStructure* textTTcsiLsc = new (EMM) CustomAttributeStructure( + UString(KTextColorSkinIndex), UString("5")); + textTLscVS->AddAttribute(textTTcsiLsc); + + CustomAttributeStructure* textTOpacityLsc = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("1.0")); + textTLscVS->AddAttribute(textTOpacityLsc); + + lscBaseElem->AddVisualStructure(textTLscVS); + + //for text detail + LCTVisualStructure* textDLscVS = new (EMM) LCTVisualStructure(); + textDLscVS->SetId(UString(KMulDetail)); + textDLscVS->SetPositions(4,38); + textDLscVS->SetDimensions(310,27); + textDLscVS->SetLCTId(UString("uiaccel_aacf_image_title_pane_t2")); + textDLscVS->SetVarietyId(1); + //add extra attributes to the countervisual + CustomAttributeStructure* textDStyleLsc = new (EMM) CustomAttributeStructure( + UString(KTextStyle), UString("qfn_secondary")); + textDLscVS->AddAttribute(textDStyleLsc); + + CustomAttributeStructure* textDFtcLsc = new (EMM) CustomAttributeStructure( + UString(KFontThemeColor), UString("9")); + textDLscVS->AddAttribute(textDFtcLsc); + + CustomAttributeStructure* textDHaLsc = new (EMM) CustomAttributeStructure( + UString(KHorzAlign), UString("1")); + textDLscVS->AddAttribute(textDHaLsc); + + CustomAttributeStructure* textDVaLsc = new (EMM) CustomAttributeStructure( + UString(KVertAlign), UString("1")); + textDLscVS->AddAttribute(textDVaLsc); + + CustomAttributeStructure* textDRedLsc = new (EMM) CustomAttributeStructure( + UString(KRedColorAttrib), UString("255")); + textDLscVS->AddAttribute(textDRedLsc); + + CustomAttributeStructure* textDGreenLsc = new (EMM) CustomAttributeStructure( + UString(KGreenColorAttrib), UString("255")); + textDLscVS->AddAttribute(textDGreenLsc); + + CustomAttributeStructure* textDBlueLsc = new (EMM) CustomAttributeStructure( + UString(KBlueColorAttrib), UString("255")); + textDLscVS->AddAttribute(textDBlueLsc); + + CustomAttributeStructure* textDAlphaLsc = new (EMM) CustomAttributeStructure( + UString(KAlphaColorAttrib), UString("0")); + textDLscVS->AddAttribute(textDAlphaLsc); + + CustomAttributeStructure* textDTsciLsc = new (EMM) CustomAttributeStructure( + UString(KTextSkinColorId), UString("KAknsIIDQsnTextColors")); + textDLscVS->AddAttribute(textDTsciLsc); + + CustomAttributeStructure* textDTcsiLsc = new (EMM) CustomAttributeStructure( + UString(KTextColorSkinIndex), UString("5")); + textDLscVS->AddAttribute(textDTcsiLsc); + + CustomAttributeStructure* textDOpacityLsc = new (EMM) CustomAttributeStructure( + UString(KOpacity), UString("0.7")); + textDLscVS->AddAttribute(textDOpacityLsc); + + CustomAttributeStructure* textDMarqueeLsc = new (EMM) CustomAttributeStructure( + UString(KMarquee), UString("yes")); + textDLscVS->AddAttribute(textDMarqueeLsc); + + lscBaseElem->AddVisualStructure(textDLscVS); + + mTemplateLscStruct.push_back(lscBaseElem); + + } + + }//namespace ends diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulcoverflowwidget/src/mulcovertemplate4.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulcoverflowwidget/src/mulcovertemplate4.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2007-2008 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: Description of various grid templates + * +*/ + + +#include "mulcoverflowtemplate.h" + +#include + +#include +#include +#include "mulassert.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulCoverLogicalTemplate4 +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate4::MulCoverFlowTemplate4(MulCoverFlowControl &aControl, + MulBaseElement &aBaseElement):MulCoverFlowTemplate(aControl, aBaseElement) + { + + } + +// --------------------------------------------------------------------------- +// ~MulCoverLogicalTemplate4 +// --------------------------------------------------------------------------- +// +MulCoverFlowTemplate4::~MulCoverFlowTemplate4() + { + + } + + +// --------------------------------------------------------------------------- +// GetIconSize +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate4::GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, int& aHeight, int& aWidth) + { + int appMainPaneVerityId; + int coverFlowPaneVarietyId; + int imagePaneVerityId ; + int videoIndVerityId ; + if (aIslandscape) + { + appMainPaneVerityId = 7; + coverFlowPaneVarietyId = 1; + imagePaneVerityId = 6; + videoIndVerityId = 0; + } + else + { + appMainPaneVerityId = 7; + coverFlowPaneVarietyId = 1; + imagePaneVerityId = 6; + videoIndVerityId = 0; + } + + // Get the size of the appwindow + TAknWindowLineLayout appMainLayout = + AknLayoutScalable_UiAccel::main_pane(appMainPaneVerityId).LayoutLine(); + TAknLayoutRect appMainRect; + appMainRect.LayoutRect( AlfUtil::ScreenSize(), appMainLayout ); + TSize appMainSize(appMainRect.Rect().Size()); + + // Get the size of the coverflow main window + TAknWindowLineLayout mainLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(coverFlowPaneVarietyId).LayoutLine(); + TAknLayoutRect mainRect; + mainRect.LayoutRect( AlfUtil::ScreenSize(), mainLayout ); + TSize mainSize(mainRect.Rect().Size()); + + switch(aAttribute) + { + case mulvisualitem::KMulIcon1: + { + TAknWindowLineLayout centerLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneVerityId).LayoutLine(); + TAknLayoutRect centerRect; + centerRect.LayoutRect( TSize(mainSize), centerLayout ); + aHeight = centerRect.Rect().Size().iHeight; + aWidth = centerRect.Rect().Size().iWidth; + break; + } + case mulvisualitem::KMulIndicator2: + { + TAknWindowLineLayout centerLayout = + AknLayoutScalable_UiAccel::main_aa_video_pane_g1(videoIndVerityId).LayoutLine(); + TAknLayoutRect centerRect; + centerRect.LayoutRect( TSize(mainSize), centerLayout ); + aHeight = centerRect.Rect().Size().iHeight; + aWidth = centerRect.Rect().Size().iWidth; + break; + } + default: + { + // invalid attribute + // raise exception. + __MUL_ASSERT(false,KInvalidAttribute); + + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CreateVisualisation +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate4::CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange) + { + // set the default attribue of the template + // irrespective of the orientation + mData->mSliderEnabled = false; + mData->mUiOnOffFlag = true; + mData->mMaxVisibleCount = 1; + mData->mEnhancedSupportFlag = true; + + // store the default attribute in base element + mData->mBaseElement->SetFitMode(true); + mData->mBaseElement->StoreTextVisibility( false ); + + // get the main text layout + CAlfLayout& textLayout = mData->mBaseElement->TextLayout(); + textLayout.SetOpacity(0); + + mData->mOrientationChange = aIsOrientationChange; + if (aIsLandscape) + { + // create visualisation for landscape + CreateLscStructure(); + } + else + { + // create visualisation for potrait + CreatePrtStructure(); + } + mData->mOrientationChange = false; + } + + +// --------------------------------------------------------------------------- +// CreatePrtStructure +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate4::CreatePrtStructure() + { + // list of all component lct verity id. + int mainPaneVerityId = 1; + int imagePaneVerityId = 6; + int videoPaneVerityId = 0; + int counterPaneVerityId = 3; + + CAlfVisual* main = mData->mBaseElement->findVisual(KMainLayoutIndex); + CAlfLayout* parentLayout = main->Layout(); + TSize mainSize = parentLayout->Size().Target().AsSize(); + + // get for main layout + TAknWindowLineLayout componentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(mainPaneVerityId).LayoutLine(); + TRect mainRect = IconWindowRect(componentLayout, mainSize); + main->SetPos(TAlfRealPoint(0,0)); + main->SetSize(mainRect.Size()); + + + // for deck layout + CAlfDeckLayout& deckLayout = static_cast( + static_cast(main)->Visual(KMainLayoutIndex) ); + deckLayout.SetSize(mainRect.Size(),0); + + // if set background with some skin id is called before calling set model + // then the visual and texture would be created with 0,0 sizes + // hence we need to resize them + CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual); + if(backgroundVisual) + { + backgroundVisual->SetSize(mainRect.Size(),0); + } + + // for center item + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneVerityId).LayoutLine(); + TRect centerRect = IconWindowRect(componentLayout,mainRect); + + TMulCoverFlowItem highlightItem(centerRect.iTl.iX, + centerRect.iTl.iY,centerRect.Size().iWidth,centerRect.Size().iHeight); + + // apply attribute + mData->mBaseElement->StoreVisualDimensions(highlightItem,highlightItem,mData->mMaxVisibleCount ); + + + + // for indicator icon + componentLayout = + AknLayoutScalable_UiAccel::main_aa_video_pane_g1(videoPaneVerityId).LayoutLine(); + TRect indRect = IconWindowRect(componentLayout,mainRect); + TSize indSize(indRect.Size()); + mData->mIndicatorDimensions.height = indSize.iHeight; + mData->mIndicatorDimensions.width = indSize.iWidth; + mData->mIndicatorDimensions.posx = indRect.iTl.iX; + mData->mIndicatorDimensions.posy = indRect.iTl.iY; + + // crete counter + ApplyCounterAttribute(counterPaneVerityId,mainRect); + } + +// --------------------------------------------------------------------------- +// CreateLscStructure +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate4::CreateLscStructure() + { + // list of all component lct verity id. + int mainPaneVerityId = 1; + int imagePaneVerityId = 6; + int videoPaneVerityId = 0; + int counterPaneVerityId = 8; + + CAlfVisual* main = mData->mBaseElement->findVisual(KMainLayoutIndex); + CAlfLayout* prntLay = main->Layout(); + TSize main_size = prntLay->Size().Target().AsSize(); + TAknWindowLineLayout componentLayout; + + // get for main layout + componentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane(mainPaneVerityId).LayoutLine(); + TRect mainRect = IconWindowRect(componentLayout, main_size); + main->SetPos(TAlfRealPoint(0,0)); + main->SetSize(mainRect.Size()); + + // for deck layout + CAlfDeckLayout& deckLayout = static_cast( + static_cast(main)->Visual(KMainLayoutIndex) ); + deckLayout.SetSize(mainRect.Size(),0); + + // if set background with some skin id is called before calling set model + // then the visual and texture would be created with 0,0 sizes + // hence we need to resize them + CAlfVisual* backgroundVisual = deckLayout.FindTag(backgroundvisual); + if(backgroundVisual) + { + backgroundVisual->SetSize(mainRect.Size(),0); + } + + // for center item + + componentLayout = + AknLayoutScalable_UiAccel::aacf_image_pane(imagePaneVerityId).LayoutLine(); + TRect centerRect = IconWindowRect(componentLayout,mainRect); + + TMulCoverFlowItem highlightItem(centerRect.iTl.iX, + centerRect.iTl.iY,centerRect.Size().iWidth,centerRect.Size().iHeight); + + // apply attribute + mData->mBaseElement->StoreVisualDimensions(highlightItem,highlightItem,mData->mMaxVisibleCount ); + + + // for indicator icon + componentLayout = + AknLayoutScalable_UiAccel::main_aa_video_pane_g1(videoPaneVerityId).LayoutLine(); + TRect indRect = IconWindowRect(componentLayout,mainRect); + TSize indSize(indRect.Size()); + mData->mIndicatorDimensions.height = indSize.iHeight; + mData->mIndicatorDimensions.width = indSize.iWidth; + mData->mIndicatorDimensions.posx = indRect.iTl.iX; + mData->mIndicatorDimensions.posy = indRect.iTl.iY; + + // crete counter + ApplyCounterAttribute(counterPaneVerityId,mainRect); + } + +// --------------------------------------------------------------------------- +// ApplyCounterAttribute +// --------------------------------------------------------------------------- +// +void MulCoverFlowTemplate4::ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect) + { + mData->mUiOnOffFlag = true; + TAknTextLineLayout counterComponentLayout = + AknLayoutScalable_UiAccel::main_aa_coverflow_pane_t1(acounterPaneVerityId).LayoutLine(); + + TRect counterRect = TextWindowRect(counterComponentLayout, aMainRect); + TSize counterSize(counterRect.Size()); + mData->mCounterDimensions.posx = counterRect.iTl.iX; + mData->mCounterDimensions.posy = counterRect.iTl.iY; + mData->mCounterDimensions.width = counterSize.iWidth; + mData->mCounterDimensions.height = counterSize.iHeight; + + // Create a Counter visual if it is not Created. + CAlfTextVisual& counterVisual = mData->mBaseElement->CounterVisual(); + + // Set Properties to Counter Visual if we are creating. + // no need to apply attribute for orientation change + // as all are same. + if(!mData->mOrientationChange) + { + //get font Id for counter + int fontId = counterComponentLayout.FontId(); + int counterFontId = 0x000000FF & fontId; + // apply default brush color to the counter background + ApplyBrush(counterVisual,KRgbBlack,0.5); + // apply default attribute + counterVisual.SetAlign(EAlfAlignHCenter,EAlfAlignVCenter); + SetTextStyle(counterFontId, counterVisual); + + // check if user has set some different attribute. + TMulVisualColorProperty counterColor = mData->mBaseElement->TextColor(ECounterVisual); + if (counterColor.mIsColorSet) + { + // apply the color set by the application + counterVisual.SetColor(counterColor.mColor); + } + else + { + // apply the default color + counterVisual.SetColor(KRgbWhite); + } + mData->mCounterFontMaxCharLength = UpdateMaxFontWidth(&counterVisual); + } + + } + + }//namespace ends diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/bwins/muldatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/bwins/muldatamodelu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,23 @@ +EXPORTS + ?IsDirty@MulVisualItem@Alf@@QBE_NW4TVisualAttribute@mulvisualitem@2@@Z @ 1 NONAME ; bool Alf::MulVisualItem::IsDirty(enum Alf::mulvisualitem::TVisualAttribute) const + ??0MulModelImpl@Alf@@QAE@XZ @ 2 NONAME ; Alf::MulModelImpl::MulModelImpl(void) + ??0MulDataPath@Alf@@QAE@H@Z @ 3 NONAME ; Alf::MulDataPath::MulDataPath(int) + ??0MulDataPath@Alf@@QAE@ABV01@@Z @ 4 NONAME ; Alf::MulDataPath::MulDataPath(class Alf::MulDataPath const &) + ??1MulDataPath@Alf@@QAE@XZ @ 5 NONAME ; Alf::MulDataPath::~MulDataPath(void) + ?AttributeAsInt@MulVisualItem@Alf@@QBEHW4TVisualAttribute@mulvisualitem@2@@Z @ 6 NONAME ; int Alf::MulVisualItem::AttributeAsInt(enum Alf::mulvisualitem::TVisualAttribute) const + ?Attribute@MulVisualItem@Alf@@QBEPAVIMulVariantType@2@W4TVisualAttribute@mulvisualitem@2@@Z @ 7 NONAME ; class Alf::IMulVariantType * Alf::MulVisualItem::Attribute(enum Alf::mulvisualitem::TVisualAttribute) const + ??0MulDataPath@Alf@@QAE@XZ @ 8 NONAME ; Alf::MulDataPath::MulDataPath(void) + ?Attributes@MulVisualItem@Alf@@QBE?BV?$vector@W4TVisualAttribute@mulvisualitem@Alf@@V?$allocator@W4TVisualAttribute@mulvisualitem@Alf@@@std@@@std@@XZ @ 9 NONAME ; class std::vector > const Alf::MulVisualItem::Attributes(void) const + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@PAVIMulVariantType@2@HW4TAttributeOwnership@12@@Z @ 10 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, class Alf::IMulVariantType *, int, enum Alf::MulVisualItem::TAttributeOwnership) + ?Depth@MulDataPath@Alf@@QBEHXZ @ 11 NONAME ; int Alf::MulDataPath::Depth(void) const + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@HH@Z @ 12 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, int, int) + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@ABVTDesC16@@H@Z @ 13 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, class TDesC16 const &, int) + ??1MulVisualItem@Alf@@QAE@XZ @ 14 NONAME ; Alf::MulVisualItem::~MulVisualItem(void) + ??1MulModelImpl@Alf@@UAE@XZ @ 15 NONAME ; Alf::MulModelImpl::~MulModelImpl(void) + ??0MulDataPath@Alf@@QAE@HH@Z @ 16 NONAME ; Alf::MulDataPath::MulDataPath(int, int) + ??AMulDataPath@Alf@@QBEHH@Z @ 17 NONAME ; int Alf::MulDataPath::operator[](int) const + ??0MulVisualItem@Alf@@QAE@ABV01@@Z @ 18 NONAME ; Alf::MulVisualItem::MulVisualItem(class Alf::MulVisualItem const &) + ??0MulVisualItem@Alf@@QAE@XZ @ 19 NONAME ; Alf::MulVisualItem::MulVisualItem(void) + ?Append@MulDataPath@Alf@@QAEXH@Z @ 20 NONAME ; void Alf::MulDataPath::Append(int) + ?AttributeAsString@MulVisualItem@Alf@@QBEABVTDesC16@@W4TVisualAttribute@mulvisualitem@2@@Z @ 21 NONAME ; class TDesC16 const & Alf::MulVisualItem::AttributeAsString(enum Alf::mulvisualitem::TVisualAttribute) const + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/bwins/mulmodelutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/bwins/mulmodelutilityu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,48 @@ +EXPORTS + ??0MulVariantType@Alf@@QAE@XZ @ 1 NONAME ; Alf::MulVariantType::MulVariantType(void) + ?IsDirty@MulVisualItem@Alf@@QBE_NW4TVisualAttribute@mulvisualitem@2@@Z @ 2 NONAME ; bool Alf::MulVisualItem::IsDirty(enum Alf::mulvisualitem::TVisualAttribute) const + ??0MulVariantType@Alf@@QAE@ABN@Z @ 3 NONAME ; Alf::MulVariantType::MulVariantType(double const &) + ??0MulVariantType@Alf@@QAE@ABVTDesC16@@@Z @ 4 NONAME ; Alf::MulVariantType::MulVariantType(class TDesC16 const &) + ?uinteger@MulVariantType@Alf@@UBEIXZ @ 5 NONAME ; unsigned int Alf::MulVariantType::uinteger(void) const + ?IntToUString@MulModelUtility@Alf@@SA?AVUString@osncore@@H@Z @ 6 NONAME ; class osncore::UString Alf::MulModelUtility::IntToUString(int) + ?Type@MulVariantType@Alf@@UBE?AW4TMulType@IMulVariantType@2@XZ @ 7 NONAME ; enum Alf::IMulVariantType::TMulType Alf::MulVariantType::Type(void) const + ?ConvertUStringToTDes@MulModelUtility@Alf@@SAXABVUString@osncore@@AAVTDes16@@@Z @ 8 NONAME ; void Alf::MulModelUtility::ConvertUStringToTDes(class osncore::UString const &, class TDes16 &) + ?Attribute@MulVisualItem@Alf@@QBEPAVIMulVariantType@2@W4TVisualAttribute@mulvisualitem@2@@Z @ 9 NONAME ; class Alf::IMulVariantType * Alf::MulVisualItem::Attribute(enum Alf::mulvisualitem::TVisualAttribute) const + ?Attributes@MulVisualItem@Alf@@QBE?BV?$vector@W4TVisualAttribute@mulvisualitem@Alf@@V?$allocator@W4TVisualAttribute@mulvisualitem@Alf@@@std@@@std@@XZ @ 10 NONAME ; class std::vector > const Alf::MulVisualItem::Attributes(void) const + ??0MulDataPath@Alf@@QAE@XZ @ 11 NONAME ; Alf::MulDataPath::MulDataPath(void) + ?Map@MulVariantType@Alf@@UBEAAVIAlfMap@2@XZ @ 12 NONAME ; class Alf::IAlfMap & Alf::MulVariantType::Map(void) const + ?Depth@MulDataPath@Alf@@QBEHXZ @ 13 NONAME ; int Alf::MulDataPath::Depth(void) const + ??1MulVariantType@Alf@@UAE@XZ @ 14 NONAME ; Alf::MulVariantType::~MulVariantType(void) + ?ConvertVisualItemToMap@MulModelUtility@Alf@@SA?AV?$auto_ptr@VIAlfMap@Alf@@@std@@AAVMulVisualItem@2@@Z @ 15 NONAME ; class std::auto_ptr Alf::MulModelUtility::ConvertVisualItemToMap(class Alf::MulVisualItem &) + ??0MulVariantType@Alf@@QAE@ABI@Z @ 16 NONAME ; Alf::MulVariantType::MulVariantType(unsigned int const &) + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@ABVTDesC16@@H@Z @ 17 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, class TDesC16 const &, int) + ??1MulVisualItem@Alf@@QAE@XZ @ 18 NONAME ; Alf::MulVisualItem::~MulVisualItem(void) + ??0MulDataPath@Alf@@QAE@HH@Z @ 19 NONAME ; Alf::MulDataPath::MulDataPath(int, int) + ??AMulDataPath@Alf@@QBEHH@Z @ 20 NONAME ; int Alf::MulDataPath::operator[](int) const + ?ConvertTDesToUString@MulModelUtility@Alf@@SAXABVTDesC16@@AAVUString@osncore@@@Z @ 21 NONAME ; void Alf::MulModelUtility::ConvertTDesToUString(class TDesC16 const &, class osncore::UString &) + ??0MulVariantType@Alf@@QAE@AAVIAlfMap@1@@Z @ 22 NONAME ; Alf::MulVariantType::MulVariantType(class Alf::IAlfMap &) + ??0MulVisualItem@Alf@@QAE@ABV01@@Z @ 23 NONAME ; Alf::MulVisualItem::MulVisualItem(class Alf::MulVisualItem const &) + ??0MulVisualItem@Alf@@QAE@XZ @ 24 NONAME ; Alf::MulVisualItem::MulVisualItem(void) + ?AttributeAsString@MulVisualItem@Alf@@QBEABVTDesC16@@W4TVisualAttribute@mulvisualitem@2@@Z @ 25 NONAME ; class TDesC16 const & Alf::MulVisualItem::AttributeAsString(enum Alf::mulvisualitem::TVisualAttribute) const + ?Append@MulDataPath@Alf@@QAEXH@Z @ 26 NONAME ; void Alf::MulDataPath::Append(int) + ?AlfStringToUString@MulModelUtility@Alf@@SA?AVUString@osncore@@ABV34@@Z @ 27 NONAME ; class osncore::UString Alf::MulModelUtility::AlfStringToUString(class osncore::UString const &) + ??0MulVariantType@Alf@@QAE@AB_N@Z @ 28 NONAME ; Alf::MulVariantType::MulVariantType(bool const &) + ?integer@MulVariantType@Alf@@UBEHXZ @ 29 NONAME ; int Alf::MulVariantType::integer(void) const + ?ConvertTDes8ToUString@MulModelUtility@Alf@@SAXABVTDesC8@@AAVUString@osncore@@@Z @ 30 NONAME ; void Alf::MulModelUtility::ConvertTDes8ToUString(class TDesC8 const &, class osncore::UString &) + ?CreateVisualItem@MulModelUtility@Alf@@SA?AV?$auto_ptr@VMulVisualItem@Alf@@@std@@W4TLogicalTemplate@mulwidget@2@@Z @ 31 NONAME ; class std::auto_ptr Alf::MulModelUtility::CreateVisualItem(enum Alf::mulwidget::TLogicalTemplate) + ??0MulDataPath@Alf@@QAE@H@Z @ 32 NONAME ; Alf::MulDataPath::MulDataPath(int) + ??0MulDataPath@Alf@@QAE@ABV01@@Z @ 33 NONAME ; Alf::MulDataPath::MulDataPath(class Alf::MulDataPath const &) + ?Clone@MulVariantType@Alf@@UAE?AV?$auto_ptr@VIMulVariantType@Alf@@@std@@XZ @ 34 NONAME ; class std::auto_ptr Alf::MulVariantType::Clone(void) + ??1MulDataPath@Alf@@QAE@XZ @ 35 NONAME ; Alf::MulDataPath::~MulDataPath(void) + ?real@MulVariantType@Alf@@UBENXZ @ 36 NONAME ; double Alf::MulVariantType::real(void) const + ?ConvertUStringToTDes8@MulModelUtility@Alf@@SAXABVUString@osncore@@AAVTDes8@@@Z @ 37 NONAME ; void Alf::MulModelUtility::ConvertUStringToTDes8(class osncore::UString const &, class TDes8 &) + ?CreateVariantType@MulModelUtility@Alf@@SAPAVIAlfVariantType@2@AAV32@@Z @ 38 NONAME ; class Alf::IAlfVariantType * Alf::MulModelUtility::CreateVariantType(class Alf::IAlfVariantType &) + ?AttributeAsInt@MulVisualItem@Alf@@QBEHW4TVisualAttribute@mulvisualitem@2@@Z @ 39 NONAME ; int Alf::MulVisualItem::AttributeAsInt(enum Alf::mulvisualitem::TVisualAttribute) const + ?UStringToAlfString@MulModelUtility@Alf@@SA?AVUString@osncore@@ABV34@@Z @ 40 NONAME ; class osncore::UString Alf::MulModelUtility::UStringToAlfString(class osncore::UString const &) + ??0MulVariantType@Alf@@QAE@ABH@Z @ 41 NONAME ; Alf::MulVariantType::MulVariantType(int const &) + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@PAVIMulVariantType@2@HW4TAttributeOwnership@12@@Z @ 42 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, class Alf::IMulVariantType *, int, enum Alf::MulVisualItem::TAttributeOwnership) + ?SetAttribute@MulVisualItem@Alf@@QAEXW4TVisualAttribute@mulvisualitem@2@HH@Z @ 43 NONAME ; void Alf::MulVisualItem::SetAttribute(enum Alf::mulvisualitem::TVisualAttribute, int, int) + ?boolean@MulVariantType@Alf@@UBE_NXZ @ 44 NONAME ; bool Alf::MulVariantType::boolean(void) const + ?ConvertMapToVisualItem@MulModelUtility@Alf@@SA?AV?$auto_ptr@VMulVisualItem@Alf@@@std@@AAVIAlfMap@2@@Z @ 45 NONAME ; class std::auto_ptr Alf::MulModelUtility::ConvertMapToVisualItem(class Alf::IAlfMap &) + ?DesC@MulVariantType@Alf@@UBEABVTDesC16@@XZ @ 46 NONAME ; class TDesC16 const & Alf::MulVariantType::DesC(void) const + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/data/2000d23e.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/data/2000d23e.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2000 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: ECom resource file +* +*/ + + +#include +#include "alf/alfecompluginfactoryuid.rh" + + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x2000D23E; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2000D23F; + version_no = 1; + display_name = ""; + default_data = "mulmodel"; + opaque_data = ""; + } + }; + } + }; +} + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/eabi/muldatamodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/eabi/muldatamodelu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,46 @@ +EXPORTS + _ZN3Alf11MulDataPath6AppendEi @ 1 NONAME + _ZN3Alf11MulDataPathC1ERKS0_ @ 2 NONAME + _ZN3Alf11MulDataPathC1Ei @ 3 NONAME + _ZN3Alf11MulDataPathC1Eii @ 4 NONAME + _ZN3Alf11MulDataPathC1Ev @ 5 NONAME + _ZN3Alf11MulDataPathC2ERKS0_ @ 6 NONAME + _ZN3Alf11MulDataPathC2Ei @ 7 NONAME + _ZN3Alf11MulDataPathC2Eii @ 8 NONAME + _ZN3Alf11MulDataPathC2Ev @ 9 NONAME + _ZN3Alf11MulDataPathD1Ev @ 10 NONAME + _ZN3Alf11MulDataPathD2Ev @ 11 NONAME + _ZN3Alf12MulModelImplC1Ev @ 12 NONAME + _ZN3Alf12MulModelImplC2Ev @ 13 NONAME + _ZN3Alf12MulModelImplD0Ev @ 14 NONAME + _ZN3Alf12MulModelImplD1Ev @ 15 NONAME + _ZN3Alf12MulModelImplD2Ev @ 16 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeEPNS_15IMulVariantTypeEiNS0_19TAttributeOwnershipE @ 17 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeERK7TDesC16i @ 18 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeEii @ 19 NONAME + _ZN3Alf13MulVisualItemC1ERKS0_ @ 20 NONAME + _ZN3Alf13MulVisualItemC1Ev @ 21 NONAME + _ZN3Alf13MulVisualItemC2ERKS0_ @ 22 NONAME + _ZN3Alf13MulVisualItemC2Ev @ 23 NONAME + _ZN3Alf13MulVisualItemD1Ev @ 24 NONAME + _ZN3Alf13MulVisualItemD2Ev @ 25 NONAME + _ZNK3Alf11MulDataPath5DepthEv @ 26 NONAME + _ZNK3Alf11MulDataPathixEi @ 27 NONAME + _ZNK3Alf13MulVisualItem10AttributesEv @ 28 NONAME + _ZNK3Alf13MulVisualItem14AttributeAsIntENS_13mulvisualitem16TVisualAttributeE @ 29 NONAME + _ZNK3Alf13MulVisualItem17AttributeAsStringENS_13mulvisualitem16TVisualAttributeE @ 30 NONAME + _ZNK3Alf13MulVisualItem7IsDirtyENS_13mulvisualitem16TVisualAttributeE @ 31 NONAME + _ZNK3Alf13MulVisualItem9AttributeENS_13mulvisualitem16TVisualAttributeE @ 32 NONAME + _ZTIN3Alf11MulPullModeE @ 33 NONAME ; ## + _ZTIN3Alf11MulPushModeE @ 34 NONAME ; ## + _ZTIN3Alf12MulModelImplE @ 35 NONAME ; ## + _ZTIN3Alf20MulAsyncDataProviderE @ 36 NONAME ; ## + _ZTVN3Alf11MulPullModeE @ 37 NONAME ; ## + _ZTVN3Alf11MulPushModeE @ 38 NONAME ; ## + _ZTVN3Alf12MulModelImplE @ 39 NONAME ; ## + _ZTVN3Alf20MulAsyncDataProviderE @ 40 NONAME ; ## + _ZThn4_N3Alf12MulModelImplD0Ev @ 41 NONAME ; ## + _ZThn4_N3Alf12MulModelImplD1Ev @ 42 NONAME ; ## + _ZThn8_N3Alf12MulModelImplD0Ev @ 43 NONAME ; ## + _ZThn8_N3Alf12MulModelImplD1Ev @ 44 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/eabi/mulmodelutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/eabi/mulmodelutilityu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,67 @@ +EXPORTS + _ZN3Alf11MulDataPath6AppendEi @ 1 NONAME + _ZN3Alf11MulDataPathC1ERKS0_ @ 2 NONAME + _ZN3Alf11MulDataPathC1Ei @ 3 NONAME + _ZN3Alf11MulDataPathC1Eii @ 4 NONAME + _ZN3Alf11MulDataPathC1Ev @ 5 NONAME + _ZN3Alf11MulDataPathC2ERKS0_ @ 6 NONAME + _ZN3Alf11MulDataPathC2Ei @ 7 NONAME + _ZN3Alf11MulDataPathC2Eii @ 8 NONAME + _ZN3Alf11MulDataPathC2Ev @ 9 NONAME + _ZN3Alf11MulDataPathD1Ev @ 10 NONAME + _ZN3Alf11MulDataPathD2Ev @ 11 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeEPNS_15IMulVariantTypeEiNS0_19TAttributeOwnershipE @ 12 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeERK7TDesC16i @ 13 NONAME + _ZN3Alf13MulVisualItem12SetAttributeENS_13mulvisualitem16TVisualAttributeEii @ 14 NONAME + _ZN3Alf13MulVisualItemC1ERKS0_ @ 15 NONAME + _ZN3Alf13MulVisualItemC1Ev @ 16 NONAME + _ZN3Alf13MulVisualItemC2ERKS0_ @ 17 NONAME + _ZN3Alf13MulVisualItemC2Ev @ 18 NONAME + _ZN3Alf13MulVisualItemD1Ev @ 19 NONAME + _ZN3Alf13MulVisualItemD2Ev @ 20 NONAME + _ZN3Alf14MulVariantType5CloneEv @ 21 NONAME + _ZN3Alf14MulVariantTypeC1ERK7TDesC16 @ 22 NONAME + _ZN3Alf14MulVariantTypeC1ERKb @ 23 NONAME + _ZN3Alf14MulVariantTypeC1ERKd @ 24 NONAME + _ZN3Alf14MulVariantTypeC1ERKi @ 25 NONAME + _ZN3Alf14MulVariantTypeC1ERKj @ 26 NONAME + _ZN3Alf14MulVariantTypeC1ERNS_7IAlfMapE @ 27 NONAME + _ZN3Alf14MulVariantTypeC1Ev @ 28 NONAME + _ZN3Alf14MulVariantTypeC2ERK7TDesC16 @ 29 NONAME + _ZN3Alf14MulVariantTypeC2ERKb @ 30 NONAME + _ZN3Alf14MulVariantTypeC2ERKd @ 31 NONAME + _ZN3Alf14MulVariantTypeC2ERKi @ 32 NONAME + _ZN3Alf14MulVariantTypeC2ERKj @ 33 NONAME + _ZN3Alf14MulVariantTypeC2ERNS_7IAlfMapE @ 34 NONAME + _ZN3Alf14MulVariantTypeC2Ev @ 35 NONAME + _ZN3Alf14MulVariantTypeD0Ev @ 36 NONAME + _ZN3Alf14MulVariantTypeD1Ev @ 37 NONAME + _ZN3Alf14MulVariantTypeD2Ev @ 38 NONAME + _ZN3Alf15MulModelUtility12IntToUStringEi @ 39 NONAME + _ZN3Alf15MulModelUtility16CreateVisualItemENS_9mulwidget16TLogicalTemplateE @ 40 NONAME + _ZN3Alf15MulModelUtility17CreateVariantTypeERNS_15IAlfVariantTypeE @ 41 NONAME + _ZN3Alf15MulModelUtility18AlfStringToUStringERKN7osncore7UStringE @ 42 NONAME + _ZN3Alf15MulModelUtility18UStringToAlfStringERKN7osncore7UStringE @ 43 NONAME + _ZN3Alf15MulModelUtility20ConvertTDesToUStringERK7TDesC16RN7osncore7UStringE @ 44 NONAME + _ZN3Alf15MulModelUtility20ConvertUStringToTDesERKN7osncore7UStringER6TDes16 @ 45 NONAME + _ZN3Alf15MulModelUtility21ConvertTDes8ToUStringERK6TDesC8RN7osncore7UStringE @ 46 NONAME + _ZN3Alf15MulModelUtility21ConvertUStringToTDes8ERKN7osncore7UStringER5TDes8 @ 47 NONAME + _ZN3Alf15MulModelUtility22ConvertMapToVisualItemERNS_7IAlfMapE @ 48 NONAME + _ZN3Alf15MulModelUtility22ConvertVisualItemToMapERNS_13MulVisualItemE @ 49 NONAME + _ZNK3Alf11MulDataPath5DepthEv @ 50 NONAME + _ZNK3Alf11MulDataPathixEi @ 51 NONAME + _ZNK3Alf13MulVisualItem10AttributesEv @ 52 NONAME + _ZNK3Alf13MulVisualItem14AttributeAsIntENS_13mulvisualitem16TVisualAttributeE @ 53 NONAME + _ZNK3Alf13MulVisualItem17AttributeAsStringENS_13mulvisualitem16TVisualAttributeE @ 54 NONAME + _ZNK3Alf13MulVisualItem7IsDirtyENS_13mulvisualitem16TVisualAttributeE @ 55 NONAME + _ZNK3Alf13MulVisualItem9AttributeENS_13mulvisualitem16TVisualAttributeE @ 56 NONAME + _ZNK3Alf14MulVariantType3MapEv @ 57 NONAME + _ZNK3Alf14MulVariantType4DesCEv @ 58 NONAME + _ZNK3Alf14MulVariantType4TypeEv @ 59 NONAME + _ZNK3Alf14MulVariantType4realEv @ 60 NONAME + _ZNK3Alf14MulVariantType7booleanEv @ 61 NONAME + _ZNK3Alf14MulVariantType7integerEv @ 62 NONAME + _ZNK3Alf14MulVariantType8uintegerEv @ 63 NONAME + _ZTIN3Alf14MulVariantTypeE @ 64 NONAME ; ## + _ZTVN3Alf14MulVariantTypeE @ 65 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007-2008 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: Project build file +* +*/ + + +#include +PRJ_PLATFORMS + +ARMV5 WINSCW + +PRJ_EXPORTS + +../rom/muldatamodel.iby CORE_MW_LAYER_IBY_EXPORT_PATH(muldatamodel.iby) + +PRJ_MMPFILES + +mulmodelutility.mmp +muldatamodel.mmp +muldatamodelplugin.mmp + + +PRJ_TESTMMPFILES + + +//End of files diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/group/muldatamodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/group/muldatamodel.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007-2008 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: Project definition file +* +*/ + + +#include + +TARGET muldatamodel.dll +TARGETTYPE dll +UID 0x1000008D 0x2000D247 + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE mulmodelimpl.cpp +SOURCE mulpushmode.cpp +SOURCE mulpullmode.cpp +SOURCE mulcachemanager.cpp +SOURCE mulvisualitem.cpp +SOURCE muldatapath.cpp +SOURCE mulpagedatawindow.cpp +SOURCE mulasyncdataprovider.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../common/inc +USERINCLUDE ../../mullogging/inc +USERINCLUDE ../../../inc/alf +USERINCLUDE ../../../inc + +//Required by muldatamodel.UID +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY alfwidgetmodel.lib +LIBRARY osncore.lib +LIBRARY libc.lib +LIBRARY mulmodelutility.lib //For Visual Item and Filter +LIBRARY libpthread.lib +LIBRARY libstdcpp.lib +LIBRARY mullogging.lib //for logging + + +// End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/group/muldatamodelplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/group/muldatamodelplugin.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007-2008 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: Project definition file +* +*/ + + +#include + +TARGET muldatamodelplugin.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x2000D23E + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src + +SOURCE mulmodelfactoryplugin.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../inc/mul +USERINCLUDE ../../common/inc + +//Required by muldatamodel.UID +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE + +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY alfwidgetmodel.lib +LIBRARY mullogging.lib //for logging +LIBRARY osncore.lib +LIBRARY libc.lib +LIBRARY libpthread.lib +LIBRARY libstdcpp.lib +LIBRARY muldatamodel.lib + +SOURCEPATH ../data +LANG SC +START RESOURCE 2000d23e.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET muldatamodelplugin.rsc +#endif +END + +// End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/group/mulmodelutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/group/mulmodelutility.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 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: Project definition file +* +*/ + + +#include + +TARGET mulmodelutility.dll +TARGETTYPE dll +UID 0x1000008D 0x2000D246 + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE mulmodelutility.cpp +SOURCE mulvisualitem.cpp +SOURCE muldatapath.cpp +SOURCE mulvarianttype.cpp + +USERINCLUDE ../../common/inc +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE + +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY alfwidgetmodel.lib +LIBRARY osncore.lib +LIBRARY libc.lib +LIBRARY libpthread.lib +LIBRARY libstdcpp.lib +LIBRARY charconv.lib +LIBRARY mullogging.lib //for logging + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulactionitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulactionitem.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2007-2008 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: Action Data class + * +*/ + + +#ifndef MULACTIONITEM_H +#define MULACTIONITEM_H + +#include +#include +#include + +#include +#include + +namespace osncore + { + class UString; + } +using namespace osncore; + + +namespace Alf + { + + namespace mulactionitem + { + static const char* const KActionString = "actionItem"; + } + /*! @struct MulActionData + * @brief Class holds the Action Data. Data varies on the basis of the type of + * the action. Individual data items are public and can be accessed + * once ref is obtained to the MulActionData structure. + */ + struct MulActionData + { + /*! @var Contains command id in case of simple command. */ + int mCmdId; + }; + + /*! @struct MulActionData + * @brief Client need to use this class to add action item to data model. + * Action can be of type simple command or a service api. + * More data about the action is also encapsulated within the same class + * Action item will represent one attribute within the visual item. + * + */ + class MulActionItem : public IMulVariantType//public IAlfModelBase + { + public: + + /*! @enum TMulActionType + * Action Type Definition. + */ + enum TMulActionType + { + EActionSimple /*!< Type specifies that the action is a simple command. */ + }; + + public: //Constructor and Destructor + + /** + * C++ constructor + * + * @param aType Action type. Possible options are defined by TMulActionType. + * @param aData Action data based on type of the action. Ownership gets transfered. + * @throw Invalid_argument, In case aData is NULL. + */ + OSN_IMPORT MulActionItem(TMulActionType aType, MulActionData* aData); + + /** + * Copy constructor. + */ + OSN_IMPORT MulActionItem( const MulActionItem& aActionItem ); + + /** + * Destructor. + */ + OSN_IMPORT ~MulActionItem(); + + public: // New methods + + /** + * Set/Change the action type of an action item. + * Default type of the action item is EActionSimple. + * + * @param aType Action type. Possible options are defined by TMulActionType. + */ + OSN_IMPORT void SetActionType( TMulActionType aType = EActionSimple ); + + /** + * Returns the action type of the action item. + * + * @return Action type. Possible options are defined by TMulActionType. + */ + OSN_IMPORT MulActionItem::TMulActionType ActionType() const; + + /** + * Set/Change the action data of an action item. + * Ownership gets transfered. + * + * @param aData Action data based on type of the action. Ownership gets transfered. + * @throw Invalid_argument, In case aData is NULL. + */ + OSN_IMPORT void SetActionData( MulActionData* aData ); + + /** + * Returns the action data of the action item. + * + * @return Action data of the action item. A const reference is returned. + */ + OSN_IMPORT const MulActionData& ActionData() const; + + public: // from IAlfModelBase + + //virtual const UString& Type(); + + public: // from IMulVariantType + + OSN_IMPORT std::auto_ptr< IMulVariantType > Clone(); + + private: // form IAlfVAriantType + + void set(IAlfVariantType& aValue) ; + + Type type() const ; + + bool boolean() const ; + + int integer() const ; + + uint uinteger() const ; + + double real() const ; + + const UString& string() const ; + + IAlfContainer* container() ; + + IAlfMap* map() ; + + IAlfBranch* branch() ; + + IAlfModelBase* customData() ; + + private: // form IAlfVariantType + + private: // Class data + + /*! @var Type of the action data the class instance holds. */ + TMulActionType mType; + + /*! @var Pointer to the action data. Data varies on the basis of the action type + * Class owns the action data. */ + auto_ptr mData; + + /*! @var Pointer to the ActionString data. */ + auto_ptr mActionString; + }; + + } // namespace Alf + +#endif //MULACTIONITEM_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulasyncdataprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulasyncdataprovider.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2007-2008 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: Active Object header for providing data asynchronously +* +*/ + + +#ifndef __MULASYNCDATAPROVIDER_H__ +#define __MULASYNCDATAPROVIDER_H__ + +#include // For CActive +#include +#include +#include + +#include "muldatawindow.h" +#include "mulpagedatawindow.h" + +using namespace std; +//Forward declarations + + +namespace Alf + { +//Forward declarations + +class MulAsyncData + { +public: + bool operator == (const MulAsyncData& aData ) + { + return ( this->mStartIndex == aData.mStartIndex && this->mRange == aData.mRange ); + } +public: + int mStartIndex; + int mRange; + MulDataPath mPath; + }; + +class MulAsyncDataProvider : public CActive + { + +public : // Constructor and Destructor + + /// need to have two-phase construction + /// - otherwise mixing leaves and throws + MulAsyncDataProvider( IMulModelProvider& aDataProvider, const MulPageDataWindow& aDataWindow ); + + ~MulAsyncDataProvider(); + + void ProvideData( int aStartIndex, int aRange, const MulDataPath& aPath, const bool aIsSync = false ); + +private: + + /** + * Active call back funtion . + */ + void RunL(); + + void DoCancel(); + + void ActivateAndComplete(); + + int GetFirstIndexForWhichDataIsPresent(int aStartIndex, int aEndIndex); + +private: //data + + IMulModelProvider& mDataProvider; + vector mDataQueue; + const MulPageDataWindow& mDataWindow; + }; //end of class. + + } // End of namespace . + +#endif //__MULASYNCDATAPROVIDER_H__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulcachemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulcachemanager.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,355 @@ +/* +* Copyright (c) 2007-2008 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: Cache Manager class +* +*/ + + +#ifndef MULCACHEMANAGER_H +#define MULCACHEMANAGER_H + +#include + +#include +#include +#include + +#include +#include + +#include "multree.h" +#include "mulvectoradaptor.h" + +namespace osncore + { + class UString; + } +using namespace osncore; + +namespace Alf + { + +//Forward Declaration +class MulVisualItem; +class IAlfMap; +class IAlfContainer; + +/** + * Implementation class for Cache Manager. + * @lib + */ + +class MulCacheManager + { +public: //structure + + /** + * Comparation structure + * Required by stl map to compare MulDataPath + */ + struct TCompPath + { + bool operator()( MulDataPath& path1, MulDataPath& path2 ) const + { + return ( path1 < path2 ) ; + } + }; + + typedef std::map< int,MulVisualItem* > MulVisualItemMap; + typedef std::map< int, int > MulSelectionMap; + +public: //Constructor and destructor + + /** + * C++ constructor. + */ + MulCacheManager(); + + /** + * Destructor. + */ + ~MulCacheManager(); + +public: //New method + + /** + * Create Node for visual items in tree. + * this function must be called before adding VisualItem + * + * @param aStartIndex Index of first item. + * @param aCount Number of items to be added. + * @param aPath + */ + void CreateNodes(int aStartIndex, int aCount, const MulDataPath& aPath ); + + /** + * Adds Visual Item in CacheManager. + * + * @param aVisualItem Visual items to be added. + * @param aItemIndex Index where item need to be added + * + * @return index where item is added + */ + //void AddVisualItem( std::auto_ptr aVisualItem, int aItemIndex ); + + /** + * Add Visual Item to cache manager + * + * @param aVisualItem Visual item to be added + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + */ + void AddVisualItem( std::auto_ptr aVisualItem, const MulDataPath& aPath , int aIndex ); + + /** + * Removes Visual Item in CacheManager. + * + * @param aIndex index of item to be removed. + * + * @throws invalid_argument exception + */ + + void RemoveVisualItem( int aIndex ); + + /** + * Remove Visual Item from cache manager + * + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + */ + void RemoveVisualItem( const MulDataPath& aPath , int aIndex ); + + + /** + * Remove Visual item form cache manager + * + * @param aIndex Start index of item to delete + * @param aCount No of items to be removed + * @param aPath Path from items to be removed + */ + void RemoveVisualItem(int aIndex, int aCount, const MulDataPath& aPath); + + /** + * Updates Visual Item in CacheManager. + * + * @param aVisualItem Visual items to be updated. + * @param aItemIndex Index where item need to be added + * @throws invalid_argument exception + */ + + void UpdateVisualItem( MulVisualItem& aVisualItem, int aItemIndex ); + + + /** + * Updates Visual Item in CacheManager. + * + * @param aVisualItem Visual items to be updated. + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + * @throws invalid_argument exception + */ + void UpdateVisualItem( MulVisualItem& aVisualItem, const MulDataPath& aPath, int aIndex ); + + /** + * Returns Visual Items to Model from CacheManager. + * + * @param aIndex Index of item to be retrieved. + */ + + MulVisualItem* Data( int aIndex ) const; + + /** + * Returns Visual Items to Model from CacheManager. + * + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + */ + MulVisualItem* Data( const MulDataPath& aPath, int aIndex ) const; + + /** + * Gets Number Of items stored in the Cache Manager . + * + * @return number of items in the Cache Manager + */ + int Count() const; + + /** + * Get Number of items in mentiond path + * + * @param aPath Path of node + * @return number of items + */ + //int Count( const MulDataPath& aPath ) const; + + /** + * Get Number of childs for the given node + * + * @param aPath Path of node + * @return number of items + */ + //int ChildCount( const MulDataPath& aPath ) const; + + /** + * Retrun number of items, + * Checks that node is expanded or not , + * if expanded then add it couts child count else ignore child count. + * + * @return Node count + */ + int ExpandedNodeCount( ) const; + + /** + * Return path of node of specified absoulte index + * + * @param aAbsoluteIndex Absoulte index of node in tree + * @return Path to node. + */ + //MulDataPath Path( int aAbsoluteIndex ) const; + + /** + * Expand Node with given absolute index + * This Api will be called by widget to expand node. + * + * @param aAbsoluteIndex Absolute index of node to be expanded + * @return Number of items affected + */ + //int ExpandNode( int aAbsoluteIndex ); + + + /** + * Returns absolute index + * + * @param aPath Path to node + * @param aIndex index of node in path + * @return Absolute index + */ + //int PathToAbsoluteIndex( const MulDataPath& aPath, int aIndex ) const; + + /** + * Mark or Unmark item + * + * @param aType Marking type + * @param aItemsIndex vector of index of items + * @param aPath Path/depth at wich items are to be marked/unmark + */ + void SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType , + const std::vector& aItemsIndex, + const MulDataPath& aPath ); + + /** + * Mark or Unmark or unmark all type + * + * @param aType Marking type + */ + void SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType = MulWidgetDef::EMulMarkAll ); + + /** + * Return mared index for mentioned path + * + * @param aPath Path + * @return vector of index + */ + const std::vector& MarkedIndices( const MulDataPath& aPath ) ; + + /** + * Check weather item at specified index is marked or not. + * + * @param aIndex Absolute index of item + * @return true if seleccted else otherwise + */ + bool IsItemMarked( int aIndex ) const; + + /** + * Function for setting the item Marked or Unmarked. For mark and + * unmark operations, index of item should be provided. + * + * @param aType Type of marking operation to be performed. + * @param aItemsIndex Indices of the items to be changed + * @throw Invalid Argument, if type is specified as mark-all and unmark-all. + */ + void SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ); + +private: //New Method + + /** + * Remove visual Item data from map and update other keys for map + * + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + * @param aCount No of items to be removed + */ + void RemoveItemFromMap(const MulDataPath& aPath , int aIndex ); + + /** + * Remove child visual Item from map + * + * @param aPath Path of visual item in tree + * @param aIndex Index of visual item in path + */ + //void RemoveChildItemsFromMap(MulDataPath aPath , int aIndex ); + + + /** + * Update index in Map. + * + * Once we remove any item from tree. + * Index of other items will be changed so the path that points + * to Data of Item. We now need to update path that to item. + * + * @param aMap Map wich need to be updated + * @param aIndex Index from item removed + */ + template void UpdataPathInMapAfterRemove( std::map& aMap, int aIndex, int aCount ); + + /** + * Update Path in Map. + * + * Update the path (modify thh depth) for the child items after remove. + * + * @param aMap Map wich need to be updated + * @param aParentNode, parent node + * @param aOldPath Old path + * @param aNewPath New path + * @param aIndex, index of the node in that parent node + */ +// template void UpdataChildDepthInMap( +// std::map& aMap, +// MulTreeNode* aParentNode,MulDataPath& aOldPath, +// MulDataPath& aNewPath,int aIndex); + /** + * Update index in Map. + * + * Once we insert any item from tree. + * Index of other items will be changed so the path that points + * to Data of Item. We now need to update path that to item. + * + * @param aMap Map wich need to be updated + * @param aIndex Index at which new item inserted + */ + template void UpdataPathInMapAfterInsert( std::map& aMap, int aIndex, int aCount ); + + +private: //data + + int mTotalCount; // total no of items in cache + MulVisualItemMap mVisualItemMap; //store visual item in map using path as key + MulVectorAdaptor mSelectionVector;//store maked indices to ,used to return marking information to client + MulSelectionMap mSelectionMap; //store marking information using path as key + }; + +} // namespace Alf + +#endif //MULCACHEMANAGER_H + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulcallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulcallback.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: Active object for performing Async filtering +* +*/ + + +#ifndef MULCALLBACK_H_ +#define MULCALLBACK_H_ + +#include + +namespace Alf + { + +class MulCallback + { +public: + + MulCallback() + { + } + + MulCallback( void (*aFunction) ( void* aObject, std::vector& aArgument ), void* aObject ) + { + mFunction = aFunction; + mObject = aObject; + } + + void Callback( std::vector& aArgument ) const + { + mFunction( mObject, aArgument ); + } + +private: + + void (*mFunction) ( void* aObject, std::vector& aArgument ); + + void* mObject; + + }; + + }//namespace Alf + +#endif //MULCALLBACK_H_ \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/muldatawindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/muldatawindow.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,356 @@ +/* +* Copyright (c) 2007-2008 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: Data Window Implemenation +* +*/ + + +#ifndef MULDATAWINDOW_H_ +#define MULDATAWINDOW_H_ + +#include "mulmodeldef.h" + +namespace Alf + { + +//Forward Declaration +class MulModelImpl; + +/** + * Implametation of Data Window Class + * This class maintain offset for buffer item that are required by widget, + * so only that much item remain present in alf model instance.It update buffer items + * when highlight changed and notify model to update alf model if items are not present + * in Alf model. + * + */ +class MulDataWindow + { +public: //Constructor and Destructor + + /** + * C++ constructor + * + * @param aMulModel refrece of model implementation + */ + MulDataWindow( MulModelImpl& aMulModel ); + + /** + * Descturctor + */ + ~MulDataWindow(); + +public: //New Method + + /** + * Set window size + * + * @param aWindowSize No of items that are visible on screen + */ + void SetWindowSize( int aWindowSize ); + + /** + * Set Buffer size + * Here buffser size mean number of items that will be above and below window + * By default buffer size is equal to window size if following api is not called. + * + * @param aBufferSize Size of buffer + */ + void SetBufferSize( int aBufferSize ); + + /** + * Change highlighted index. + * Changing highlight will check that data window needs to be updated or not + * and if required it update data window + * + * @aHighlightIndex New highlighted item in Data window + * @throws invaid_argument exception + */ + void SetHighlight( int aHighlightIndex ); + + /** + * Scroll Window to mention item index + * it will check that data window needs to be updated or not + * and if required it update data window + * + * @aItemIndex item index + * @throws invaid_argument exception + */ + void ScrollWindow( int aItemIndex ); + + /** + * Return Highlighted item's index + * + * @return Highlighted item's index + */ + int Highlight() const + { + return mHighlight; + } + + /** + * Return previous top offset + * + * @return Previos top offset + */ + int OldTopOffset() const + { + return mOldBufferTop; + } + + /** + * Return previous bottom offset + * + * @return Previos bottom offset + */ + int OldBottomOffset() const + { + return mOldBufferBottom; + } + + /** + * Return current top offset + * + * @return Current top offset + */ + int TopOffset() const + { + return mBufferTop; + } + + /** + * Return current bottom offset + * + * @return Current bottom offset + */ + int BottomOffset() const + { + return mBufferBottom; + } + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + int TopWindowOffset() const + { + return mWindowTop; + } + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + int BottomWindowOffset() const + { + return mWindowBottom; + } + + /** + * Return the Old Rear Top offset + * + * @return Old Rear Top offset + */ + int OldRearTopOffset() const + { + return mOldRearBufferTop; + } + + /** + * Return the Old Rear Bottom offset + * + * @return Old Rear Bottom offset + */ + int OldRearBottomOffset() const + { + return mOldRearBufferBottom; + } + + /** + * Return the Rear Top offset + * + * @return Rear Top offset + */ + int RearTopOffset() const + { + return mRearBufferTop; + } + + /** + * Return the Rear Bottom offset + * + * @return Rear Bottom offset + */ + int RearBottomOffset() const + { + return mRearBufferBottom; + } + + /** + * Return buffer size + * + * @return Current buffer size + */ + int BufferSize() const + { + return mBufferSize; + } + + /** + * Return window size + * + * @return Current window size + */ + int WindowSize() const + { + return mWindowSize; + } + + /** + * Check that items falls in data window or not + * + * @param aItemIndex index of item + * @return true if item is in data window otherwise false + */ + bool IsItemInDataWindow(int aItemIndex ) const; + + /** + * Returns Relative index in datawindow from Absolute index + * + * @param aAbsoluteIndex Absolute index + * @return Relative index + */ + int RelativeIndex( int aAbsoluteIndex ) const; + + /** + * Returns Absoulte index from relative index + * + * @param aRelativeIndex Relative index + * @return Absolute index + */ + int AbsoluteIndex( int aRelativeIndex ) const; + + /** + * Check that valid window size it set or not. + * + * @return true - valid window size is set + * false - otherwisze + */ + bool IsWindowEnabled() const + { + return ( mWindowSize != KNotInitialized ); + } + + /** + * Adjust buffer offset according to window offset + */ + void AdjustBuffer(); + + /** + * modify the window top and window bottom values + */ + void SetVisibleWindow(int aWindowTop, int aWindowBottom); + + /** + * Return the complete buffer size, i.e. both top, bottom buffer and the window + */ + int ActualBufferSize() const + { + return (2 * mBufferSize) + mWindowSize; + } + + /** + * Change highlighted index. + * This change will not check that data window needs to be updated or not + * + * @aHighlightIndex New highlighted item in Data window + * @throws invaid_argument exception + */ + void UpdateHighlight( int aHighlightIndex ); + + /** + * Save old values + */ + void SaveOldValues() + { + mOldBufferTop = mBufferTop; + mOldBufferBottom = mBufferBottom; + + mOldRearBufferTop = mRearBufferTop; + mOldRearBufferBottom = mRearBufferBottom; + } + + /** + * Compares the current and old buffer values and returns true if teh values are cahnged + */ + bool IsBufferOffsetChanged(); + +private://New Method + + /** + * Check that visible window need to be updated or not. + * If required it update visible window. + */ + void UpdateDataWindow(); + + /** + * Data window is updated and window need to sifted down + */ + void ShiftWindowDown(); + + /** + * Data window is updated and window need to sifted up + */ + void ShiftWindowUp(); + +private: // Data + + MulModelImpl& mMulModel; //not own + + int mHighlight; + + //this is index of item wich decide window offset + int mItemIndex; //dont know what should be better name + int mOldItemIndex; + + int mBufferSize; + + int mWindowSize; + int mWindowOffset; + + int mWindowTop; + int mWindowBottom; + + int mBufferTop; + int mBufferBottom; + + int mOldBufferTop; + int mOldBufferBottom; + + int mRearBufferTop; + int mRearBufferBottom; + + int mOldRearBufferTop; + int mOldRearBufferBottom; + + }; + + } //namespace Alf + +#endif /*MULDATAWINDOW_H_*/ + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulfilterao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulfilterao.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2007-2008 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: Active object for performing Async filtering +* +*/ + + +#ifndef MULFILTERAO_H_ +#define MULFILTERAO_H_ + +#include + +#include +#include + +#include "mulcallback.h" + + +namespace osncore + { + template class CAlfPtrVector; + class UString; + } +using namespace osncore; + +namespace Alf + { +//Forward Declaration + +class MulCacheManager; +class MulDataWindow; +class MulFilter; +class IMulFilterDataProvider; +class MulCallback; + +class MulFilterAo : public CActive + { + +public: //constructor and destructor + + /** + * symbian constcutor + * + * @param aModel Model refrence + */ + //static MulFilterAo* NewL( IMulFilterDataProvider& aModel ); + + /** + * Destructor + */ + ~MulFilterAo(); + +public: //constructor and destructor + + /** + * C++ constcutor + * + * @param aModel Model refrence + */ + MulFilterAo(IMulFilterDataProvider& aModel ); + + /** + * symbian Second phase constructor + */ + //void ConstructL(); + +private: //from CActive + + void RunL(); + + void DoCancel(); + +public: //new method + + /** + * Perform Async filtering. Model call this function when SetFilter is called on Model. + * After performing async filtering function will notify model via callback object. + * + * @param aFilter Filter object + * @param aCallback Callback object + */ + void DoAsyncFilter(MulFilter& aFilter,MulCallback aCallback); + +private: + + /** + * Perform garbage collection operation + */ + void DoFilter(); + +private: //data + + IMulFilterDataProvider& mMulModel; + MulFilter* mFilter; //not own + MulCallback mCallback; + }; + + } //namespace Alf + +#endif /*MULFILTERAO_H_*/ + +//End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulmodeldef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulmodeldef.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-2008 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: Contains const character string for model +* +*/ + + +#ifndef __MULMODELDEF_H +#define __MULMODELDEF_H + +#include + +namespace Alf + { + +static const int KDefaultBufferSize = 50; +static const int KDefaultWindowSize = 20; +static const int KNotInitialized = -1; + +static const char* const KDefaultTemplate = "template"; +static const char* const KItem = "item"; +static const char* const KContainerIndex = "container"; +static const char* const KItemIndex = "itemindex"; +static const char* const KInvalidArgument = "invalid argument"; +static const char* const KIndex = "index"; +static const char* const KStartIndex = "index"; +static const char* const KCount = "count"; + +_LIT(KLInvalidArgument,"Invalid Argument"); +_LIT(KLNotImplemented,"Not implemented"); + + } // namespace Alf + +#endif // __MULMODELDEF_H + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulmodelfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulmodelfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007-2008 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 header for model. +* +*/ + + +#ifndef MULMODELFACTORYPLUGIN_H +#define MULMODELFACTORYPLUGIN_H + +#include +#include + +namespace Alf + { + +class IfId; + +/** + * Factory plugin for creating list widget related products. + */ +class MulFactoryPlugin: public IAlfFactoryPlugin + { +public: + + /** + * Two-phased symbian constructor. + * + * @return New instance of this factory plugin. + */ + static MulFactoryPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~MulFactoryPlugin(); + +// From base class MAlfPluginFactory + + /** + * Create factory product. + * + * @param aProduct Product to create. + * @param aInitData Initialization data for product + * @return Instance or NULL + */ + IAlfInterfaceBase* createProduct( const char* aProduct, void* aInitData ); + + /** + * Count available products + * + * @return Product count + */ + int productCount() const; + + /** + * Fetch product info by index + * + * @param aIndex List index + * @return Descriptor describing product + */ + const char* productInfo( int aIndex ) const; + +// From base class MAlfInterfaceBase + + /** + * Creates interface based on the given type. + * + * @param aType Interface type to create. + * @return Requested interface. + */ + IAlfInterfaceBase* makeInterface( const IfId& aType ); + }; + + } // namespace Alf + +// Exported factory function required by ECOM-framework +IMPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ); + +#endif //MULMODELFACTORYPLUGIN_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulmodelimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulmodelimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,258 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of model interface + * +*/ + + +#ifndef MULMODELIMPL_H +#define MULMODELIMPL_H + +//Includes +#include + +#include +#include +#include + +#include "mul/imulmodelaccessor.h" +#include "imulmodelobserver.h" + +namespace osncore + { + class UString; + } + +using namespace osncore; + +namespace Alf + { + +//Forward Declaration + +class MulDataWindow; +class MulPushMode; +class MulPageDataWindow; + +/** + * Implementation class for Data model. + * @lib + */ +class MulModelImpl : public IMulModel, + public IMulModelAccessor + { + +public: + + /** + * C++ constructor. + */ + OSN_IMPORT MulModelImpl(); + + /** + * Destructor. + */ + OSN_IMPORT virtual ~MulModelImpl(); + +public: //from IMulModel + + void Insert(int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath()); + + void Remove( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ); + + void Update( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ); + + void Refresh( int aCount, const MulDataPath& aPath = MulDataPath() ); + + void SetData( int aIndex, std::auto_ptr aVisualItem, + const MulDataPath& aPath = MulDataPath() ); + + const MulVisualItem* Data( int aIndex, + const MulDataPath& aPath = MulDataPath() ) const; + + int Count( const MulDataPath& aPath = MulDataPath() ) const; + + void SetDataProvider( const IMulModelProvider& aDataProvider ); + + void SetTemplate( mulwidget::TLogicalTemplate aTemplateId ); + + void SetTemplate( int aItemIndex, mulwidget::TLogicalTemplate aTemplateId, + const MulDataPath& aPath = MulDataPath() ); + + void SetDataWindow( int aSize ); + + int DataWindow( ) const; + + void SetHighlight( int aItemIndex, const MulDataPath& aPath = MulDataPath() ); + + int Highlight() ; + + int Highlight( MulDataPath& aPath ); + + void SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType , + const std::vector& aItemsIndex, + const MulDataPath& aPath = MulDataPath() ); + + void SetMarkedIndices( + MulWidgetDef::TMulWidgetMarkingType aType = MulWidgetDef::EMulMarkAll ); + + const std::vector& MarkedIndices( const MulDataPath& aPath = MulDataPath() ); + +public: //from IMulModelBase + + IMulModelAccessor* Accessor(); + +public: //from IMulModelAccessor + + void SetHighlight( int aItemIndex ); + + void ScrollWindow( int aItemIndex ); + + int CurrentItemCount(); + + void SetVisibleWindow( int aWindowSize, int aPageTopIndex = -1 ); + + int RelativeIndex( int aAbsoluteIndex ) const; + + int TopWindowOffset() const; + + int BottomWindowOffset() const; + + int TopOffset() const; + + int BottomOffset() const; + + int RearTopOffset() const; + + int RearBottomOffset() const; + + bool IsItemMarked( int aIndex ); + + const MulVisualItem& Item( int aAbsoluteIndex ); + + int AbsoluteIndex( int aRelativeIndex ); + + void SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ); + + bool IsLoopingOn(); + + void AddModelObserver( IMulModelObserver* aObserver ); + + void RemoveModelObserver( IMulModelObserver* aObserver ); + + mulwidget::TLogicalTemplate Template(); + +private: //from IAlfModel + + void addModelChangeObserver( IAlfModelChangeObserver& aObserver ); + + void removeModelChangeObserver( IAlfModelChangeObserver& aObserver ); + + void setData( IAlfVariantType* aData ); + + void updateData(int aNumContainerIndices,int* aContainerIndices, IAlfVariantType* aData ); + + void addData(int aNumContainerIndices,int* aContainerIndices, IAlfVariantType* aData ); + + void removeData(int aNumContainerIndices,int* aContainerIndices ); + + void executeOperations(AlfPtrVector& aOperationsArray); + + void executeOperation(AlfModelOperation* aOperation); + + void clearModel(); + + IAlfVariantType* data() const; + +private: // from base class MAlfInterfaceBase + + /** + * Getter for interfaces provided by the list model. + * + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +public: //new method + + /** + * When ever data window update data window, it will use this method to notify + * Data model to update data window and update alf model + */ + void DataWindowUpdated(); + +private: //New method + + /** + * Create Update event for selection change to notify Widget + * for selection change. Widget need to use IsItemMarked API for checking + * whether item is marked or unmarked. + * + * @param aAbsoluteIndex Absolute index + */ + void CreateMarkingEvent(int aAbsoluteIndex); + + /** + * Notify observer about state changed + * + * @param aState Highlight or making changed + * @param aData Index of new highlight or Index of marked or unmarked item. + * ( Item is marked or not should be checked using IMulModelAccessor interface) + */ + void NotifyStateChange( IMulModelObserver::TMulChangedState aState, std::auto_ptr aData); + + /** + * Notify observer about data change event + * + * @param aState Event to notify + * @param aStartIndex Start index of. + * @param aCount No of item affected + */ + void NotifyDataChange( IMulModelObserver::TMulChangedState aState, int aStartIndex, int aCount ); + + /** + * Notify observer about data change event + * + * @param aState Event to notify + * @param aIndex Start index of. + */ + void NotifyDataChange( IMulModelObserver::TMulChangedState aState, int aIndex ); + + /** + * Notify observer about template change + * + * @param aIndex index of item. + * @param aTamplateId changed template + */ + void NotifyTemplateChange( int aIndex, mulwidget::TLogicalTemplate aTamplateId ); + +private: //data + + //std::auto_ptr mDataWindow; //own + std::auto_ptr mDataWindow; //own + std::auto_ptr mModelHelper; //own + std::vector mObserverArray; + }; + + } // namespace Alf + +#endif //MULMODELIMPL_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulpagedatawindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulpagedatawindow.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,363 @@ +/* +* Copyright (c) 2007-2008 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: Page by Page Data Window Implemenation +* +*/ + + +#ifndef MULPAGEDATAWINDOW_H_ +#define MULPAGEDATAWINDOW_H_ + +#include "mulmodeldef.h" + +namespace Alf + { + +//Forward Declaration +class MulModelImpl; + +/** + * Implametation of Data Window Class + * This class maintain offset for buffer item that are required by widget, + * so only that much item remain present in alf model instance.It update buffer items + * when highlight changed and notify model to update alf model if items are not present + * in Alf model. + * + */ +class MulPageDataWindow + { +public: //Constructor and Destructor + + /** + * C++ constructor + * + * @param aMulModel refrece of model implementation + */ + MulPageDataWindow( MulModelImpl& aMulModel ); + + /** + * Descturctor + */ + ~MulPageDataWindow(); + +public: //New Method + + /** + * Set window size + * + * @param aWindowSize No of items that are visible on screen + */ + void SetWindowSize( int aWindowSize, int aPageTopIndex = KNotInitialized ); + + /** + * Set Buffer size + * Here buffser size mean number of items that will be above and below window + * By default buffer size is equal to window size if following api is not called. + * + * @param aBufferSize Size of buffer + */ + void SetBufferSize( int aBufferSize ); + + /** + * Change highlighted index. + * Changing highlight will check that data window needs to be updated or not + * and if required it update data window + * + * @aHighlightIndex New highlighted item in Data window + * @throws invaid_argument exception + */ + void SetHighlight( int aHighlightIndex ); + + /** + * Scroll Window to mention item index + * it will check that data window needs to be updated or not + * and if required it update data window + * + * @aItemIndex item index + * @throws invaid_argument exception + */ + void ScrollWindow( int aPageTopIndex ); + + /** + * Return Highlighted item's index + * + * @return Highlighted item's index + */ + int Highlight() const + { + return mHighlight; + } + + /** + * Return previous top offset + * + * @return Previos top offset + */ + int OldTopOffset() const + { + return mOldBufferTop; + } + + /** + * Return previous bottom offset + * + * @return Previos bottom offset + */ + int OldBottomOffset() const + { + return mOldBufferBottom; + } + + /** + * Return current top offset + * + * @return Current top offset + */ + int TopOffset() const + { + return mBufferTop; + } + + /** + * Return current bottom offset + * + * @return Current bottom offset + */ + int BottomOffset() const + { + return mBufferBottom; + } + + /** + * Return visible window top offset + * + * @return Current window top offset + */ + int TopWindowOffset() const + { + return mWindowTop; + } + + /** + * Return visible window bottom offset + * + * @return Current window bottom offset + */ + int BottomWindowOffset() const + { + return mWindowBottom; + } + + /** + * Return the Old Rear Top offset + * + * @return Old Rear Top offset + */ + int OldRearTopOffset() const + { + return mOldRearBufferTop; + } + + /** + * Return the Old Rear Bottom offset + * + * @return Old Rear Bottom offset + */ + int OldRearBottomOffset() const + { + return mOldRearBufferBottom; + } + + /** + * Return the Rear Top offset + * + * @return Rear Top offset + */ + int RearTopOffset() const + { + return mRearBufferTop; + } + + /** + * Return the Rear Bottom offset + * + * @return Rear Bottom offset + */ + int RearBottomOffset() const + { + return mRearBufferBottom; + } + + /** + * Return buffer size + * + * @return Current buffer size + */ + int BufferSize() const + { + return mBufferSize; + } + + /** + * Return window size + * + * @return Current window size + */ + int WindowSize() const + { + return mWindowSize; + } + + /** + * Check that items falls in data window or not + * + * @param aItemIndex index of item + * @return true if item is in data window otherwise false + */ + bool IsItemInDataWindow(int aItemIndex ) const; + + + /** + * Check that items falls in visible window or not + * + * @param aItemIndex index of item + * @return true if item is in visible window otherwise false + */ + bool IsItemInVisibleWindow(int aItemIndex ) const; + + /** + * Returns Relative index in datawindow from Absolute index + * + * @param aAbsoluteIndex Absolute index + * @return Relative index + */ + int RelativeIndex( int aAbsoluteIndex ) const; + + /** + * Returns Absoulte index from relative index + * + * @param aRelativeIndex Relative index + * @return Absolute index + */ + int AbsoluteIndex( int aRelativeIndex ) const; + + /** + * Check that valid window size it set or not. + * + * @return true - valid window size is set + * false - otherwisze + */ + bool IsWindowEnabled() const + { + return ( mWindowSize != KNotInitialized ); + } + + /** + * Adjust buffer offset according to window offset + */ + void AdjustBuffer(); + + /** + * Return the complete buffer size, i.e. both top, bottom buffer and the window + */ + int ActualBufferSize() const + { + return (2 * mBufferSize) + mWindowSize; + } + + /** + * Change highlighted index. + * This change will not check that data window needs to be updated or not + * + * @aHighlightIndex New highlighted item in Data window + */ + void UpdateHighlight( int aHighlightIndex ); + + /** + * Adjust Window and buffer offset after insert or remove + * + */ + void AdjustOffset(); + + /** + * Save old values + */ + void SaveOldValues() + { + mOldBufferTop = mBufferTop; + mOldBufferBottom = mBufferBottom; + + mOldRearBufferTop = mRearBufferTop; + mOldRearBufferBottom = mRearBufferBottom; + } + + /** + * Compares the current and old buffer values and returns true if teh values are cahnged + */ + bool IsBufferOffsetChanged(); + +private://New Method + + /** + * Check that visible window need to be updated or not. + * If required it update visible window. + */ + void UpdateDataWindow(); + + /** + * Data window is updated and window need to sifted down + */ + //void ShiftWindowDown(); + + /** + * Data window is updated and window need to sifted up + */ + //void ShiftWindowUp(); + +private: // Data + + MulModelImpl& mMulModel; //not own + + int mHighlight; + + int mPageTopIndex; + int mOldPageTopIndex; + + int mBufferSize; + + int mWindowSize; + + int mWindowTop; + int mWindowBottom; + + int mBufferTop; + int mBufferBottom; + + int mOldBufferTop; + int mOldBufferBottom; + + int mRearBufferTop; + int mRearBufferBottom; + + int mOldRearBufferTop; + int mOldRearBufferBottom; + + }; + + } //namespace Alf + +#endif //MULPAGEDATAWINDOW_H_ + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulpullmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulpullmode.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007-2008 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: Header for Pull Mode + * +*/ + + +#ifndef MULPULLMODE_H +#define MULPULLMODE_H + +//Includes +#include "mulpushmode.h" + +namespace Alf + { + +//Forward Declaration + +class IMulModelProvider; +class MulAsyncDataProvider; + +/** + * Implementation for Pull Mode + */ +class MulPullMode : public MulPushMode + { + +public: + + /** + * C++ constructor. + * + * @param aDataWindow DataWindow for model + * @param aModelProvider Data Provider for model + */ + MulPullMode( MulPageDataWindow& aDataWindow, + const IMulModelProvider& aModelProvider); + + /** + * Destructor. + */ + ~MulPullMode(); + +public: //from MulPushMode + + + void Update( int aIndex, int aCount, + const MulDataPath& aPath); + + void Refresh(int aCount, const MulDataPath& aPath); + + void SetData( int aIndex, auto_ptr aVisualItem, + const MulDataPath& aPath); + + void SetTemplate( mulwidget::TLogicalTemplate aTemplateId ); + + void WindowSiftedDown(); + + void WindowSiftedUp(); + + void ModelCountChanged(int aOldCount, int aNewCount); + + void DataWindowUpdated(); + + const MulVisualItem& Item( int aAbsoluteIndex ); + +private: + + /** + * Create list of indices and call ProvideData method + * + * @param aStartIndex, Index form where the data should be fetched + * @param aRange, Number of items for which data should be fetched + */ + void ProvideData(int aStartIndex, int aRange); + + /** + * Update Loop buffer because of data window updation + * + */ + void UpdateLoopBuffer(); + +private: //data + + //IMulModelProvider* mModelProvider; // Not own + auto_ptr mModelProvider; // own + }; + + } // namespace Alf + +#endif // MULPULLMODE_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulpushmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulpushmode.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of model interface base + * +*/ + + +#ifndef MULPUSHMODE_H +#define MULPUSHMODE_H + +//Includes +#include + +#include + +#include "mul/imulwidget.h" + + +namespace Alf + { + +//Forward Declaration + +class MulVisualItem; +class MulCacheManager; +class MulPageDataWindow; +class MulAlfModelImpl; + + +/** + * Base implementation class for pull/push model. + * @lib + */ +class MulPushMode + { + +public: + + /** + * C++ constructor. + * + * @param aDataWindow DataWindow for model + */ + MulPushMode( MulPageDataWindow& aDataWindow ); + + /** + * Destructor + */ + virtual ~MulPushMode(); + + /** + * Informs the data model that new items have been added to client's + * internal model. Data model is expected to sync its indices as a + * result. + * + * @param aIndex Position where items were inserted. + * @param aCount Number of items inserted. + * @return true if highlight is modified else false. + */ + bool Insert( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ); + + /** + * Informs the data model that items have been removed from the client's. + * internal data model.Data model is expected to sync its indices as a + * result. + * + * @param aIndex Position from where items have to be removed. + * @param aCount Number of items to be removed. + * @return true if highlight is modified else false. + */ + bool Remove( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ); + + /** + * Informs the data model that an item has been updated in the client's + * internal model. Data model will use to input to determine whether + * a visualization change is required. + * + * @param aIndex Position from where items have to be updated. + * @param aCount Number of items to be updated. + */ + virtual void Update( int aIndex, int aCount, + const MulDataPath& aPath = MulDataPath() ); + + + /** + * A refresh data request. Informs that the data model has to be + * repopulated with mentioned number of items. So the data model + * will remove all the existing data and issue request to the + * provider for new data. + * + * @param aCount Number of items to be repopulated. + * @param aPath Path of parent item in the data hierarchy. + * Default is Null path i.e. no parent. + */ + virtual void Refresh( int aCount, const MulDataPath& aPath = MulDataPath()); + + /** + * Provide data for the specified item. This is a unified API for + * adding & updating data. + * + * @param aIndex Position of item to be updated. + * @param aVisualItem Collection of attributes. Ownership is transfered. + * @throw Invalid Argument, in case index is out of bound or visual + * item is NULL. + * @throw Logic Error, in case item could not be updated. + */ + virtual void SetData( int aIndex, + std::auto_ptr aVisualItem, + const MulDataPath& aPath); + + /** + * Get the data for item at the specified index. + * + * @param aIndex Position of item in the data model. + * @return A constant reference to the data at the given index. + */ + const MulVisualItem* Data( int aIndex, const MulDataPath& aPath ) const; + + /** + * Get the count of items in the model. + * + * @return Count of items in the model. + */ + int Count(const MulDataPath& aPath ) const; + + /** + * Set the default logical template id for widget elements. + * Logical templates map to visualization of the element(s). + * + * @param aTemplateId Logical template id for the widget elements. + */ + virtual void SetTemplate( mulwidget::TLogicalTemplate aTemplateId ) ; + + /** + * Returns the default template. + * + * @return Logical template id for the widget elements. + */ + mulwidget::TLogicalTemplate Template( ) ; + + /** + * Set the logical template id for a specific widget element. + * Logical templates map to visualization of the element. + * + * @param aItemIndex Unique id of item of which template needs to be applied. + * @param aTemplateId Logical template id for the widget element. + * @throw Invalid Argument, in case index is out of bound. + */ + void SetTemplate( int aItemIndex, mulwidget::TLogicalTemplate aTemplateId, + const MulDataPath& aPath ); + + /** + * Returns the total number of items in model. + */ + int CurrentItemCount() const; + + /** + * When ever data window update data window, it will use this method to notify + * Data model to update data window and update alf model + */ + virtual void DataWindowUpdated(){ }; + + /** + * Return cachemanager + * + * @return cachae manager + */ + MulCacheManager& CacheManager() const; + + /** + * Get Visualte item from absolute index + * + * @param aAbsoluteIndex Absolute index + * @return VisualItem at index + */ + virtual const MulVisualItem& Item( int aAbsoluteIndex ); + + /** + * Check that visual item has Templatte or not + * If visualte item is not poper exception will be throws + * + * @param aVisualItem Visual item to be tested + */ + void ValidateVisualItem( MulVisualItem& aVisualItem ); + + /** + * Modify the data alfmodel to handle remove, insert, or expand/colapse operation + * + * @param, aOldCount Total number of items in Alf model before the current operation + */ + virtual void ModelCountChanged(int aOldCount, int aNewCount); + +private: + + /** + * If current highlight is greater than the number of items in model then update the highlight. + * + * @return Ture if highlight value is modified else false + */ + bool ValidateCurrentHighlight(); + +protected: // data members + + std::auto_ptr mCacheManager; //own + MulPageDataWindow& mDataWindow; // Not own + //UString mDefaultTemplate; //default template for data + mulwidget::TLogicalTemplate mDefaultTemplate; + + }; + + } // namespace Alf + +#endif // MULPUSHMODE_H + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/multree.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/multree.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2007-2008 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: Header for MulTree +* +*/ + + +#ifndef MULTREE_H_ +#define MULTREE_H_ + +#include +#include +#include + +namespace Alf + { +//Forward declaration +class MulDataPath; + +class MulTreeNode + { +public: + + /** + * Constuctor + * + * @param aIndex Index of this node + */ + MulTreeNode( int aIndex ) + { + mParent = NULL; + mExpandedState = false; + mIndex = aIndex; + } + + /** + * Constuctor + * + * @param aParent Parent node for this node. Node dosent take ownership of aParent + * @param aIndex Index of this node + */ + MulTreeNode( MulTreeNode* aParent, int aIndex ) + { + mParent = aParent; + mExpandedState = false; + mIndex = aIndex; + } + + /** + * Destructor + */ + ~MulTreeNode() + { + int count = mChilds.size(); + for(int i = 0 ; i < count ; ++i ) + { + delete Child(i); + } + mChilds.clear(); + } + + /** + * Insert child node in this node at given index + * + * @param aChild Child node.Takes ownership of aChild + * @param aIndex index at which child node to be inserted + */ + void InsertChild( std::auto_ptr aChild, int aIndex ) + { + aChild->mParent = this; + mChilds.insert( mChilds.begin() + aIndex, aChild.get() ); + aChild.release(); + } + + /** + * Remove child node from this node. + * + * @param aIndex Index of child that need to be removed + */ + void RemoveChild( int aIndex ) + { + MulTreeNode* childNode = Child(aIndex); + delete childNode; + childNode = NULL; + mChilds.erase( mChilds.begin() + aIndex ); + } + + /** + * Number of child node that this node contains + * + * @return Number of childs + */ + int ChildCount() const + { + return mChilds.size(); + } + + /** + * Return child node at given index + * + * @param aIndex index of child node + * @return Child node at given index + */ + MulTreeNode* Child( int aIndex ) + { + //At checks for out of bound condition we dont need to check again + return mChilds.at(aIndex); + } + + /** + * Check that weather this node is parent node and has any childs + * + * @retrun true if node has cilds false otherwise + */ + bool HasChild() const + { + return ( ChildCount() > 0 ); + } + + /** + * Return parent of this node + * + * @return Parent of node + */ + MulTreeNode* Parent() const + { + return mParent; + } + + /** + * Set Index of node to current path + * + * @param aIndex index of node + */ + void SetIndex( int aIndex ) + { + mIndex = aIndex; + } + + /** + * Return index of node + * + * @return index of node. + */ + int Index() const + { + return mIndex; + } + + /** + * Expand or unexpand node. + * + * @param aExpendedState New state of node + */ + void SetExpanded( bool aExpandedState ) + { + mExpandedState = aExpandedState; + } + + /** + * Return weather this node is expended or not + * + * @return true if expended, false otherwise + */ + bool IsExpanded() const + { + return mExpandedState; + } + +private: + + MulTreeNode* mParent; //not own + int mIndex; + bool mExpandedState; + std::vector mChilds; //owns all children + }; + +class MulTree + { +public: //Constructor and Destructor + + /** + * C++ Constructor + */ + MulTree() + { + //create root node for tree + mRootNode.reset( new (EMM) MulTreeNode(0) ); + mRootNode->SetExpanded( true ); + mRootNode->SetIndex(0); + } + + /** + * Destructor + */ + ~MulTree() + { + } + +public: //New method + + /** + * Create new node at specified index + * + * @param aPath Path to parent node + * @param aIndex Position at which node to be inserted in parent node + */ + void AddNode( const MulDataPath& aPath, int aIndex ); + + /** + * Remove node from specified index + * + * @param aPath Path to parent node + * @param aIndex Posiotin at which node to be remove from parent node + */ + void RemoveNode( const MulDataPath& aPath, int aIndex ); + + /** + * Finds node with specified path + * + * @param aPath path of node to be find + * @return Node does not return ownership + */ + MulTreeNode* FindNode( const MulDataPath& aPath ) const; + + /** + * Finds node with specified index in specified node + * + * @param aParentNode Parent node in which search required to be made + * @param aIndex Index of node to be find + * @return Node does not return ownership + */ + MulTreeNode* FindChildNode( MulTreeNode* aParentNode, int aIndex ) const; + + /** + * Find node with specified absolute index and return path to that node. + * + * @param aIndex Index of node + * @return Path to node + */ + MulDataPath FindNode( int aIndex ) const; + + /** + * Create and return path for given node + * + * @param aNode Node of which path is required + * @return Path of node + */ + MulDataPath Path( MulTreeNode& aNode ) const; + + /** + * Return number of node this tree contains + * + * @return Number of nodes + */ + int NodeCount() const; + + /** + * Return number of node this node branch + * + * @return Number of nodes + */ + int NodeCount(MulTreeNode* aCurrentNode ) const; + + /** + * Return number of items, + * Checks that node is expanded or not, + * if expanded then add it counts child count else ignore child count. + * + * @return Node count + */ + int ExpandedNodeCount() const; + + /** + * Return number of items, + * Checks that node is expanded or not, + * if expanded then add it couts child count else ignore child count. + * + * @param aCurrentNode Node of which count is needed + * + * @return Node count + */ + int ExpandedNodeCount(MulTreeNode* aCurrentNode ) const; + + /** + * Returns node's absolute index + * + * @param aPath Path to node + * @param aIndex index of node in path + * @return position of node in whole tree + */ + int NodeIndex( const MulDataPath& aPath, int aIndex ) const; + +private: + + /** + * Find node with specified absolute index and return path to that node. + * + * @param aNode Node in which index to be find + * @param aIndex Index of node + * @return Path to node + */ + MulDataPath FindNode( MulTreeNode* aNode, int& aAbsoluteIndex, int aIndex ) const; + + /** + * Returns node's absolute index + * + * @param aCurrentNode Node to compare path with + * @param aPath Path of node which absolute index is required + * @param aAbsoluteIndex Counter variable + * @return position of node in whole tree + */ + int NodeIndex( MulTreeNode* aCurrentNode, const MulDataPath& aPath,int& aAbsoluteIndex ) const; + +private: //data + + std::auto_ptr mRootNode; //root of tree - owned + }; + + } //namespace Alf + +#endif /*MULTREE_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/inc/mulvectoradaptor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/inc/mulvectoradaptor.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2007-2008 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: Adaptor class for AlfPtrVector and Stt vector +* +*/ + + +#ifndef MULVECTORADAPTOR_H_ +#define MULVECTORADAPTOR_H_ + +#include +#include //for find algorithm + +using namespace std; + +namespace Alf + { + +//Forward Declaration + +/** + * Adaptor class for stl vector with interface similar to AlfPtrVector + */ +template class MulVectorAdaptor + { +public: //new method + + /** + * Return number of element in vector + * + * @return no of element in vector + */ + int count() + { + return mVector.size(); + } + + /** + * Insert item in vector + * + * @param aPosition Position of item + * @param aItem item to be inserted + */ + void insert( uint aPosition, T aItem ) + { + mVector.insert( mVector.begin() + aPosition, aItem ); + } + + /** + * Insert item in vector at last + * + * @param aItem item to be inserted + */ + void insert( T aItem ) + { + mVector.push_back( aItem ); + } + + /** + * Return item at specified index + * + * @param aPosition position of item + * @return itmem at specified index + */ + T operator[] ( uint aPosition ) const + { + return mVector[aPosition]; + } + + /** + * Remove item from specified position + * + * @param aPosition Position of item to be removed + */ + void remove( uint aPosition ) + { + mVector.erase( mVector.begin() + aPosition ); + } + + /** + * Remove specified item + * + * @param aItem Item to be removed + */ + void remove( T aItem ) + { +// vector::iterator iter = std::find( mVector.begin(), mVector.end(), aItem) ; +// if( iter != mVector.end()) +// { +// mVector.erase( iter ); +// } + + if( std::find( mVector.begin(), mVector.end(), aItem) != mVector.end()) + { + mVector.erase( std::find( mVector.begin(), mVector.end(), aItem) ); + } + } + + /** + * Return actual std vector of this adaptor class + * + * @return Return std vector. + */ + const vector& actualVector() + { + return mVector; + } + + /** + * Find specifed item in vecotr + * + * @return return true if item found false otherwise + */ + bool find( T aItem ) + { +// vector::iterator iter = std::find(mVector.begin(), mVector.end(), aItem) ; +// return (iter != mVector.end()); + + return (std::find(mVector.begin(), mVector.end(), aItem) != mVector.end()); + } + + /** + * Clear the content of vector + */ + void clear() + { + mVector.clear(); + } + +private: //data + + vector mVector; + }; + + } //namespace Alf + +#endif /*MULVECTORADAPTOR_H_*/ + +//End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/rom/muldatamodel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/rom/muldatamodel.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007-2008 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: Data model iby file. +* +*/ + + +#ifndef __MULDATAMODEL_IBY__ +#define __MULDATAMODEL_IBY__ + +ECOM_PLUGIN(muldatamodelplugin.dll, muldatamodelplugin.rsc) +file=\epoc32\release\armv5\urel\mulmodelutility.dll \sys\bin\mulmodelutility.dll +file=\epoc32\release\armv5\urel\muldatamodel.dll \sys\bin\muldatamodel.dll +//file=\epoc32\release\armv5\udeb\mulmodelutility.dll \sys\bin\mulmodelutility.dll +//file=\epoc32\release\armv5\udeb\muldatamodel.dll \sys\bin\muldatamodel.dll +#endif // __MULDATAMODEL_IBY__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulactionitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulactionitem.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2007-2008 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: Action item class implementation. + * +*/ + + +// includes +#include "mulactionitem.h" + +#include + +namespace Alf + { + +static const char* const KNotImplemented = "Not Implemented"; +static const char* const KInvalidArgument = "Invalid Parameter"; + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulActionItem::MulActionItem(TMulActionType aType, MulActionData* aData): + mType(aType) + { + if( !aData ) + { + throw std::invalid_argument(std::string(KInvalidArgument)); + } + mData = aData; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulActionItem::MulActionItem( const MulActionItem& aActionItem ) + { + mType = aActionItem.mType; + mData.reset( new (EMM) MulActionData(*aActionItem.mData.get())); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulActionItem::~MulActionItem() + { + // No implemnetation. + } + +// --------------------------------------------------------------------------- +// SetActionType +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulActionItem::SetActionType( TMulActionType aType) + { + mType = aType; + } + +// --------------------------------------------------------------------------- +// ActionType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulActionItem::TMulActionType MulActionItem::ActionType() const + { + return mType; + } + +// --------------------------------------------------------------------------- +// SetActionData +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulActionItem::SetActionData( MulActionData* aData ) + { + if( !aData ) + { + throw std::invalid_argument(std::string(KInvalidArgument)); + } + + mData = aData; + } + +// --------------------------------------------------------------------------- +// ActionData +// --------------------------------------------------------------------------- +// +OSN_EXPORT const MulActionData& MulActionItem::ActionData() const + { + return *mData.get(); + } + +// --------------------------------------------------------------------------- +// Type +// --------------------------------------------------------------------------- +// +//const UString& MulActionItem::Type() +// { +// mActionString.reset(new UString(mulactionitem::KActionString)); +// return *mActionString.get(); +// } + +// --------------------------------------------------------------------------- +// Clone +// --------------------------------------------------------------------------- +// +OSN_EXPORT std::auto_ptr< IMulVariantType > MulActionItem::Clone() + { + std::auto_ptr actionData( new (EMM) MulActionData(*mData)); + std::auto_ptr clone ( new (EMM) MulActionItem( ActionType(), actionData.get())); + actionData.release(); + return clone; + } + +// --------------------------------------------------------------------------- +// set +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulActionItem::set(IAlfVariantType& /*aValue*/) + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// type +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType::Type MulActionItem::type() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// boolean +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool MulActionItem::boolean() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// integer +// --------------------------------------------------------------------------- +// +OSN_EXPORT int MulActionItem::integer() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// uinteger +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint MulActionItem::uinteger() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// real +// --------------------------------------------------------------------------- +// +OSN_EXPORT double MulActionItem::real() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// string +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& MulActionItem::string() const + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// container +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* MulActionItem::container() + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* MulActionItem::map() + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// branch +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* MulActionItem::branch() + { + throw std::logic_error(KNotImplemented); + } + +// --------------------------------------------------------------------------- +// customData +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfModelBase* MulActionItem::customData() + { + throw std::logic_error(KNotImplemented); + } + + } // namespace ends + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulasyncdataprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulasyncdataprovider.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2007-2008 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: Active Object Implementation for providing data asynchronously +* +*/ + + +#include "mulasyncdataprovider.h" + +#include +#include //for find algorithm + +#include "mullog.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulAsyncDataProvider +// --------------------------------------------------------------------------- +// +MulAsyncDataProvider::MulAsyncDataProvider( IMulModelProvider& aDataProvider, + const MulPageDataWindow& aDataWindow ) + :CActive( EPriorityNormal ), + mDataProvider(aDataProvider), + mDataWindow(aDataWindow) + { + MUL_LOG_ENTRY_EXIT("MUL::MulAsyncDataProvider::MulAsyncDataProvider"); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// ~MulAsyncDataProvider +// --------------------------------------------------------------------------- +// +MulAsyncDataProvider::~MulAsyncDataProvider() + { + MUL_LOG_ENTRY_EXIT("MUL::MulAsyncDataProvider::~MulAsyncDataProvider"); + Cancel(); + mDataQueue.clear(); + } + +// --------------------------------------------------------------------------- +// RunL +// --------------------------------------------------------------------------- +// +void MulAsyncDataProvider::RunL() + { + vector::iterator iter = mDataQueue.begin(); + if( iter < mDataQueue.end() ) + { + bool inDataWindow = false; + MulAsyncData asyncData = *iter; + + if(mDataWindow.IsItemInDataWindow(asyncData.mStartIndex) /*&& mDataWindow->IsItemInDataWindow(mStartIndex+ITEMS)*/) + { + if( asyncData.mRange < mDataWindow.WindowSize() ) + { + mDataProvider.ProvideData( asyncData.mStartIndex, asyncData.mRange, asyncData.mPath); + } + else + { + mDataProvider.ProvideData( asyncData.mStartIndex, mDataWindow.WindowSize() , asyncData.mPath); + } + inDataWindow = true; + } + + asyncData.mStartIndex += mDataWindow.WindowSize(); + asyncData.mRange -= mDataWindow.WindowSize(); + mDataQueue.erase(iter); + + if( asyncData.mRange > 0 && inDataWindow ) + { + mDataQueue.insert( iter, asyncData ); + if( !IsActive() ) + { + ActivateAndComplete(); + } + } + else if(mDataQueue.begin() < mDataQueue.end()) + { + if( !IsActive() ) + { + ActivateAndComplete(); + } + } + } + } + +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void MulAsyncDataProvider::DoCancel() + { + //does this function required?? + } +// +// --------------------------------------------------------------------------- +// ProvideData +// --------------------------------------------------------------------------- +// +void MulAsyncDataProvider::ProvideData( int aStartIndex, int aRange, const MulDataPath& aPath, const bool aIsSync ) + { + if( aIsSync ) + { + mDataProvider.ProvideData( aStartIndex, aRange, aPath); + return; + } + MulAsyncData asyncData; + asyncData.mStartIndex = aStartIndex; + asyncData.mRange = aRange; + asyncData.mPath = aPath; + if( std::find( mDataQueue.begin(), mDataQueue.end(), asyncData ) == mDataQueue.end()) + { + mDataQueue.push_back( asyncData ); + } + + for( int i = 0 ; i < mDataQueue.size() ; ++i ) + { + MulAsyncData data = mDataQueue[i]; + if ( (mDataWindow.IsItemInDataWindow( data.mStartIndex ) && + !mDataWindow.IsItemInDataWindow( data.mStartIndex + data.mRange - 1 ) ) ) + { + int index = GetFirstIndexForWhichDataIsPresent(data.mStartIndex , data.mStartIndex + data.mRange - 1 ); + if( index!= -1 &&( index - data.mStartIndex + 1) > 0) + { + mDataQueue.erase(mDataQueue.begin() + i); + data.mRange = index - data.mStartIndex + 1; + mDataQueue.insert(mDataQueue.begin() + i, data); + } + else + { + mDataQueue.erase(mDataQueue.begin() + i); + i--; + } + + } + else if ( (!mDataWindow.IsItemInDataWindow( data.mStartIndex ) && + mDataWindow.IsItemInDataWindow( data.mStartIndex + data.mRange - 1 ) ) ) + { + int index = GetFirstIndexForWhichDataIsPresent(data.mStartIndex , data.mStartIndex + data.mRange - 1 ); + if( index!= -1 &&( data.mStartIndex + data.mRange - index ) > 0 ) + { + mDataQueue.erase(mDataQueue.begin() + i); + int endIndex = (data.mStartIndex + data.mRange - 1); + data.mStartIndex = index; + data.mRange = (endIndex - index + 1); + mDataQueue.insert(mDataQueue.begin() + i, data); + } + else + { + mDataQueue.erase(mDataQueue.begin() + i); + i--; + } + } + else if ( (!mDataWindow.IsItemInDataWindow( data.mStartIndex ) && + !mDataWindow.IsItemInDataWindow( data.mStartIndex + data.mRange - 1 ) ) ) + { + mDataQueue.erase(mDataQueue.begin() + i); + i--; + MUL_LOG_INFO2( "MUL::MulAsyncDataProvider::ProvideData Removing From Q: startIndx=%d,range=%d", data.mStartIndex, data.mRange ); + } + } + + if( !IsActive() ) + { + ActivateAndComplete(); + } + } +// --------------------------------------------------------------------------- +// GetFirstIndexForWhichDataIsPresent +// --------------------------------------------------------------------------- +// +int MulAsyncDataProvider::GetFirstIndexForWhichDataIsPresent(int aStartIndex, int aEndIndex) + { + if ( aStartIndex > aEndIndex ) + { + return -1; + } + int mid = (aStartIndex + aEndIndex)/2; + if(mDataWindow.IsItemInDataWindow(aStartIndex)) + { + if(mid == aStartIndex) + { + return mid; + } + if(mDataWindow.IsItemInDataWindow(mid)) + { + return GetFirstIndexForWhichDataIsPresent(mid, aEndIndex); + } + else + { + return GetFirstIndexForWhichDataIsPresent(aStartIndex, mid); + } + } + else if(mDataWindow.IsItemInDataWindow(aEndIndex)) + { + if(mid == aStartIndex) + { + return (mid + 1); + } + if(mDataWindow.IsItemInDataWindow(mid)) + { + return GetFirstIndexForWhichDataIsPresent(aStartIndex, mid); + } + else + { + return GetFirstIndexForWhichDataIsPresent(mid, aEndIndex); + } + } + return -1; + } + +// --------------------------------------------------------------------------- +// ActivateAndComplete +// --------------------------------------------------------------------------- +// + void MulAsyncDataProvider::ActivateAndComplete() + { + TRequestStatus* lStatus = &iStatus; + iStatus = KRequestPending; + SetActive(); + User::RequestComplete(lStatus, KErrNone); + } + + } // End of namespace Alf . + + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulcachemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulcachemanager.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,435 @@ +/* +* Copyright (c) 2007-2008 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: Cache Manager class + * +*/ + + +#include "mulcachemanager.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "mulassert.h" +#include "mulmodeldef.h" +#include "mulmodelimpl.h" +#include "mul/mulmodelutility.h" +#include "mullog.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +MulCacheManager::MulCacheManager() + : mTotalCount(0) + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulCacheManager::~MulCacheManager() + { + MulVisualItemMap::iterator itr; + for( itr = mVisualItemMap.begin(); itr!= mVisualItemMap.end(); ++itr ) + { + delete itr->second; + itr->second = NULL; + } + mVisualItemMap.clear(); + } + +// --------------------------------------------------------------------------- +// CreateNodes +// --------------------------------------------------------------------------- +// +void MulCacheManager::CreateNodes(int aStartIndex, int aCount, const MulDataPath& /*aPath*/) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::CreateNodes()"); + + __MUL_ASSERT_DEBUG( aStartIndex >= 0 && aStartIndex <= ExpandedNodeCount() && aCount > 0 , KLInvalidArgument ); + + if(mTotalCount > 0 && aStartIndex < mTotalCount ) + { + UpdataPathInMapAfterInsert(mVisualItemMap, aStartIndex, aCount); + UpdataPathInMapAfterInsert(mSelectionMap, aStartIndex, aCount); + } + + mTotalCount += aCount; + } + +// --------------------------------------------------------------------------- +// AddVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::AddVisualItem( std::auto_ptr aVisualItem, + const MulDataPath& /*aPath*/ , int aIndex) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::AddVisualItem()"); + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + //adding item now + mVisualItemMap[aIndex] = aVisualItem.release(); + } + +// --------------------------------------------------------------------------- +// AddVisualItem +// --------------------------------------------------------------------------- +// +//void MulCacheManager::AddVisualItem( std::auto_ptr aVisualItem, int aItemIndex ) +// { +// MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::AddVisualItem()"); +// __MUL_ASSERT_DEBUG( aItemIndex >= 0 && aItemIndex < ExpandedNodeCount() , KLInvalidArgument ); +// +// MulDataPath path ;//= mTree.FindNode( aItemIndex ); +// AddVisualItem( aVisualItem, path, aItemIndex ); +// } + +// --------------------------------------------------------------------------- +// RemoveVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::RemoveVisualItem( int aIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::RemoveVisualItem()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + //MulDataPath path = mTree.FindNode( aIndex ); + MulDataPath path; + RemoveItemFromMap( path, aIndex ); + } + +// --------------------------------------------------------------------------- +// RemoveVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::RemoveVisualItem(const MulDataPath& aPath , int aIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::RemoveVisualItem()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + RemoveItemFromMap( aPath, aIndex ); + mSelectionMap.erase( aIndex ); //remove marking information for this path, index + + UpdataPathInMapAfterRemove( mVisualItemMap, aIndex,1 ); + UpdataPathInMapAfterRemove( mSelectionMap, aIndex,1 ); + mTotalCount--; + } + +// --------------------------------------------------------------------------- +// RemoveVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::RemoveVisualItem(int aIndex, int aCount, const MulDataPath& aPath) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::RemoveVisualItem()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex+aCount <= ExpandedNodeCount() , KLInvalidArgument ); + + for(int i = aIndex ; i < aIndex+aCount; i++ ) + { + RemoveItemFromMap( aPath, i ); + mSelectionMap.erase( i ); //remove marking information for this path, index + } + + if(aIndex + aCount < ExpandedNodeCount() ) + { + UpdataPathInMapAfterRemove( mVisualItemMap, aIndex, aCount); + UpdataPathInMapAfterRemove( mSelectionMap, aIndex, aCount ); + } + + mTotalCount-= aCount; + } + +// --------------------------------------------------------------------------- +// RemoveItemFromMap +// --------------------------------------------------------------------------- +// +void MulCacheManager::RemoveItemFromMap( const MulDataPath& /*aPath*/ , int aIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::RemoveItemFromMap()"); + + MulVisualItemMap::iterator findIter = mVisualItemMap.find(aIndex); + if( findIter!= mVisualItemMap.end() ) + { + delete findIter->second; + findIter->second = NULL; + mVisualItemMap.erase( aIndex ); + } + } + +// --------------------------------------------------------------------------- +// UpdataPathInMapAftreRemove +// --------------------------------------------------------------------------- +// +template void MulCacheManager::UpdataPathInMapAfterRemove( std::map& aMap, int aIndex, int aCount ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::UpdataPathInMapAfterRemove()"); + + //loop through all items + //for(int i = 0 ; i < ExpandedNodeCount() ; ++i ) + for(int i = aIndex ; i < ExpandedNodeCount() ; ++i ) + { + // if index is greater than path index then index need to be modified + //if( i >= aIndex ) + { + + if( aMap.find( i ) != aMap.end() ) + { + T item = aMap.find( i )->second; + aMap.erase( i ); + aMap[i-aCount] = item; //add item in to new index + } + } + } + + } + +// --------------------------------------------------------------------------- +// UpdataPathInMapAftreInsert +// --------------------------------------------------------------------------- +// +template void MulCacheManager::UpdataPathInMapAfterInsert( std::map& aMap, int aIndex, int aCount ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::UpdataPathInMapAfterInsert()"); + + //for( int i = ExpandedNodeCount() ; i > 0 ; --i ) + for( int i = ExpandedNodeCount() ; i >= aIndex ; --i ) + { + // if index is greater than path index then index need to be modified + //if( i >= aIndex ) + { + + if( aMap.find( i ) != aMap.end() ) + { + T item = aMap.find( i )->second; + aMap.erase( i ); + aMap[ i + aCount] = item; //add item in to new index + } + } + } + } + +// --------------------------------------------------------------------------- +// UpdateVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::UpdateVisualItem( MulVisualItem& aUpdatedVisualItem, int aItemIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::UpdateVisualItem()"); + + __MUL_ASSERT_DEBUG( aItemIndex >= 0 && aItemIndex < ExpandedNodeCount() , KLInvalidArgument ); + + MulDataPath path ; + UpdateVisualItem( aUpdatedVisualItem, path, aItemIndex ); + } + +// --------------------------------------------------------------------------- +// UpdateVisualItem +// --------------------------------------------------------------------------- +// +void MulCacheManager::UpdateVisualItem( MulVisualItem& aVisualItem,const MulDataPath& /*aPath*/, int aIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::UpdateVisualItem()"); + + MulVisualItem* visualItem = Data( aIndex ); + std::vector existingAttributes = aVisualItem.Attributes( ); + for( int i = 0 ; i < existingAttributes.size() ; ++i ) + { + mulvisualitem::TVisualAttribute attributeName = existingAttributes[i]; + IMulVariantType* newValue = aVisualItem.Attribute( attributeName ); + if(newValue) + { + std::auto_ptr cloneValue = newValue->Clone(); + int newflags = aVisualItem.Flag( attributeName ); + + visualItem->SetAttribute( attributeName , cloneValue.get(), newflags ); + cloneValue.release(); + } + } + visualItem->ResetDirtyAttribute(aVisualItem); + } + +// --------------------------------------------------------------------------- +// Data +// --------------------------------------------------------------------------- +// +MulVisualItem* MulCacheManager::Data(const MulDataPath& /*aPath*/, int aIndex ) const + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::Data()"); + + //__MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + MulVisualItemMap::const_iterator findIter = mVisualItemMap.find(aIndex); + if( findIter != mVisualItemMap.end() ) + { + return findIter->second; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// Data +// --------------------------------------------------------------------------- +// +MulVisualItem* MulCacheManager::Data( int aIndex ) const + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::Data()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + MulDataPath path ; + return Data( path, aIndex ); + } + +// --------------------------------------------------------------------------- +// Count +// --------------------------------------------------------------------------- +// +int MulCacheManager::Count() const + { + return mVisualItemMap.size(); + } + +// --------------------------------------------------------------------------- +// ExpandedNodeCount +// --------------------------------------------------------------------------- +// +int MulCacheManager::ExpandedNodeCount( ) const + { + //return mTree.ExpandedNodeCount(); + return mTotalCount; + } + +// --------------------------------------------------------------------------- +// SetMarkedIndices +// --------------------------------------------------------------------------- +// +void MulCacheManager::SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType , + const std::vector& aItemsIndex, + const MulDataPath& /*aPath*/) + + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::SetMarkedIndices()"); + + bool selection( false ); + // If selection type is not mark or unmark throw invalid argument exception + aType == MulWidgetDef::EMulMark || aType == MulWidgetDef::EMulUnmark ? + selection = ( aType == MulWidgetDef::EMulMark ) : + throw std::invalid_argument( KInvalidArgument ); + + // Add selected indices to vector and remove unselected + for(int i = 0 ; i < aItemsIndex.size() ; i++ ) + { + int index = aItemsIndex[i]; + selection ? mSelectionMap[index] = index : mSelectionMap.erase(index); + } + } + +// --------------------------------------------------------------------------- +// SetMarkedIndices +// --------------------------------------------------------------------------- +// +void MulCacheManager::SetMarkedIndices(MulWidgetDef::TMulWidgetMarkingType aType) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::SetMarkedIndices()"); + + bool selection(false); + // If selection type is not mark all or unmark all throw invalid argument exception + aType == MulWidgetDef::EMulMarkAll || aType == MulWidgetDef::EMulUnmarkAll ? + selection = ( aType == MulWidgetDef::EMulMarkAll ) : + throw std::invalid_argument( KInvalidArgument ); + + int count = ExpandedNodeCount(); + for(int i = 0 ; i < count ; ++i ) + { + selection ? mSelectionMap[i] = i : mSelectionMap.erase(i); + } + } + +// --------------------------------------------------------------------------- +// MarkedIndices +// --------------------------------------------------------------------------- +// +const std::vector& MulCacheManager::MarkedIndices( const MulDataPath& /*aPath*/ ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::MarkedIndices()"); + + mSelectionVector.clear(); + + int count = ExpandedNodeCount(); + for( int i=0; i < count ;++i ) + { + MulSelectionMap::const_iterator itr = mSelectionMap.find(i); + if( itr != mSelectionMap.end() ) + { + mSelectionVector.insert(i); + } + } + return mSelectionVector.actualVector(); + } + +// --------------------------------------------------------------------------- +// IsItemMarked +// --------------------------------------------------------------------------- +// +bool MulCacheManager::IsItemMarked( int aIndex ) const + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::IsItemMarked()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + MulSelectionMap::const_iterator itr = mSelectionMap.find( aIndex ); + return ( itr != mSelectionMap.end() ); + } + +// --------------------------------------------------------------------------- +// SetMarkedIndex +// --------------------------------------------------------------------------- +// +void MulCacheManager::SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulCacheManager::SetMarkedIndex()"); + + __MUL_ASSERT_DEBUG( aIndex >= 0 && aIndex < ExpandedNodeCount() , KLInvalidArgument ); + + bool selection( false ); + // If selection type is not mark or unmark throw invalid argument exception + aType == MulWidgetDef::EMulMark || aType == MulWidgetDef::EMulUnmark ? + selection = ( aType == MulWidgetDef::EMulMark ) : + throw std::invalid_argument( KInvalidArgument ); + + selection ? mSelectionMap[aIndex] = aIndex : mSelectionMap.erase(aIndex); + } + +} //end of namespace alf + +//end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/muldatapath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/muldatapath.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2007-2008 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: Header for MulDataPath +* +*/ + + +#include + +#include +#include +#include +#include //for equal algorithm + +namespace Alf + { + +class MulDataPathImpl + { + +public: + + MulDataPathImpl():mIndex(-1) + { + } + + ~MulDataPathImpl() + { + mPath.clear(); + } + +public: + std::vector mPath; //store index of node for each depth + int mIndex; + }; + +// --------------------------------------------------------------------------- +// MulDataPath +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulDataPath::MulDataPath() + { + } + +// --------------------------------------------------------------------------- +// MulDataPath +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulDataPath::MulDataPath( int aIndexForDepth1 ) + { + Append( aIndexForDepth1 ); + } + +// --------------------------------------------------------------------------- +// MulDataPath +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulDataPath::MulDataPath( int aIndexForDepth1, int aIndexForDepth2) + { + Append( aIndexForDepth1 ); + Append( aIndexForDepth2 ); + } + +// --------------------------------------------------------------------------- +// MulDataPath +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulDataPath::MulDataPath( const MulDataPath& aPath ) + { + if(aPath.mData.get()) + { + SetIndex( aPath.Index() ); + for( int i = 0 ; i < aPath.Depth() ; ++i ) + { + Append( aPath[i] ); + } + } + } + +// --------------------------------------------------------------------------- +// ~MulDataPath +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulDataPath::~MulDataPath() + { + if( mData.get() ) + { + mData->mPath.clear(); + } + } + +// --------------------------------------------------------------------------- +// Append +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulDataPath::Append(int aIndex) + { + if( !mData.get() ) + { + mData.reset( new (EMM) MulDataPathImpl() ); + } + mData->mPath.push_back(aIndex); + } + +// --------------------------------------------------------------------------- +// Depth +// --------------------------------------------------------------------------- +// +OSN_EXPORT int MulDataPath::Depth() const + { + if( mData.get() ) + { + return mData->mPath.size(); + } + else + { + return -1; + } + } + +// --------------------------------------------------------------------------- +// operator[] +// --------------------------------------------------------------------------- +// +OSN_EXPORT int MulDataPath::operator[]( int aDepth ) const + { + if( mData.get() ) + { + return (mData->mPath)[aDepth]; + } + else + { + return -1; + } + } + +// --------------------------------------------------------------------------- +// operator[] +// --------------------------------------------------------------------------- +// +bool MulDataPath::operator< ( MulDataPath& aPath) + { + bool result(false); + + //i dont wanted to add Index to original path because it is not part of path + //but index is quite necessary for comparition so creating temp vector + //and copying path to temp vector and also appending index to path + std::vector v1 = mData->mPath; + v1.push_back(Index()); + + std::vector v2 = aPath.mData->mPath; + v2.push_back(aPath.Index()); + + result = lexicographical_compare(v1.begin(),v1.end(),v2.begin(),v2.end()); + + return result; + } + +// --------------------------------------------------------------------------- +// Index +// --------------------------------------------------------------------------- +// +int MulDataPath::Index() const + { + if(mData.get()) + { + return mData->mIndex; + } + return -1; + } + +// --------------------------------------------------------------------------- +// SetIndex +// --------------------------------------------------------------------------- +// +void MulDataPath::SetIndex(int aIndex) + { + if( !mData.get() ) + { + mData.reset( new (EMM) MulDataPathImpl() ); + } + mData->mIndex = aIndex; + } + +// --------------------------------------------------------------------------- +// IsEqual +// --------------------------------------------------------------------------- +// +bool MulDataPath::IsEqual( const MulDataPath& aPath ) + { + if( (*this) == aPath ) + { + if( Depth() == -1 && aPath.Depth() == -1 ) + { + return true; + } + else + { + return Index() == aPath.Index(); + } + } + else + { + return false; + } + } + +// --------------------------------------------------------------------------- +// Operator == +// --------------------------------------------------------------------------- +// +bool MulDataPath::operator == ( const MulDataPath& aPath) + { + #ifdef _DEBUG + int depth1 = Depth(); + int depth2 = aPath.Depth(); + #endif + + //if depth is -1 , it mean that it points to root node + if( Depth() == -1 && aPath.Depth() == -1 ) + { + return true; + } + else if((Depth() == -1 && aPath.Depth() == 0 ) || (Depth() == 0 && aPath.Depth() == -1 )) + { + return true; + } + else if( Depth() != aPath.Depth() ) + { + return false; + } + else + { + return equal( mData->mPath.begin(), mData->mPath.end(), aPath.mData->mPath.begin()); + } + } + +// --------------------------------------------------------------------------- +// Operator = +// --------------------------------------------------------------------------- +// +void MulDataPath::operator= ( MulDataPath aPath ) + { + if( aPath.mData.get() ) + { + if( mData.get() ) + { + mData->mPath.clear(); + } + + SetIndex( aPath.Index() ); + for( int i = 0 ; i < aPath.Depth() ; ++i ) + { + Append( aPath[i] ); + } + } + } + + } //namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/muldatawindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/muldatawindow.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,498 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of Data window +* +*/ + + +//Includes +#include "muldatawindow.h" + +#include +#include + +//Internal includes +#include "mulassert.h" +#include "mulmodelimpl.h" +#include "mullog.h" + +using namespace std; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulDataWindow +// --------------------------------------------------------------------------- +// +MulDataWindow::MulDataWindow( MulModelImpl& aMulModel ) + :mMulModel( aMulModel ), + mHighlight(KNotInitialized), + mItemIndex(KNotInitialized), + mOldItemIndex(KNotInitialized), + mBufferSize(KNotInitialized), + mWindowSize(KNotInitialized), + mWindowOffset(KNotInitialized), + mWindowTop(0), + mWindowBottom(0), + mBufferTop(0), + mBufferBottom(0), + mOldBufferTop(KNotInitialized), + mOldBufferBottom(KNotInitialized), + mRearBufferTop(0), + mRearBufferBottom(0), + mOldRearBufferTop(KNotInitialized), + mOldRearBufferBottom(KNotInitialized) + { + } + +// --------------------------------------------------------------------------- +// SetWindowSize +// --------------------------------------------------------------------------- +// +void MulDataWindow::SetWindowSize( int aWindowSize ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::SetWindowSize()"); + + __MUL_ASSERT( aWindowSize > 0, KLInvalidArgument ); + + if( mWindowSize != aWindowSize ) + { + if( KNotInitialized == mBufferSize ) + { + mBufferSize = aWindowSize; + } + + mWindowSize = aWindowSize; + //devide window half + //Try to keep this much item above highlight and below highlight + mWindowOffset = mWindowSize / 2; + + //adjusting window offset + //if window size changes then the top and bottom offset should be + // adjusted such that highlight remains at the centre + //window top and bottom are inclusive + + mWindowTop = mItemIndex - mWindowOffset; + mWindowTop = mWindowTop < 0 ? 0 : mWindowTop ; + mWindowBottom = mWindowTop + mWindowSize - 1; + mWindowBottom = mWindowBottom >= mMulModel.CurrentItemCount() ? (mMulModel.CurrentItemCount() -1) : mWindowBottom; + + MUL_LOG_INFO2("MUL::MulDataWindow::SetWindowSize() mWindowTop:%d,mWindowBottom:%d",mWindowTop,mWindowBottom); + + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// SetBufferSize +// --------------------------------------------------------------------------- +// +void MulDataWindow::SetBufferSize( int aBufferSize ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::SetBufferSize()"); + + __MUL_ASSERT( aBufferSize > 0, KLInvalidArgument ); + + if( mBufferSize != aBufferSize ) + { + mBufferSize = aBufferSize; + + if(mMulModel.CurrentItemCount() > 0) + { + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// ~MulDataWindow +// --------------------------------------------------------------------------- +// +MulDataWindow::~MulDataWindow() + { + // do nothing + } + +// --------------------------------------------------------------------------- +// SetHighlight +// --------------------------------------------------------------------------- +// +void MulDataWindow::SetHighlight( int aHighlightIndex ) + { + MUL_LOG_INFO2("MUL::MulDataWindow::SetHighlight() mHighlight:%d,modelCount:%d",aHighlightIndex,mMulModel.CurrentItemCount()); + + __MUL_ASSERT( aHighlightIndex >= 0 && aHighlightIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if( mHighlight != aHighlightIndex ) + { + mHighlight = aHighlightIndex; + + ScrollWindow( mHighlight ); + } + //else same highlight + } + + +// --------------------------------------------------------------------------- +// UpdateHighlight +// --------------------------------------------------------------------------- +// +void MulDataWindow::UpdateHighlight( int aHighlightIndex ) + { + // No need to assert. We should send highlight -1 when all the items are removed. + // Widget should handle. to show emty text visualization + mHighlight = aHighlightIndex; + } + +// --------------------------------------------------------------------------- +// ScrollWindow +// --------------------------------------------------------------------------- +// +void MulDataWindow::ScrollWindow( int aItemIndex ) + { + MUL_LOG_INFO2("MUL::MulDataWindow::ScrollWindow() aItemIndex:%d,modelCount:%d",aItemIndex,mMulModel.CurrentItemCount()); + + __MUL_ASSERT( aItemIndex >= 0 && aItemIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if( mItemIndex != aItemIndex ) + { + mOldItemIndex = mItemIndex; + mItemIndex = aItemIndex; + + if(IsWindowEnabled()) + { + UpdateDataWindow(); + } + } + //else same highlight + } + + +// --------------------------------------------------------------------------- +// UpdateDataWindow +// --------------------------------------------------------------------------- +// +void MulDataWindow::UpdateDataWindow() + { +#ifdef _DEBUG + int diff = mItemIndex - mOldItemIndex; +#endif //_DEBUG + + //If diffrence is negative than highlight is moved up else down + (( mItemIndex - mOldItemIndex ) < 0 ) ? ShiftWindowUp() : ShiftWindowDown() ; + } + +// --------------------------------------------------------------------------- +// ShiftWindowDown +// --------------------------------------------------------------------------- +// +void MulDataWindow::ShiftWindowDown() + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::ShiftWindowDown()"); + MUL_LOG_INFO2("MUL::MulDataWindow::ShiftWindowDown() mItemIndex:%d,mWindowBottom:%d",mItemIndex,mWindowBottom); + + if( mItemIndex > mWindowBottom ) + { + mWindowTop = mItemIndex - mWindowOffset; + mWindowBottom = mWindowTop + mWindowSize -1; + //bottom is exceeding model count + mWindowBottom = mWindowBottom >= mMulModel.CurrentItemCount() ? + mWindowBottom = mMulModel.CurrentItemCount() - 1 : mWindowBottom; + + mWindowTop = mWindowBottom - mWindowSize + 1; + //top can't be negative + mWindowTop = mWindowTop < 0 ? 0 : mWindowTop ; + + MUL_LOG_INFO2("MUL::MulDataWindow::ShiftWindowDown() mWindowTop:%d,mWindowBottom:%d",mWindowTop,mWindowBottom); + SaveOldValues(); + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// ShiftWindowUp +// --------------------------------------------------------------------------- +// +void MulDataWindow::ShiftWindowUp() + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::ShiftWindowUp() Start"); + MUL_LOG_INFO2("MUL::MulDataWindow::ShiftWindowUp() mItemIndex:%d,mWindowBottom:%d",mItemIndex,mWindowBottom); + + if( mItemIndex < mWindowTop ) + { + mWindowTop = mItemIndex - mWindowOffset; + //top can't be negative + mWindowTop = mWindowTop < 0 ? 0 : mWindowTop ; + + mWindowBottom = mWindowTop + mWindowSize -1; + + //bottom cant exceed model count + mWindowBottom = mWindowBottom >= mMulModel.CurrentItemCount() ? + mWindowBottom = mMulModel.CurrentItemCount() - 1 : mWindowBottom; + + MUL_LOG_INFO2("MUL::MulDataWindow::ShiftWindowUp() mWindowTop:%d,mWindowBottom:%d",mWindowTop,mWindowBottom); + + SaveOldValues(); + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// AdjustBuffer +// --------------------------------------------------------------------------- +// +void MulDataWindow::AdjustBuffer() + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::AdjustBuffer()"); + + int modelCount = mMulModel.CurrentItemCount() -1; + + //remove data is new window is smaller/add is new window is bigger + if( mWindowTop == 0 && ActualBufferSize() <= modelCount ) + { + MUL_LOG_INFO("MUL::MulDataWindow::AdjustBuffer() mWindowTop == 0 "); + + mBufferTop = mWindowTop; + mBufferBottom = mBufferTop + mWindowSize + mBufferSize - 1; + + //Create rear top and rear bottom only in looping case + //window top is zero so data at other end should be buffered + mRearBufferBottom = modelCount; + mRearBufferTop = mRearBufferBottom - mBufferSize +1; + } + else if( mWindowBottom == modelCount && ActualBufferSize() <= modelCount ) + { + MUL_LOG_INFO("MUL::MulDataWindow::AdjustBuffer() mWindowBottom == modelCount "); + + mBufferBottom = mWindowBottom ; + mBufferTop = mBufferBottom - (mWindowSize + mBufferSize) + 1; + + //Create rear top and rear bottom only in looping case + //window bottom is equal to model count so data at other end should be buffered + mRearBufferTop = 0; + mRearBufferBottom = mRearBufferTop + mBufferSize -1; + } + else + { + MUL_LOG_INFO("MUL::MulDataWindow::AdjustBuffer() else "); + + mBufferTop = mWindowTop - mBufferSize; + mBufferBottom = mWindowBottom + mBufferSize; + + //check if top or bottom is out of bound and update offset accordingly + if( mBufferTop < 0 ) + { + MUL_LOG_INFO("MUL::MulDataWindow::AdjustBuffer() mBufferTop < 0 "); + + mBufferTop = 0; + mBufferBottom = mBufferTop + ActualBufferSize() - 1; + //buffer bottom cant be larger then model count + mBufferBottom = mBufferBottom > modelCount ? modelCount : mBufferBottom; + } + else if( mBufferBottom > modelCount ) + { + MUL_LOG_INFO("MUL::MulDataWindow::AdjustBuffer() mBufferBottom > modelCount"); + + mBufferBottom = modelCount ; + mBufferTop = mBufferBottom - ActualBufferSize() + 1; + //buffer top cant be less then 0 + mBufferTop = mBufferTop < 0 ? 0 : mBufferTop; + } + + //in other case rear top and rear bottom is not use set to -1 + mRearBufferTop = KNotInitialized; + mRearBufferBottom = KNotInitialized; + } + + MUL_LOG_INFO2("MUL::MulDataWindow::AdjustBuffer() mOldBufferTop:%d,mOldBufferBottom:%d",mOldBufferTop,mOldBufferBottom); + MUL_LOG_INFO2("MUL::MulDataWindow::AdjustBuffer() mOldRearBufferBottom:%d,mOldRearBufferTop:%d",mOldRearBufferBottom,mOldRearBufferTop); + + MUL_LOG_INFO2("MUL::MulDataWindow::AdjustBuffer() mBufferTop:%d,mBufferBottom:%d",mBufferTop,mBufferBottom); + MUL_LOG_INFO2("MUL::MulDataWindow::AdjustBuffer() mRearBufferBottom:%d,mRearBufferTop:%d",mRearBufferBottom,mRearBufferTop); + + __MUL_ASSERT_DEBUG( mWindowTop >= 0 && mWindowBottom < mMulModel.CurrentItemCount(), _L("Invlid Window")); + __MUL_ASSERT_DEBUG( mBufferTop >= 0 && mBufferBottom < mMulModel.CurrentItemCount(), _L("Invlid Buffer")); + } + +// --------------------------------------------------------------------------- +// IsItemInDataWindow +// --------------------------------------------------------------------------- +// +bool MulDataWindow::IsItemInDataWindow(int aItemIndex ) const + { + //__MUL_ASSERT_DEBUG( aItemIndex >= 0 && aItemIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + bool result( false ); + + if(mWindowSize == KNotInitialized ) + { + result = false; + } + //check that rear buffer is on or not in looping case + else if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( ( aItemIndex >= mBufferTop && aItemIndex <= mBufferBottom ) || + ( aItemIndex >= mRearBufferTop && aItemIndex <= mRearBufferBottom ) ) + { + result = true; + } + } + else if( aItemIndex >= mBufferTop && aItemIndex <= mBufferBottom ) + { + result = true; + } + return result; + } + + +// --------------------------------------------------------------------------- +// RelativeIndex +// --------------------------------------------------------------------------- +// +int MulDataWindow::RelativeIndex( int aAbsoluteIndex ) const + { + __MUL_ASSERT_DEBUG( aAbsoluteIndex >= 0 && aAbsoluteIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if( !IsItemInDataWindow(aAbsoluteIndex) ) + { + return -1; + } + + if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( mRearBufferBottom == mMulModel.CurrentItemCount() - 1 ) + { + if( aAbsoluteIndex >= mRearBufferTop && aAbsoluteIndex <= mRearBufferBottom ) + { + int bufferSize = BottomOffset() - TopOffset() + 1; + int rearDiff = aAbsoluteIndex - mRearBufferTop; + int relativeIndex = bufferSize + rearDiff; + return relativeIndex; + } + else + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + } + else + { + if( aAbsoluteIndex >= mRearBufferTop && aAbsoluteIndex <= mRearBufferBottom ) + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + else + { + int bufferSize = mRearBufferBottom - mRearBufferTop + 1; + int diff = aAbsoluteIndex - TopOffset(); + int relativeIndex = bufferSize + diff; + return relativeIndex; + } + } + } + else + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + } + +// --------------------------------------------------------------------------- +// AbsoluteIndex +// --------------------------------------------------------------------------- +// +int MulDataWindow::AbsoluteIndex( int aRelativeIndex ) const + { + __MUL_ASSERT_DEBUG( aRelativeIndex >= 0 && aRelativeIndex <= ActualBufferSize(), _L("Invalid Relative Index")); + + if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( mRearBufferBottom == mMulModel.CurrentItemCount() - 1 ) + { + if( aRelativeIndex > BottomOffset() ) + { + //relative index is in loop buffer + int diff = aRelativeIndex - BottomOffset() - 1; + int absoluteIndex = RearTopOffset() + diff; + return absoluteIndex; + } + else + { + int absoluteIndex = TopOffset() + aRelativeIndex; + return absoluteIndex; + } + } + else + { + if( aRelativeIndex <= RearBottomOffset() ) + { + //relative index is in loop buffer + int absoluteIndex = RearTopOffset() + aRelativeIndex; + return absoluteIndex; + } + else + { + int diff = aRelativeIndex - RearBottomOffset() - 1; + int absoluteIndex = TopOffset() + diff; + return absoluteIndex; + } + } + } + else + { + int absoluteIndex = TopOffset() + aRelativeIndex; + return absoluteIndex; + } + } + +// --------------------------------------------------------------------------- +// SetVisibleWindow +// --------------------------------------------------------------------------- +// +void MulDataWindow::SetVisibleWindow(int aWindowTop, int aWindowBottom) + { + mWindowTop = aWindowTop; + mWindowBottom = aWindowBottom; + } + +// --------------------------------------------------------------------------- +// IsBufferOffsetChanged +// --------------------------------------------------------------------------- +// +bool MulDataWindow::IsBufferOffsetChanged() + { + if(mRearBufferBottom != mOldRearBufferBottom || mRearBufferTop != mOldRearBufferTop + || mBufferTop != mOldBufferTop || mBufferBottom != mOldBufferBottom) + { + return true; + } + return false; + } + + } // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulmodelfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulmodelfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 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 model. +* +*/ + +#include "mulmodelfactoryplugin.h" + +#include +#include "alf/alfwidget.h" +#include +#include + +#include + +#include "mulmodelimpl.h" + +using namespace osncore; + +namespace Alf + { + +const TInt KMulModelFactoryPluginUid = {0x2000D23F}; +const int KProductCount = 1; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased Symbian constructor. +// --------------------------------------------------------------------------- +// +MulFactoryPlugin* MulFactoryPlugin::NewL() + { + return new (ELeave) MulFactoryPlugin; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +MulFactoryPlugin::~MulFactoryPlugin() + { + } + +// --------------------------------------------------------------------------- +// Creates either a list widget or a list model. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulFactoryPlugin::createProduct(const char* aProduct, + void* /*aInitData*/ ) + { + IAlfInterfaceBase* ret(0); + const char* KLoadNameModel("mulmodel"); + //if( !strcmp( aProduct, IMulModel::Type().iImplementationId ) ) + if( !strcmp( aProduct, KLoadNameModel ) ) + { + // create list model + IMulModel* model = new (EMM) MulModelImpl(); + ret = IAlfInterfaceBase::makeInterface( model ); + } + return ret; + } + +// --------------------------------------------------------------------------- +// From MAlfInterfaceBase. +// Creates interface based on the given type. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulFactoryPlugin::makeInterface(const IfId& aType) + { + UString param( aType.mImplementationId ); + + if( param == UString( IAlfFactoryPlugin::type().mImplementationId ) ) + { + return static_cast( this ); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// Returns the amount of products this factory can produce. +// --------------------------------------------------------------------------- +// +int MulFactoryPlugin::productCount()const + { + return KProductCount; + } + +// --------------------------------------------------------------------------- +// Returns product information. +// --------------------------------------------------------------------------- +// +const char* MulFactoryPlugin::productInfo(int aIndex)const + { + switch( aIndex ) + { + case 0: return mulmodel::Ident.mImplementationId; + default: break; + } + return 0; + } + + } // namespace Alf + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +using namespace Alf; +const TImplementationProxy ImplementationTable[] = + { +#ifdef __EABI__ + IMPLEMENTATION_PROXY_ENTRY( KMulModelFactoryPluginUid, + MulFactoryPlugin::NewL ) + #else + { {KMulModelFactoryPluginUid}, MulFactoryPlugin::NewL } +#endif + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + + return ImplementationTable; + } + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulmodelimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulmodelimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,648 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of model interface +* +*/ + + +//Includes +// class headers +#include "mulmodelimpl.h" + +#include + +// Local Headers +#include "mulcachemanager.h" +#include "muldatawindow.h" +#include "mulpagedatawindow.h" +#include "mulpushmode.h" +#include "mulpullmode.h" +#include "mulassert.h" +#include "mulmodeldef.h" +#include "mullog.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulModelImpl() +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulModelImpl::MulModelImpl() + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::MulModelImpl()"); + + //mDataWindow.reset( new ( EMM ) MulDataWindow( *this )); + mDataWindow.reset( new ( EMM ) MulPageDataWindow( *this )); + mModelHelper.reset(new (EMM) MulPushMode(*mDataWindow )); + } + +// --------------------------------------------------------------------------- +// ~MulModelImpl() +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulModelImpl::~MulModelImpl() + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::~MulModelImpl()"); + mObserverArray.clear(); + } + +// ------------------------ From IMulModel ----------------------------------- + +// --------------------------------------------------------------------------- +// Insert +// --------------------------------------------------------------------------- +// +void MulModelImpl::Insert(int aIndex, int aCount,const MulDataPath& aPath) + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::Insert()"); + MUL_LOG_INFO2("MUL::MulModelImpl::Insert() index:%d,count:%d",aIndex,aCount); + + mModelHelper->Insert(aIndex, aCount,aPath); + + if( aCount > 0 && mDataWindow->Highlight() == KNotInitialized ) + { + mDataWindow->UpdateHighlight(0); + NotifyDataChange( IMulModelObserver::EHighlightChanged , 0 ); + } + + NotifyDataChange( IMulModelObserver::EItemsInserted, aIndex, aCount ); + } + +// --------------------------------------------------------------------------- +// Remove +// --------------------------------------------------------------------------- +// +void MulModelImpl::Remove(int aIndex, int aCount, const MulDataPath& aPath) + { + // If the highlight has changed because of the remove then inform the widget + if( mModelHelper->Remove(aIndex, aCount, aPath) ) + { + NotifyDataChange( IMulModelObserver::EHighlightChanged , mDataWindow->Highlight() ); + } + NotifyDataChange( IMulModelObserver::EItemsRemoved, aIndex, aCount ); + } + +// --------------------------------------------------------------------------- +// Update +// --------------------------------------------------------------------------- +// +void MulModelImpl::Update( int aIndex, int aCount, const MulDataPath& aPath ) + { + mModelHelper->Update( aIndex, aCount, aPath ); + } + +// --------------------------------------------------------------------------- +// Refresh +// --------------------------------------------------------------------------- +// +void MulModelImpl::Refresh( int aCount, const MulDataPath& aPath ) + { + mModelHelper->Refresh( aCount, aPath ); + NotifyDataChange( IMulModelObserver::EModelRefreshed , aCount ); + } + +// --------------------------------------------------------------------------- +// SetData +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetData( int aIndex, auto_ptr aVisualItem, const MulDataPath& aPath ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::SetData()"); + MUL_LOG_INFO1("MUL::MulModelImpl::SetData() index:%d",aIndex ); + + mModelHelper->SetData( aIndex, aVisualItem, aPath ); + NotifyDataChange( IMulModelObserver::EItemUpdated , aIndex ); + } + +// --------------------------------------------------------------------------- +// Data +// --------------------------------------------------------------------------- +// +const MulVisualItem* MulModelImpl::Data( int aIndex, const MulDataPath& aPath) const + { + return mModelHelper->Data( aIndex, aPath ); + } + +// --------------------------------------------------------------------------- +// Count +// --------------------------------------------------------------------------- +// +int MulModelImpl::Count( const MulDataPath& aPath) const + { + return mModelHelper->Count( aPath ); + } + +// --------------------------------------------------------------------------- +// SetDataProvider +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetDataProvider( const IMulModelProvider& aDataProvider ) + { + mModelHelper.reset(new (EMM) MulPullMode( *mDataWindow, aDataProvider ) ); + } + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetTemplate( mulwidget::TLogicalTemplate aTemplateId ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::SetTemplate"); + mModelHelper->SetTemplate( aTemplateId ); + // default template updated + NotifyTemplateChange( -1, aTemplateId ); + } + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetTemplate(int aItemIndex, mulwidget::TLogicalTemplate aTemplateId, const MulDataPath& aPath ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulModelImpl::SetTemplate"); + mModelHelper->SetTemplate(aItemIndex, aTemplateId, aPath ); + NotifyTemplateChange( aItemIndex, aTemplateId ); + } + +// --------------------------------------------------------------------------- +// SetDataWindow +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetDataWindow( int aBufferSize ) + { + mDataWindow->SetBufferSize( aBufferSize ); + } + +// --------------------------------------------------------------------------- +// DataWindow +// --------------------------------------------------------------------------- +// +int MulModelImpl::DataWindow() const + { + return mDataWindow->BufferSize(); + } + +// --------------------------------------------------------------------------- +// SetHighlight +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetHighlight( int aItemIndex, const MulDataPath& /*aPath*/ ) + { + mDataWindow->SetHighlight( aItemIndex ); + + NotifyDataChange( IMulModelObserver::EHighlightChanged , aItemIndex ); + } + +// --------------------------------------------------------------------------- +// Highlight +// --------------------------------------------------------------------------- +// +int MulModelImpl::Highlight( MulDataPath& /*aPath*/ ) + { + return mDataWindow->Highlight(); + } + +// --------------------------------------------------------------------------- +// Highlight +// --------------------------------------------------------------------------- +// +int MulModelImpl::Highlight() + { + return mDataWindow->Highlight(); + } + +// --------------------------------------------------------------------------- +// SetMarkedIndices +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetMarkedIndices( MulWidgetDef::TMulWidgetMarkingType aType, + const std::vector& aItemsIndex, + const MulDataPath& aPath ) + + { + //fire update event in alf model + mModelHelper->CacheManager().SetMarkedIndices( aType, aItemsIndex, aPath ); + + for( int i = 0 ; i < aItemsIndex.size() ; i++ ) + { + if(mDataWindow->IsItemInDataWindow(aItemsIndex[i])) + { + CreateMarkingEvent(aItemsIndex[i]); + } + } + } + +// --------------------------------------------------------------------------- +// SetMarkedIndices +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetMarkedIndices(MulWidgetDef::TMulWidgetMarkingType aType) + { + //fire update event in alf model + mModelHelper->CacheManager().SetMarkedIndices( aType ); + + for( int i = mDataWindow->TopOffset() ; i <= mDataWindow->BottomOffset() ; i++ ) + { + CreateMarkingEvent(i); + } + + for( int i = mDataWindow->RearTopOffset( ); i <= mDataWindow->RearBottomOffset() && i > 0 ; i++ ) + { + CreateMarkingEvent(i); + } + } + +// --------------------------------------------------------------------------- +// CreateMarkingEvent +// --------------------------------------------------------------------------- +// +void MulModelImpl::CreateMarkingEvent(int aAbsoluteIndex) + { + NotifyDataChange( IMulModelObserver::EMarkingChanged , aAbsoluteIndex ); + } + +// --------------------------------------------------------------------------- +// NotifyStateChange +// --------------------------------------------------------------------------- +// +void MulModelImpl::NotifyStateChange( IMulModelObserver::TMulChangedState aState, + std::auto_ptr aData) + { + for( int i = 0; i < mObserverArray.size(); ++i ) + { + mObserverArray[i]->ModelStateChanged( aState, *aData ); + } + } + +// --------------------------------------------------------------------------- +// NotifyDataChange +// --------------------------------------------------------------------------- +// +void MulModelImpl::NotifyDataChange( IMulModelObserver::TMulChangedState aState, + int aStartIndex, int aCount ) + { + std::auto_ptr map( new ( EMM )AlfMap() ); + map->addItem( new (EMM) AlfVariantType(aStartIndex),UString(KStartIndex)); + map->addItem( new (EMM) AlfVariantType(aCount),UString(KCount)); + + std::auto_ptr data(new (EMM)MulVariantType(*map)); + NotifyStateChange( aState , data ); + } + +// --------------------------------------------------------------------------- +// NotifyDataChange +// --------------------------------------------------------------------------- +// +void MulModelImpl::NotifyDataChange( IMulModelObserver::TMulChangedState aState, int aIndex ) + { + std::auto_ptr data(new (EMM)MulVariantType(aIndex)); + NotifyStateChange( aState , data ); + } + +// --------------------------------------------------------------------------- +// NotifyTemplateChange +// --------------------------------------------------------------------------- +// +void MulModelImpl::NotifyTemplateChange( int aIndex, mulwidget::TLogicalTemplate aTamplateId ) + { + std::auto_ptr map( new ( EMM )AlfMap() ); + map->addItem(new (EMM) AlfVariantType(aTamplateId),osncore::UString(KDefaultTemplate)); + map->addItem(new (EMM) AlfVariantType(aIndex),osncore::UString(KIndex)); + + std::auto_ptr data(new (EMM)MulVariantType(*map)); + NotifyStateChange( IMulModelObserver::ETemplateChanged , data ); + } + +// --------------------------------------------------------------------------- +// MarkedIndices +// --------------------------------------------------------------------------- +// +const std::vector& MulModelImpl::MarkedIndices(const MulDataPath& aPath ) + { + return mModelHelper->CacheManager().MarkedIndices( aPath ); + } + +// --------------------------------------------------------------------------- +// IsLoopingOn +// --------------------------------------------------------------------------- +// +bool MulModelImpl::IsLoopingOn() + { + return ( mDataWindow->RearBottomOffset() != -1 && mDataWindow->OldRearBottomOffset() != -1 ); + } + +// --------------------------------------------------------------------------- +// AddModelObserver +// --------------------------------------------------------------------------- +// +void MulModelImpl::AddModelObserver( IMulModelObserver* aObserver ) + { + __MUL_ASSERT(aObserver, KLInvalidArgument ); + if( std::find(mObserverArray.begin(), mObserverArray.end(), aObserver) == mObserverArray.end() ) + { + mObserverArray.push_back( aObserver ); + } + } + +// --------------------------------------------------------------------------- +// RemoveModelObserver +// --------------------------------------------------------------------------- +// +void MulModelImpl::RemoveModelObserver( IMulModelObserver* aObserver ) + { + __MUL_ASSERT(aObserver, KLInvalidArgument ); + if( std::find(mObserverArray.begin(), mObserverArray.end(), aObserver ) != mObserverArray.end() ) + { + mObserverArray.erase( std::find( mObserverArray.begin(), mObserverArray.end(), aObserver )); + } + } + +// --------------------------------------------------------------------------- +// RemoveModelObserver +// --------------------------------------------------------------------------- +// +mulwidget::TLogicalTemplate MulModelImpl::Template() + { + return mModelHelper->Template(); + } + +// --------------------------------------------------------------------------- +// Accessor +// --------------------------------------------------------------------------- +// +IMulModelAccessor* MulModelImpl::Accessor() + { + return this; + } + +// ------------------------ From IMulModelAccessor --------------------------- + +// --------------------------------------------------------------------------- +// SetHighlight +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetHighlight( int aItemIndex ) + { + mDataWindow->SetHighlight( aItemIndex ); + } + +// --------------------------------------------------------------------------- +// ScrollWindow +// --------------------------------------------------------------------------- +// +void MulModelImpl::ScrollWindow( int aItemIndex ) + { + mDataWindow->ScrollWindow( aItemIndex ); + } + +// --------------------------------------------------------------------------- +// CurrentItemCount +// --------------------------------------------------------------------------- +// +int MulModelImpl::CurrentItemCount() + { + return mModelHelper->CurrentItemCount(); + } + +// --------------------------------------------------------------------------- +// SetDataWindow +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetVisibleWindow( int aWindowSize, int aPageTopIndex ) + { + mDataWindow->SetWindowSize( aWindowSize, aPageTopIndex ); + } +// ------------------------ Member Function ---------------------------------- + +// --------------------------------------------------------------------------- +// DataWindowUpdated +// --------------------------------------------------------------------------- +// +void MulModelImpl::DataWindowUpdated() + { + mModelHelper->DataWindowUpdated(); + std::auto_ptr dummyData; + NotifyStateChange( IMulModelObserver::EDataWindowUpdated, dummyData ); + } + +// --------------------------------------------------------------------------- +// RelativeIndex +// --------------------------------------------------------------------------- +// +int MulModelImpl::RelativeIndex( int aAbsoluteIndex ) const + { + return mDataWindow->RelativeIndex(aAbsoluteIndex); + } + +// --------------------------------------------------------------------------- +// TopWindowOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::TopWindowOffset() const + { + return mDataWindow->TopWindowOffset(); + } + +// --------------------------------------------------------------------------- +// BottomWindowOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::BottomWindowOffset() const + { + return mDataWindow->BottomWindowOffset(); + } + +// --------------------------------------------------------------------------- +// TopOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::TopOffset() const + { + return mDataWindow->TopOffset(); + } + +// --------------------------------------------------------------------------- +// BottomOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::BottomOffset() const + { + return mDataWindow->BottomOffset(); + } + +// --------------------------------------------------------------------------- +// RearTopOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::RearTopOffset() const + { + return mDataWindow->RearTopOffset(); + } + +// --------------------------------------------------------------------------- +// RearBottomOffset +// --------------------------------------------------------------------------- +// +int MulModelImpl::RearBottomOffset() const + { + return mDataWindow->RearBottomOffset(); + } + +// --------------------------------------------------------------------------- +// IsItemMarked +// --------------------------------------------------------------------------- +// +bool MulModelImpl::IsItemMarked( int aIndex ) + { + return mModelHelper->CacheManager().IsItemMarked(aIndex); + } + +// --------------------------------------------------------------------------- +// Item +// --------------------------------------------------------------------------- +// +const MulVisualItem& MulModelImpl::Item( int aAbsoluteIndex ) + { + return mModelHelper->Item( aAbsoluteIndex ); + } + +// --------------------------------------------------------------------------- +// AbsoluteIndex +// --------------------------------------------------------------------------- +// +int MulModelImpl::AbsoluteIndex( int aRelativeIndex ) + { + return mDataWindow->AbsoluteIndex(aRelativeIndex); + } + +// --------------------------------------------------------------------------- +// SetMarkedIndex +// --------------------------------------------------------------------------- +// +void MulModelImpl::SetMarkedIndex( MulWidgetDef::TMulWidgetMarkingType aType, int aIndex ) + { + mModelHelper->CacheManager().SetMarkedIndex(aType,aIndex); + } + +// ------------- Function from IAlfModel ------------------------------------- + +// --------------------------------------------------------------------------- +// AddModelChangeObserver +// --------------------------------------------------------------------------- +// +void MulModelImpl::addModelChangeObserver( IAlfModelChangeObserver& /*aObserver*/ ) + { + //__MUL_ASSERT_DEBUG(false, KLNotImplemented ); + } + +// --------------------------------------------------------------------------- +// RemoveModelChangeObserver +// --------------------------------------------------------------------------- +// +void MulModelImpl::removeModelChangeObserver( IAlfModelChangeObserver& /*aObserver*/ ) + { + //__MUL_ASSERT_DEBUG(false, KLNotImplemented ); + } +// --------------------------------------------------------------------------- +// SetData +// --------------------------------------------------------------------------- +// +void MulModelImpl::setData( IAlfVariantType* /*aData*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// UpdateData +// --------------------------------------------------------------------------- +// +void MulModelImpl::updateData( int /*aNumContainerIndices*/, + int* /*aContainerIndices*/, + IAlfVariantType* /*aData*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// AddData +// --------------------------------------------------------------------------- +// +void MulModelImpl::addData( int /*aNumContainerIndices*/, + int* /*aContainerIndices*/, + IAlfVariantType* /*aData*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// RemoveData +// --------------------------------------------------------------------------- +// +void MulModelImpl::removeData( int /*aNumContainerIndices*/, int* /*aContainerIndices*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// ExecuteOperations +// --------------------------------------------------------------------------- +// +void MulModelImpl::executeOperations( AlfPtrVector& /*aOperationsArray*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// ExecuteOperation +// --------------------------------------------------------------------------- +// +void MulModelImpl::executeOperation( AlfModelOperation* /*aOperation*/ ) + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// ClearModel +// --------------------------------------------------------------------------- +// +void MulModelImpl::clearModel() + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + } + +// --------------------------------------------------------------------------- +// Data +// --------------------------------------------------------------------------- +// +IAlfVariantType* MulModelImpl::data() const + { + __MUL_ASSERT_DEBUG(false, KLNotImplemented); + return NULL; + } + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Getter for interfaces provided by the list model. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulModelImpl::makeInterface( const IfId& /*aType*/ ) + { + return static_cast( this ); + } + + + } // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulmodelutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulmodelutility.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,302 @@ +/* +* Copyright (c) 2007-2008 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: Utility class for data model +* +*/ + + +//Includes +#include "mul/mulmodelutility.h" + +#include +#include +#include +#include +#include // for standard exceptions +#include +#include + +//#include "mulactionitem.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// CreateVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* MulModelUtility::CreateVariantType( IAlfVariantType& aValue ) + { +/* IAlfVariantType* data = new (EMM) AlfVariantType(); + data->set(aValue); + return data;*/ + switch( aValue.type() ) + { + case IAlfVariantType::EBool: + { + return new AlfVariantType( aValue.boolean() ); + } + case IAlfVariantType::EInt: + { + return new AlfVariantType( aValue.integer() ); + } + case IAlfVariantType::EUint: + { + return new AlfVariantType( aValue.uinteger() ); + } + case IAlfVariantType::EReal: + { + return new AlfVariantType( aValue.real() ); + } + case IAlfVariantType::EString: + { + return new AlfVariantType( aValue.string() ); + } + case IAlfVariantType::EContainer: + { + return new AlfVariantType( aValue.container() ); + } + case IAlfVariantType::EMap: + { + return new AlfVariantType( aValue.map() ); + } + case IAlfVariantType::EBranch: + { + return new AlfVariantType( aValue.branch() ); + } + case IAlfVariantType::ECustomData: + default : + { + return NULL; + } + } + } + +// --------------------------------------------------------------------------- +// ConvertVisualItemToMap +// --------------------------------------------------------------------------- +// +OSN_EXPORT std::auto_ptr MulModelUtility::ConvertVisualItemToMap( MulVisualItem& /*aVisualItem*/ ) + { + auto_ptr map( new ( EMM ) AlfMap()); + + return map; + } + +// --------------------------------------------------------------------------- +// ConvertMapToVisualItem +// --------------------------------------------------------------------------- +// +OSN_EXPORT std::auto_ptr MulModelUtility::ConvertMapToVisualItem( IAlfMap& /*aMap*/ ) + { + auto_ptr visualItem( new ( EMM ) MulVisualItem()); +// for( int i = 0 ; i < aMap.count() ; ++i ) +// { +// const UString& attributeName = aMap.name(i); +// IAlfVariantType* origValue = aMap.item( attributeName ); +// std::auto_ptr< IMulVariantType> value ( new (EMM) MulVariantType() ); +// value->set(*origValue); +// visualItem->SetAttribute( attributeName , value.get() ); +// value.release(); +// } + return visualItem; + } + +// --------------------------------------------------------------------------- +// CheckNamePrefix +// --------------------------------------------------------------------------- +// +bool MulModelUtility::CheckNamePrefix( UString aName ) + { + _LIT8(KMulPrefix,"mul_"); + TPtrC8 debugString1 = ((TUint8*)aName.getUtf8()); + int index = debugString1.Find(KMulPrefix); + if( index == KErrNotFound ) + { + return false; + } + else + { + return true; + } + } + + + +// --------------------------------------------------------------------------- +// UStringToAlfString +// --------------------------------------------------------------------------- +// +OSN_EXPORT UString MulModelUtility::UStringToAlfString( const UString& aUString ) + { + if(aUString.isEmpty()) + { + return UString(""); + } + else + { + return UString( aUString.getUtf8() ); + } + } + +// --------------------------------------------------------------------------- +// AlfStringToUString +// --------------------------------------------------------------------------- +// +OSN_EXPORT UString MulModelUtility::AlfStringToUString( const UString& aAlfString ) + { + return UString( aAlfString.getUtf8() ); + } + +// --------------------------------------------------------------------------- +// IntToAlfString +// --------------------------------------------------------------------------- +// +OSN_EXPORT UString MulModelUtility::IntToUString( int aNumber ) + { + TBuf8<20> buf; + buf.AppendNum(aNumber); + return UString( (char*)buf.PtrZ()); + } + +// --------------------------------------------------------------------------- +// ConvertTDesToUString +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulModelUtility::ConvertTDesToUString (const TDesC& aDes, UString& aString) + { + HBufC8* utf8Buffer( NULL ); + TRAPD( error, utf8Buffer = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aDes ) ); + if ( !utf8Buffer || error != KErrNone ) + { + delete utf8Buffer; + throw std::exception(); + } + + TPtrC8 ptr = utf8Buffer->Des(); + std::auto_ptr ret; + try + { + if ( ptr.Length() ) + { + ret.reset( new osncore::UString( ( osncore::Utf8* ) &ptr[0], ptr.Length() )); + } + else + { + ret.reset( new osncore::UString( "" ) ); + } + } + catch ( std::exception e ) + { + delete utf8Buffer; + throw e; + } + + delete utf8Buffer; + utf8Buffer = NULL; + aString = UString(*ret); + } + +// --------------------------------------------------------------------------- +// ConvertTDes8ToUString +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulModelUtility::ConvertTDes8ToUString (const TDesC8& aDes, UString& aString) + { + TPtrC8 ptr = aDes; + std::auto_ptr ret; + try + { + if ( ptr.Length() ) + { + ret.reset( new osncore::UString( ( osncore::Utf8* ) &ptr[0], ptr.Length() )); + } + else + { + ret.reset( new osncore::UString( "" ) ); + } + } + catch ( std::exception e ) + { + throw e; + } + + aString = UString(*ret); + } + +// --------------------------------------------------------------------------- +// ConvertUStringToTDes +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulModelUtility::ConvertUStringToTDes (const UString& aString, TDes& aDes) + { + HBufC* unicodeBuffer = NULL; + if ( !aString.isEmpty() ) + { + TRAPD( error, unicodeBuffer = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((TUint8*)aString.getUtf8())) ); + if ( !unicodeBuffer || error != KErrNone ) + { + delete unicodeBuffer; + throw std::exception(); + } + aDes.Copy(*unicodeBuffer); + delete unicodeBuffer; + unicodeBuffer = NULL; + } + else + { + aDes.Zero(); + } + } + +// --------------------------------------------------------------------------- +// ConvertUStringToTDes8 +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulModelUtility::ConvertUStringToTDes8(const UString& aString, TDes8& aDes) + { + /// @see comments in MulModelUtility::ConvertUStringToTDes + HBufC* unicodeBuffer = NULL; + if ( !aString.isEmpty() ) + { + TRAPD( error, unicodeBuffer = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((TUint8*)aString.getUtf8())) ); + if ( !unicodeBuffer || error != KErrNone ) + { + delete unicodeBuffer; + throw std::exception(); + } + aDes.Copy(*unicodeBuffer); + delete unicodeBuffer; + unicodeBuffer = NULL; + } + else + { + aDes.Zero(); + } + } + +// --------------------------------------------------------------------------- +// CreateVisualItem +// --------------------------------------------------------------------------- +// +OSN_EXPORT std::auto_ptr MulModelUtility::CreateVisualItem( mulwidget::TLogicalTemplate aDefaultTemplate ) + { + std::auto_ptr visualItem( new (EMM) MulVisualItem() ); + visualItem->SetAttribute( mulvisualitem::KAttributeTemplate , aDefaultTemplate); + return visualItem; + } + +} // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulpagedatawindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulpagedatawindow.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,485 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of Data window +* +*/ + + +//Includes +#include "mulpagedatawindow.h" + +#include + +//Internal includes +#include "mulassert.h" +#include "mulmodelimpl.h" +#include "mullog.h" + +using namespace std; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulPageDataWindow +// --------------------------------------------------------------------------- +// +MulPageDataWindow::MulPageDataWindow( MulModelImpl& aMulModel ) + :mMulModel( aMulModel ), + mHighlight(KNotInitialized), + mPageTopIndex(KNotInitialized), + mOldPageTopIndex(KNotInitialized), + mBufferSize(KNotInitialized), + mWindowSize(KNotInitialized), + mWindowTop(KNotInitialized), + mWindowBottom(KNotInitialized), + mBufferTop(0), + mBufferBottom(0), + mOldBufferTop(KNotInitialized), + mOldBufferBottom(KNotInitialized), + mRearBufferTop(0), + mRearBufferBottom(0), + mOldRearBufferTop(KNotInitialized), + mOldRearBufferBottom(KNotInitialized) + { + } + +// --------------------------------------------------------------------------- +// SetWindowSize +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::SetWindowSize( int aWindowSize, int aPageTopIndex ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::SetWindowSize()"); + + __MUL_ASSERT( aWindowSize > 0, KLInvalidArgument ); + + if( mWindowSize != aWindowSize || mWindowTop != aPageTopIndex) + { + if( KNotInitialized == mBufferSize ) + { + mBufferSize = aWindowSize; + } + + mWindowSize = aWindowSize; + mOldPageTopIndex = mPageTopIndex; + mPageTopIndex = aPageTopIndex; + + + /*adjusting window offset + //if window size changes then the top and bottom offset should be + //adjusted such that highlight remains at the centre + //window top and bottom are inclusive*/ + + //assing page top index to window top by default aPageTopIndex is KNotInitialized + mWindowTop = aPageTopIndex ; + mWindowTop = ( mWindowTop == KNotInitialized ) ? 0 : mWindowTop; + mWindowBottom = mWindowTop + mWindowSize - 1; + //make sure that window bottom is not more than model count + mWindowBottom = mWindowBottom >= mMulModel.CurrentItemCount() ? ( mMulModel.CurrentItemCount() -1) : mWindowBottom; + + MUL_LOG_INFO2("MUL::MulDataWindow::SetWindowSize() mWindowTop:%d,mWindowBottom:%d",mWindowTop,mWindowBottom); + + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// SetBufferSize +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::SetBufferSize( int aBufferSize ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulDataWindow::SetBufferSize()"); + + __MUL_ASSERT( aBufferSize > 0, KLInvalidArgument ); + + if( mBufferSize != aBufferSize ) + { + mBufferSize = aBufferSize; + + if(mMulModel.CurrentItemCount() > 0) + { + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + } + //else nothing needed + } + +// --------------------------------------------------------------------------- +// ~MulDataWindow +// --------------------------------------------------------------------------- +// +MulPageDataWindow::~MulPageDataWindow() + { + // do nothing + } + +// --------------------------------------------------------------------------- +// SetHighlight +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::SetHighlight( int aHighlightIndex ) + { + MUL_LOG_INFO2("MUL::MulDataWindow::SetHighlight() mHighlight:%d,modelCount:%d",aHighlightIndex,mMulModel.CurrentItemCount()); + + __MUL_ASSERT( aHighlightIndex >= 0 && aHighlightIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + mHighlight = aHighlightIndex; + } + + +// --------------------------------------------------------------------------- +// UpdateHighlight +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::UpdateHighlight( int aHighlightIndex ) + { + // No need to assert. We should send highlight -1 when all the items are removed. + // Widget should handle. to show emty text visualization + mHighlight = aHighlightIndex; + } + +// --------------------------------------------------------------------------- +// AdjustOffset +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::AdjustOffset() + { + if( BottomWindowOffset() >= mMulModel.CurrentItemCount() ) + { + mWindowBottom = mMulModel.CurrentItemCount() -1; + mWindowTop = mWindowBottom - WindowSize() + 1; + mWindowTop = mWindowTop < 0 ? 0 : mWindowTop; + + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustOffset() : windowTop:%d::windowBottom%d",mWindowTop,mWindowBottom); + } + else if( (BottomWindowOffset() - TopWindowOffset() +1 ) < WindowSize() ) + { + mWindowTop = 0; + mWindowBottom = mWindowTop + WindowSize() -1; + int modelCount = mMulModel.CurrentItemCount(); + mWindowBottom = mWindowBottom >= modelCount ? (modelCount - 1) : mWindowBottom; + + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustOffset() :: windowTop:%d::windowBottom%d",mWindowTop,mWindowBottom); + } + + // save old values to check if teh buffer offsets are modified. If the buffer offsets are + // modified then should inform the widget to update the visualization + SaveOldValues(); + AdjustBuffer(); + } + + +// --------------------------------------------------------------------------- +// ScrollWindow +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::ScrollWindow( int aPageTopIndex ) + { + MUL_LOG_INFO2("MUL::MulDataWindow::ScrollWindow() aPageTopIndex:%d,modelCount:%d",aPageTopIndex,mMulModel.CurrentItemCount()); + + __MUL_ASSERT( aPageTopIndex >= 0 && aPageTopIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if( mPageTopIndex != aPageTopIndex ) + { + mOldPageTopIndex = mPageTopIndex; + mPageTopIndex = aPageTopIndex; + + UpdateDataWindow(); + } + //else same highlight + } + + +// --------------------------------------------------------------------------- +// UpdateDataWindow +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::UpdateDataWindow() + { + MUL_LOG_INFO1("MUL::MulPageDataWindow::UpdateDataWindow() diff:%d ", mPageTopIndex - mOldPageTopIndex ); + + //If diffrence is negative than highlight is moved up else down + //(( mPageTopIndex - mOldPageTopIndex ) < 0 ) ? ShiftWindowUp() : ShiftWindowDown() ; + + MUL_LOG_ENTRY_EXIT("MUL::MulPageDataWindow::ShiftWindowDown()"); + MUL_LOG_INFO2("MUL::MulPageDataWindow::ShiftWindowDown() mPageTopIndex:%d,mWindowBottom:%d",mPageTopIndex,mWindowBottom); + + mWindowTop = mPageTopIndex; + mWindowBottom = mWindowTop + mWindowSize -1; + //bottom can't exceeding model count + mWindowBottom = mWindowBottom >= mMulModel.CurrentItemCount() ? + mWindowBottom = mMulModel.CurrentItemCount() - 1 : mWindowBottom; + + MUL_LOG_INFO2("MUL::MulDataWindow::ShiftWindowDown() mWindowTop:%d,mWindowBottom:%d",mWindowTop,mWindowBottom); + + SaveOldValues(); + AdjustBuffer(); + mMulModel.DataWindowUpdated(); + } + +// --------------------------------------------------------------------------- +// AdjustBuffer +// --------------------------------------------------------------------------- +// +void MulPageDataWindow::AdjustBuffer() + { + MUL_LOG_ENTRY_EXIT("MUL::MulPageDataWindow::AdjustBuffer()"); + + int modelCount = mMulModel.CurrentItemCount() -1; + + //remove data is new window is smaller/add is new window is bigger + //create rear buffer only if model has more data + if( mWindowTop == 0 && ActualBufferSize() <= modelCount ) + { + MUL_LOG_INFO("MUL::MulPageDataWindow::AdjustBuffer() mWindowTop == 0 "); + + mBufferTop = mWindowTop; + mBufferBottom = mBufferTop + mWindowSize + mBufferSize - 1; + + //Create rear top and rear bottom only in looping case + //window top is zero so data at other end should be buffered + mRearBufferBottom = modelCount; + mRearBufferTop = mRearBufferBottom - mBufferSize +1; + } + else if( mWindowBottom == modelCount && ActualBufferSize() <= modelCount ) + { + MUL_LOG_INFO("MUL::MulPageDataWindow::AdjustBuffer() mWindowBottom == modelCount "); + + mBufferBottom = mWindowBottom ; + mBufferTop = mBufferBottom - (mWindowSize + mBufferSize) + 1; + + //Create rear top and rear bottom only in looping case + //window bottom is equal to model count so data at other end should be buffered + mRearBufferTop = 0; + mRearBufferBottom = mRearBufferTop + mBufferSize -1 ; + } + else + { + MUL_LOG_INFO("MUL::MulPageDataWindow::AdjustBuffer() else "); + + mBufferTop = mWindowTop - mBufferSize; + mBufferBottom = mWindowBottom + mBufferSize; + + //check if top or bottom is out of bound and update offset accordingly + if( mBufferTop < 0 ) + { + MUL_LOG_INFO("MUL::MulPageDataWindow::AdjustBuffer() mBufferTop < 0 "); + + mBufferTop = 0; + mBufferBottom = mBufferTop + ActualBufferSize() - 1; + //buffer bottom cant be larger then model count + mBufferBottom = mBufferBottom > modelCount ? modelCount : mBufferBottom; + } + else if( mBufferBottom > modelCount ) + { + MUL_LOG_INFO("MUL::MulPageDataWindow::AdjustBuffer() mBufferBottom > modelCount"); + + mBufferBottom = modelCount ; + mBufferTop = mBufferBottom - ActualBufferSize() + 1; + //buffer top cant be less then 0 + mBufferTop = mBufferTop < 0 ? 0 : mBufferTop; + } + + //in other case rear top and rear bottom is not use set to -1 + mRearBufferTop = KNotInitialized; + mRearBufferBottom = KNotInitialized; + } + + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustBuffer() mOldBufferTop:%d,mOldBufferBottom:%d",mOldBufferTop,mOldBufferBottom); + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustBuffer() mOldRearBufferBottom:%d,mOldRearBufferTop:%d",mOldRearBufferBottom,mOldRearBufferTop); + + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustBuffer() mBufferTop:%d,mBufferBottom:%d",mBufferTop,mBufferBottom); + MUL_LOG_INFO2("MUL::MulPageDataWindow::AdjustBuffer() mRearBufferBottom:%d,mRearBufferTop:%d",mRearBufferBottom,mRearBufferTop); + + __MUL_ASSERT_DEBUG( mWindowTop >= 0 && mWindowBottom < mMulModel.CurrentItemCount(), _L("Invlid Window")); + __MUL_ASSERT_DEBUG( mBufferTop >= 0 && mBufferBottom < mMulModel.CurrentItemCount(), _L("Invlid Buffer")); + } + +// --------------------------------------------------------------------------- +// IsItemInDataWindow +// --------------------------------------------------------------------------- +// +bool MulPageDataWindow::IsItemInDataWindow(int aItemIndex ) const + { + //__MUL_ASSERT_DEBUG( aItemIndex >= 0 && aItemIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + bool result( false ); + + if(mWindowSize == KNotInitialized ) + { + result = false; + } + //check that rear buffer is on or not in looping case + else if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( ( aItemIndex >= mBufferTop && aItemIndex <= mBufferBottom ) || + ( aItemIndex >= mRearBufferTop && aItemIndex <= mRearBufferBottom ) ) + { + result = true; + } + } + else if( aItemIndex >= mBufferTop && aItemIndex <= mBufferBottom ) + { + result = true; + } + return result; + } + +// --------------------------------------------------------------------------- +// IsItemInDataWindow +// --------------------------------------------------------------------------- +// +bool MulPageDataWindow::IsItemInVisibleWindow(int aItemIndex ) const + { + //__MUL_ASSERT_DEBUG( aItemIndex >= 0 && aItemIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if(mWindowSize == KNotInitialized ) + { + return false; + } + else if( aItemIndex >= mWindowTop && aItemIndex <= mWindowBottom ) + { + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// RelativeIndex +// --------------------------------------------------------------------------- +// +int MulPageDataWindow::RelativeIndex( int aAbsoluteIndex ) const + { + __MUL_ASSERT_DEBUG( aAbsoluteIndex >= 0 && aAbsoluteIndex <= mMulModel.CurrentItemCount()-1, KLInvalidArgument ); + + if( !IsItemInDataWindow(aAbsoluteIndex) ) + { + return -1; + } + + if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( mRearBufferBottom == mMulModel.CurrentItemCount() - 1 ) + { + if( aAbsoluteIndex >= mRearBufferTop && aAbsoluteIndex <= mRearBufferBottom ) + { + int bufferSize = BottomOffset() - TopOffset() + 1; + int rearDiff = aAbsoluteIndex - mRearBufferTop; + int relativeIndex = bufferSize + rearDiff; + return relativeIndex; + } + else + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + } + else + { + if( aAbsoluteIndex >= mRearBufferTop && aAbsoluteIndex <= mRearBufferBottom ) + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + else + { + int bufferSize = mRearBufferBottom - mRearBufferTop + 1; + int diff = aAbsoluteIndex - TopOffset(); + int relativeIndex = bufferSize + diff; + return relativeIndex; + } + } + } + else + { + int relativeIndex = aAbsoluteIndex < TopOffset() ? + aAbsoluteIndex : aAbsoluteIndex - TopOffset() ; + return relativeIndex; + } + } + +// --------------------------------------------------------------------------- +// AbsoluteIndex +// --------------------------------------------------------------------------- +// +int MulPageDataWindow::AbsoluteIndex( int aRelativeIndex ) const + { + __MUL_ASSERT_DEBUG( aRelativeIndex >= 0 && aRelativeIndex <= ActualBufferSize(), _L("Invalid Relative Index")); + + if( mRearBufferTop != KNotInitialized && mRearBufferBottom != KNotInitialized ) + { + if( mRearBufferBottom == mMulModel.CurrentItemCount() - 1 ) + { + if( aRelativeIndex > BottomOffset() ) + { + //relative index is in loop buffer + int diff = aRelativeIndex - BottomOffset() - 1; + int absoluteIndex = RearTopOffset() + diff; + return absoluteIndex; + } + else + { + int absoluteIndex = TopOffset() + aRelativeIndex; + return absoluteIndex; + } + } + else + { + if( aRelativeIndex <= RearBottomOffset() ) + { + //relative index is in loop buffer + int absoluteIndex = RearTopOffset() + aRelativeIndex; + return absoluteIndex; + } + else + { + int diff = aRelativeIndex - RearBottomOffset() - 1; + int absoluteIndex = TopOffset() + diff; + return absoluteIndex; + } + } + } + else + { + int absoluteIndex = TopOffset() + aRelativeIndex; + return absoluteIndex; + } + } + +// --------------------------------------------------------------------------- +// IsBufferOffsetChanged +// --------------------------------------------------------------------------- +// +bool MulPageDataWindow::IsBufferOffsetChanged() + { + if(mRearBufferBottom != mOldRearBufferBottom || + mRearBufferTop != mOldRearBufferTop || + mBufferTop != mOldBufferTop || + mBufferBottom != mOldBufferBottom ) + { + return true; + } + return false; + } + + } // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulpullmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulpullmode.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of Pull Mode +* +*/ + + +//Includes +#include "mulpullmode.h" + +#include + + +#include "mulassert.h" +#include "mulcachemanager.h" +#include "muldatawindow.h" +#include "mulpagedatawindow.h" +#include "mul/mulmodelutility.h" +#include "mullog.h" +#include "mulasyncdataprovider.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulPullMode() +// --------------------------------------------------------------------------- +// +MulPullMode::MulPullMode(MulPageDataWindow& aDataWindow, + const IMulModelProvider& aModelProvider) + :MulPushMode( aDataWindow ) + { + //mModelProvider = const_cast( &aModelProvider ); + MUL_LOG_ENTRY_EXIT("MUL::MulPullModeImpl::MulPullModeImpl()"); + mModelProvider.reset( new (ELeave) MulAsyncDataProvider( const_cast(aModelProvider), aDataWindow )); + } + +// --------------------------------------------------------------------------- +// ~MulPullMode() +// --------------------------------------------------------------------------- +// +MulPullMode::~MulPullMode() + { + // No implementation is required. + MUL_LOG_ENTRY_EXIT("MUL::MulPullModeImpl::~MulPullModeImpl()"); + } + +// ------------------------ From IMulModel ----------------------------------- + +// --------------------------------------------------------------------------- +// Update +// --------------------------------------------------------------------------- +// +void MulPullMode::Update(int aIndex, int aCount, const MulDataPath& /*aPath*/) + { + // throw exception if index is out of bound + __MUL_ASSERT( aIndex >= 0 && aCount > 0 && aIndex+aCount <= mCacheManager->ExpandedNodeCount(), KLInvalidArgument ); + + int startIndex = aIndex; + int range = 0; + bool firstTime = true; + for(int i = aIndex; i < aCount+aIndex ; ++i) + { + if( mDataWindow.IsItemInDataWindow(i) ) + { + range++; + firstTime = true; + } + else + { + if(firstTime) + { + firstTime = false; + if(range>0) + { + ProvideData(startIndex,range); + range = 0; + } + } + startIndex = i + 1; + } + } + ProvideData(startIndex,range); + } + +// --------------------------------------------------------------------------- +// Refresh +// --------------------------------------------------------------------------- +// +void MulPullMode::Refresh( int aCount, const MulDataPath& aPath ) + { + int modelCountBefore = mCacheManager->ExpandedNodeCount(); + + // remove all old nodes + for(int currentIndex = 0; currentIndex < modelCountBefore; currentIndex++) + { + mCacheManager->RemoveVisualItem(aPath,0); + } + + //mCacheManager->RemoveVisalItem(0, aCount, aPath ); + + // insert new nodes + mCacheManager->CreateNodes( 0, aCount, aPath ); + + int modelCount = mCacheManager->ExpandedNodeCount(); + // update alf model accordingly + if(mDataWindow.IsWindowEnabled()) + { + if(modelCountBefore == modelCount) + { + Update(0,aCount,aPath); + } + else + { + ModelCountChanged(modelCountBefore,modelCount); + } + } + } + +// --------------------------------------------------------------------------- +// SetData +// --------------------------------------------------------------------------- +// +void MulPullMode::SetData(int aIndex, auto_ptr aVisualItem,const MulDataPath& aPath) + { + MUL_LOG_ENTRY_EXIT("MUL::MulPullModeImpl::SetData()"); + + __MUL_ASSERT( aIndex >= 0 && aIndex < Count(aPath),_L("Invalid Argument.")); + + //Set data to model + if( mDataWindow.IsItemInDataWindow( aIndex ) ) + { + MulPushMode::SetData( aIndex, aVisualItem, aPath ); + } + } + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulPullMode::SetTemplate( mulwidget::TLogicalTemplate aTemplateId ) + { + mDefaultTemplate = aTemplateId; + + MulDataPath path ; + if( mDataWindow.IsWindowEnabled() ) + { + int topOffset = mDataWindow.TopOffset(); + int bottomOffset = mDataWindow.BottomOffset(); + for( int i = topOffset ; i <= bottomOffset ; i++ ) + { + MulPushMode::SetTemplate( i, mDefaultTemplate, path); + } + + int rearTopOffset = mDataWindow.RearTopOffset(); + int rearBottomOffset = mDataWindow.RearBottomOffset(); + for( int i = rearTopOffset; i <= rearBottomOffset && i >= 0 ; i++ ) + { + MulPushMode::SetTemplate( i, mDefaultTemplate, path); + } + } + } + +// --------------------------------------------------------------------------- +// WindowSiftedDown +// --------------------------------------------------------------------------- +// +void MulPullMode::WindowSiftedDown() + { + MUL_LOG_ENTRY_EXIT("MUL::MulPullModeImpl::WindowSiftedDown"); + + // If the complete datawindow is invalid. +// if(mDataWindow.TopOffset() - mDataWindow.OldTopOffset() > mDataWindow.ActualBufferSize() +// && mDataWindow.OldTopOffset() != KNotInitialized) + //if(mDataWindow.TopOffset() - mDataWindow.OldTopOffset() > mDataWindow.ActualBufferSize() ) + int oldTopOffset = mDataWindow.OldTopOffset(); + int oldBottomOffset = mDataWindow.OldBottomOffset(); + int topOffset = mDataWindow.TopOffset(); + int bottomOffset = mDataWindow.BottomOffset(); + int oldRearTopOffset = mDataWindow.OldRearTopOffset(); + int oldRearBottomOffset = mDataWindow.OldRearBottomOffset(); + + if( ( oldTopOffset == KNotInitialized && oldBottomOffset == KNotInitialized ) || + ( topOffset - oldTopOffset >= mDataWindow.ActualBufferSize()) || + ( oldRearTopOffset != KNotInitialized && + ( topOffset - oldTopOffset >= ( mDataWindow.WindowSize() + mDataWindow.BufferSize() ) ) + ) ) + { + //remove old data from cache + for( int i = oldTopOffset ; i <= oldBottomOffset && i >= 0 ; i++ ) + { + mCacheManager->RemoveVisualItem( i ); + } + + for( int i = oldRearTopOffset; i <= oldRearBottomOffset && i >= 0 ; i++ ) + { + mCacheManager->RemoveVisualItem( i ); + } + + int startIndex = topOffset; + int range = bottomOffset - startIndex + 1; + + MUL_LOG_INFO2("MUL::MulPullModeImpl::WindowSiftedUp ProvideData startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + else + { + //remove extra items from top and add new items at bottom + for( int i = oldTopOffset ; i >= 0 && i < topOffset ; i++ ) + { + //remove item from top + mCacheManager->RemoveVisualItem( i ); + } + + int startIndex = oldBottomOffset +1 ; + int range = ( bottomOffset - oldBottomOffset ); + MUL_LOG_INFO2("MUL::MulPullModeImpl::DataWindowUpdated ProvideData startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + } + +// --------------------------------------------------------------------------- +// WindowSiftedUp +// --------------------------------------------------------------------------- +// +void MulPullMode::WindowSiftedUp() + { + MUL_LOG_ENTRY_EXIT("MUL::MulPullModeImpl::WindowSiftedUp "); + // If the complete datawindow is invalid. +// if(mDataWindow.OldBottomOffset() - mDataWindow.BottomOffset() > mDataWindow.ActualBufferSize() +// && mDataWindow.OldBottomOffset() != KNotInitialized) + + if( mDataWindow.OldBottomOffset() - mDataWindow.BottomOffset() >= mDataWindow.ActualBufferSize() || + ( mDataWindow.OldRearBottomOffset() != KNotInitialized && + ( mDataWindow.OldBottomOffset() - mDataWindow.BottomOffset() >= ( mDataWindow.WindowSize() + mDataWindow.BufferSize() ) ) + ) ) + { + //remove old data from cache + for( int i = mDataWindow.OldTopOffset() ; i <= mDataWindow.OldBottomOffset() && i >= 0 ; i++ ) + { + mCacheManager->RemoveVisualItem( i ); + } + + for( int i = mDataWindow.OldRearTopOffset( ); i <= mDataWindow.OldRearBottomOffset() && i >= 0 ; i++ ) + { + mCacheManager->RemoveVisualItem( i ); + } + + int startIndex = mDataWindow.TopOffset(); + int range = mDataWindow.BottomOffset() - startIndex + 1; + + MUL_LOG_INFO2("MUL::MulPullModeImpl::WindowSiftedUp ProvideData startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + else + { + //remove extra items from bottom and add at top + for( int i = mDataWindow.BottomOffset() ; i < mDataWindow.OldBottomOffset() ; i++ ) + { + mCacheManager->RemoveVisualItem(i+1); + } + + int startIndex = mDataWindow.TopOffset(); + int range = mDataWindow.OldTopOffset() - mDataWindow.TopOffset(); + + MUL_LOG_INFO2("MUL::MulPullModeImpl::WindowSiftedUp ProvideData startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + } + +// --------------------------------------------------------------------------- +// ProvideData +// --------------------------------------------------------------------------- +// +void MulPullMode::ProvideData(int aStartIndex, int aRange) + { + //call provide data for visible window first then for buffer + if( aRange > 0 ) + { + // check if the current higlighted item is there in the data asked for + if( mDataWindow.Highlight() >= aStartIndex && + mDataWindow.Highlight() < aStartIndex+aRange ) + { + mModelProvider->ProvideData( mDataWindow.Highlight(), 1 ,MulDataPath(),true ); + } + //__MUL_ASSERT( ( aRange % 18 ) == 0, _L("Invalid Renage") ); + //check that visible data is there in provide data call + if( aStartIndex < mDataWindow.TopWindowOffset() && + aStartIndex+aRange > mDataWindow.BottomWindowOffset() ) + { + { + //request visible item + int startIndex = mDataWindow.TopWindowOffset(); + int range = ( mDataWindow.BottomWindowOffset() - mDataWindow.TopWindowOffset() ) + 1 ; + + MUL_LOG_INFO2("MUL::MulPullModeImpl::ProvideData visible buffer startIndex:%d,range:%d",startIndex,range); + mModelProvider->ProvideData(startIndex, range ,MulDataPath() ); + } + + { + //request item from top + int startIndex = aStartIndex; + int range = mDataWindow.TopWindowOffset() - startIndex; + + MUL_LOG_INFO2("MUL::MulPullModeImpl::ProvideData top buffer startIndex:%d,range:%d",startIndex,range); + mModelProvider->ProvideData(startIndex, range ,MulDataPath() ); + } + + { + //request item from bottom + int startIndex = mDataWindow.BottomWindowOffset() + 1 ; + int range = ( aStartIndex + aRange - 1) - mDataWindow.BottomWindowOffset(); + + MUL_LOG_INFO2("MUL::MulPullModeImpl::ProvideData bottom buffer startIndex:%d,range:%d",startIndex,range); + mModelProvider->ProvideData(startIndex, range ,MulDataPath() ); + } + } + else + { + //there is not provide data pending for visible window + mModelProvider->ProvideData(aStartIndex, aRange ,MulDataPath() ); + } + } + } + +// --------------------------------------------------------------------------- +// ModelCountChanged +// --------------------------------------------------------------------------- +// +void MulPullMode::ModelCountChanged(int aOldCount, int aNewCount) + { + MUL_LOG_ENTRY_EXIT("MUL::MulPullMode::AdjustOffsetAndData()"); + + MUL_LOG_INFO1("MUL::MulPullMode::AdjustAlfModelData() modelCount:%d", aNewCount ); + + MulPushMode::ModelCountChanged( aOldCount, aNewCount ); + + // fetch data for the new buffers + if( mDataWindow.RearTopOffset() != KNotInitialized && + mDataWindow.RearBottomOffset() != KNotInitialized ) + { + if(mDataWindow.RearTopOffset() == 0) + { + //updating all buffer + ProvideData( mDataWindow.RearTopOffset() , mDataWindow.RearBottomOffset() - + mDataWindow.RearTopOffset() + 1); + + ProvideData( mDataWindow.TopOffset() , mDataWindow.BottomOffset() - + mDataWindow.TopOffset() + 1); + } + else + { + ProvideData( mDataWindow.TopOffset() , mDataWindow.BottomOffset() - + mDataWindow.TopOffset() + 1); + + ProvideData( mDataWindow.RearTopOffset() , mDataWindow.RearBottomOffset() - + mDataWindow.RearTopOffset() + 1); + } + } + else + { + ProvideData( mDataWindow.TopOffset() , mDataWindow.BottomOffset() - + mDataWindow.TopOffset() + 1); + } + } + +// --------------------------------------------------------------------------- +// DataWindowUpdated +// --------------------------------------------------------------------------- +// +void MulPullMode::DataWindowUpdated() + { + //here sequence of Function call are important dont change function call sequences + //UpdateLoopBuffer must be called first + if( mDataWindow.RearTopOffset() != KNotInitialized && + mDataWindow.OldRearTopOffset() != KNotInitialized ) //there is looping on + { + UpdateLoopBuffer(); + //returning from here only dont need to do any thing else + return ; + } + //window shifted down + if( mDataWindow.OldBottomOffset() < mDataWindow.BottomOffset() ) + { + WindowSiftedDown(); + } + //window shifted up + else if( mDataWindow.OldTopOffset() > mDataWindow.TopOffset()) + { + WindowSiftedUp(); + } + + //add buffer in looping case + if(mDataWindow.RearTopOffset() != KNotInitialized && mDataWindow.RearBottomOffset() != KNotInitialized) //rear offset changed + { + // here ask data from top to bottom + int startIndex = mDataWindow.RearTopOffset() ; + int range = mDataWindow.RearBottomOffset() - mDataWindow.RearTopOffset() + 1; + + MUL_LOG_INFO2("MUL::MulPullMode::DataWindowUpdated startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + } + +// --------------------------------------------------------------------------- +// UpdateLoopBuffer +// --------------------------------------------------------------------------- +// +void MulPullMode::UpdateLoopBuffer() + { + MUL_LOG_ENTRY_EXIT("MUL::MulPushMode::UpdateLoopBuffer"); + if( mDataWindow.RearTopOffset() < mDataWindow.OldRearTopOffset() ) + { + int startIndex = mDataWindow.TopOffset(); + int range = mDataWindow.OldRearTopOffset() - startIndex; + + MUL_LOG_INFO2("MUL::MulPushMode::UpdateLoopBuffer startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + else + { + int startIndex = mDataWindow.OldRearBottomOffset()+1 ; + int range = mDataWindow.BottomOffset() - startIndex + 1; + + MUL_LOG_INFO2("MUL::MulPushMode::UpdateLoopBuffer startIndex:%d,range:%d",startIndex,range); + ProvideData(startIndex,range); + } + } + +// --------------------------------------------------------------------------- +// Item +// --------------------------------------------------------------------------- +// +const MulVisualItem& MulPullMode::Item( int aAbsoluteIndex ) + { + MulVisualItem* visualItem = mCacheManager->Data( aAbsoluteIndex ); + if( !visualItem ) + { + if( mDataWindow.IsItemInDataWindow(aAbsoluteIndex) ) + { + std::auto_ptr dummyItem = MulModelUtility::CreateVisualItem( Template() ); + visualItem = dummyItem.get(); + mCacheManager->AddVisualItem(dummyItem, MulDataPath() ,aAbsoluteIndex ); + } + else + { + throw std::invalid_argument(KInvalidArgument); + } + } + return *visualItem; + } + + + } // namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulpushmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulpushmode.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,302 @@ +/* +* Copyright (c) 2007-2008 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: Base implementation of pull and push mode + * +*/ + + + +//Includes +#include "mulpushmode.h" + +#include "mulassert.h" +#include "mulcachemanager.h" +#include "mulpagedatawindow.h" +#include "mullog.h" + +namespace Alf + { + +// --------------------------------------------------------------------------- +// MulPushMode() +// --------------------------------------------------------------------------- +// +MulPushMode::MulPushMode( MulPageDataWindow& aDataWindow ) + : mDataWindow(aDataWindow) + { + mCacheManager.reset( new ( EMM ) MulCacheManager()); + } + +// --------------------------------------------------------------------------- +// ~MulPushMode() +// --------------------------------------------------------------------------- +// +MulPushMode::~MulPushMode() + { + // No implementation is required. + } + +// --------------------------------------------------------------------------- +// Insert +// --------------------------------------------------------------------------- +// +bool MulPushMode::Insert(int aIndex, int aCount, const MulDataPath& aPath ) + { + __MUL_ASSERT( aIndex >= 0 && aIndex <= mCacheManager->ExpandedNodeCount() && aCount > 0, KLInvalidArgument ); + + int modelCountBefore = mCacheManager->ExpandedNodeCount(); + mCacheManager->CreateNodes( aIndex, aCount, aPath ); + + int modelCount = mCacheManager->ExpandedNodeCount(); + + // if there is a change in expanded node count of model then update + // the alf model. THis case would happen if we are inserting childnodes + // for a node which is not expanded. Then no need to update the alf model + if(mDataWindow.IsWindowEnabled() && modelCount != modelCountBefore) + { + ModelCountChanged(modelCountBefore,modelCount); + } + + // The highlight is the same but its relative index is changed + // because the buffer offsets are changed. Even in this case widget has to update the visualization + return false; + } + +// --------------------------------------------------------------------------- +// Remove +// --------------------------------------------------------------------------- +// +bool MulPushMode::Remove( int aIndex, int aCount,const MulDataPath& aPath) + { + __MUL_ASSERT( aIndex >= 0 && aCount > 0 && aIndex+aCount <= mCacheManager->ExpandedNodeCount(), KLInvalidArgument ); + + int modelCountBefore = mCacheManager->ExpandedNodeCount(); + + mCacheManager->RemoveVisualItem( aIndex, aCount, aPath ); + + int modelCount = mCacheManager->ExpandedNodeCount(); + + // To inform the calling class whether the highlight has changed + // If the current highlight is more than the total number of items. Then udjust teh highlight + bool highlightUpdated = ValidateCurrentHighlight(); + + // if there is a change in expanded node count of model then update + // the alf model. This case would happen if we are removing childnodes + // for a node which is not expanded. Then no need to update the alf model + if(mDataWindow.IsWindowEnabled() && modelCount != modelCountBefore) + { + ModelCountChanged(modelCountBefore,modelCount); + } + + // If the highlight is changed because it was greater than current model count or if + // the buffer offsets are changed then return true + return ( highlightUpdated ); + } + +// --------------------------------------------------------------------------- +// Update +// --------------------------------------------------------------------------- +// +void MulPushMode::Update(int /*aIndex*/, int /*aCount*/, const MulDataPath& /*aPath*/) + { + //no implementation required + } + +// --------------------------------------------------------------------------- +// Refresh +// --------------------------------------------------------------------------- +// +void MulPushMode::Refresh( int /*aCount*/, const MulDataPath& /*aPath*/) + { + // throw exception not implemented in push mode + throw std::logic_error("Not Implemented"); + } + + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulPushMode::SetTemplate( mulwidget::TLogicalTemplate aTemplateId ) + { + mDefaultTemplate = aTemplateId ; + + MulDataPath path; + for( int i = 0 ; i < mCacheManager->Count() ; i++ ) + { + MulPushMode::SetTemplate( i, mDefaultTemplate, path ); + } + } + +// --------------------------------------------------------------------------- +// Template +// --------------------------------------------------------------------------- +// +mulwidget::TLogicalTemplate MulPushMode::Template( ) + { + return mDefaultTemplate; + } + +// --------------------------------------------------------------------------- +// Data +// --------------------------------------------------------------------------- +// +const MulVisualItem* MulPushMode::Data( int aIndex, const MulDataPath& /*aPath*/) const + { + __MUL_ASSERT( aIndex >= 0 && aIndex < mCacheManager->ExpandedNodeCount(), KLInvalidArgument ); + + return mCacheManager->Data( aIndex ); + } + +// --------------------------------------------------------------------------- +// SetData +// --------------------------------------------------------------------------- +// +void MulPushMode::SetData( int aIndex, std::auto_ptr aVisualItem, + const MulDataPath& aPath) + { + __MUL_ASSERT( aIndex >= 0 && aIndex < mCacheManager->ExpandedNodeCount(),_L("Invalid Argument")); + + MulVisualItem* visualItem = mCacheManager->Data( aIndex ); + MUL_LOG_INFO2("MUL::MulPushMode::SetData() Index:%d,item:%x",aIndex, visualItem); + if( visualItem ) + { + mCacheManager->UpdateVisualItem( *aVisualItem , aPath, aIndex ); + } + else + { + // Validating input visual item + ValidateVisualItem( *aVisualItem ); + mCacheManager->AddVisualItem( aVisualItem, aPath, aIndex ); + } + } + +// --------------------------------------------------------------------------- +// Count +// --------------------------------------------------------------------------- +// +int MulPushMode::Count(const MulDataPath& /*aPath*/) const + { + return mCacheManager->ExpandedNodeCount(); + } + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulPushMode::SetTemplate( int aItemIndex, mulwidget::TLogicalTemplate aTemplateId, + const MulDataPath& /*aPath*/ ) + { + MUL_LOG_ENTRY_EXIT("MUL::MulPushMode::SetTemplate"); + + MulVisualItem* visualItem = mCacheManager->Data( aItemIndex ); + if( visualItem ) + { + mulwidget::TLogicalTemplate logicalTemplate = (mulwidget::TLogicalTemplate) visualItem->AttributeAsInt( mulvisualitem::KAttributeTemplate ); + //if template is not same then only change it + if( logicalTemplate != aTemplateId ) + { + visualItem->SetAttribute( mulvisualitem::KAttributeTemplate, aTemplateId ); + } + } + } + +// --------------------------------------------------------------------------- +// CurrentItemCount +// --------------------------------------------------------------------------- +// +int MulPushMode::CurrentItemCount() const + { + return mCacheManager->ExpandedNodeCount(); + } + +// --------------------------------------------------------------------------- +// CacheManager +// --------------------------------------------------------------------------- +// +MulCacheManager& MulPushMode::CacheManager() const + { + return *mCacheManager; + } + +// --------------------------------------------------------------------------- +//ValidateVisualItem +// --------------------------------------------------------------------------- +// +void MulPushMode::ValidateVisualItem( MulVisualItem& aVisualItem ) + { + //add default template to item if template is not already set and default template is not null + IMulVariantType* itemTemplate = aVisualItem.Attribute( mulvisualitem::KAttributeTemplate ); + if( !itemTemplate ) + { + if( mDefaultTemplate != mulwidget::KTemplateUnknown ) + { + //add default template to this visual item + aVisualItem.SetAttribute( mulvisualitem::KAttributeTemplate, mDefaultTemplate, 0 ); + } + else + { + //template must be there + throw std::invalid_argument("Default template not available."); + } + } + } + +// --------------------------------------------------------------------------- +// ModelCountChanged +// --------------------------------------------------------------------------- +// +void MulPushMode::ModelCountChanged(int aOldCount, int aNewCount) + { + MUL_LOG_ENTRY_EXIT("MUL::MulPushMode::ModelCountChanged()"); + + MUL_LOG_INFO2("MUL::MulPushMode::ModelCountChanged() aOldCount:%d,aNewCount:%d", aOldCount, aNewCount ); + + mDataWindow.AdjustOffset(); + } + +// --------------------------------------------------------------------------- +// ValidateCurrentHighlight +// --------------------------------------------------------------------------- +// +bool MulPushMode::ValidateCurrentHighlight() + { + // To inform the calling class whether the highlight has changed + int modelCount = mCacheManager->ExpandedNodeCount(); + if( mDataWindow.Highlight() >= modelCount) + { + mDataWindow.UpdateHighlight( modelCount-1 ); + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// Item +// --------------------------------------------------------------------------- +// +const MulVisualItem& MulPushMode::Item( int aAbsoluteIndex ) + { + MulVisualItem* visualItem = mCacheManager->Data( aAbsoluteIndex ); + if(!visualItem) + { + throw std::invalid_argument(KInvalidArgument); + } + return *visualItem; + } + + } // namespace ends here + +//End of file + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/multree.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/multree.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,321 @@ +/* +* Copyright (c) 2007-2008 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: MulTree Implementaiton +* +*/ + + +#include "multree.h" + +#include + +#include "mulassert.h" +#include "mulmodeldef.h" +#include "muldatapath.h" + +namespace Alf + { + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// AddNode +// ----------------------------------------------------------------------------- +// +void MulTree::AddNode(const MulDataPath& aPath,int aIndex) + { + //Find parent node + MulTreeNode* node = FindNode( aPath ); + + //update index of other child + for( int i = 0 ; i < node->ChildCount() ; i++ ) + { + MulTreeNode* childNode = node->Child(i); + int index = childNode->Index(); + if( childNode->Index() >= aIndex ) + { + childNode->SetIndex( childNode->Index()+1 ); + } + } + + //insert node in to parent node + std::auto_ptr childNode( new (EMM) MulTreeNode(aIndex)); + node->InsertChild(childNode,aIndex); + } + +// ----------------------------------------------------------------------------- +// RemoveNode +// ----------------------------------------------------------------------------- +// +void MulTree::RemoveNode(const MulDataPath& aPath, int aIndex ) + { + MulTreeNode* node = FindNode( aPath ); + node->RemoveChild(aIndex); + + //update index of other child + for( int i = 0 ; i < node->ChildCount() ; i++ ) + { + MulTreeNode* childNode = node->Child(i); + int index = childNode->Index(); + if( childNode->Index() > aIndex ) + { + childNode->SetIndex( childNode->Index()-1 ); + } + } + } + +// ----------------------------------------------------------------------------- +// FindNode +// ----------------------------------------------------------------------------- +// +MulTreeNode* MulTree::FindNode( const MulDataPath& aPath ) const + { + MulTreeNode* currentNode = mRootNode.get(); + for( int i = 0; i < aPath.Depth() ;i++ ) + { + int index = aPath[i]; + if( currentNode->HasChild() ) + { + currentNode = FindChildNode( currentNode,index); + } + else + { + __MUL_ASSERT_DEBUG( false , KLInvalidArgument ); + } + } + return currentNode; + } + +// ----------------------------------------------------------------------------- +// FindNode +// ----------------------------------------------------------------------------- +// +MulTreeNode* MulTree::FindChildNode(MulTreeNode* aParentNode,int aIndex) const + { + MulTreeNode* currentNode = aParentNode; + MulTreeNode* foundNode = NULL; + int index = 0; + bool found(false); + int childCount = currentNode->ChildCount(); + while( !found && index < childCount ) + { + MulTreeNode* childNode = currentNode->Child(index); + if( aIndex == childNode->Index() ) + { + found = true; + foundNode = childNode; + } + index++; + } + + if( found == false ) + { + __MUL_ASSERT_DEBUG( false , KLInvalidArgument ); + } + + return foundNode; + } + +// ----------------------------------------------------------------------------- +// FindNode +// ----------------------------------------------------------------------------- +// +MulDataPath MulTree::FindNode( int aIndex ) const + { + int absoluteIndex = -1; + return FindNode( mRootNode.get(), absoluteIndex, aIndex ); + } + +// ----------------------------------------------------------------------------- +// FindNode +// ----------------------------------------------------------------------------- +// +MulDataPath MulTree::FindNode( MulTreeNode* aNode, int& aAbsoluteIndex, int aIndex ) const + { + MulTreeNode* currentNode = aNode; + if( currentNode->HasChild() ) + { + for(int i = 0 ; i < currentNode->ChildCount() ; i++ ) + { + aAbsoluteIndex++; + MulTreeNode* childNode = currentNode->Child(i); + +#ifdef _DEBUG + bool hasChild = childNode->HasChild(); + int count = childNode->ChildCount(); + bool isExpanded = childNode->IsExpanded(); +#endif //_DEBUG + + if( aAbsoluteIndex == aIndex ) + { + MulDataPath path= Path(*childNode); + path.SetIndex(i); + return path; + } + else if( childNode->HasChild() && childNode->IsExpanded() ) + { + MulDataPath path = FindNode( childNode, aAbsoluteIndex , aIndex ); + if(path.Index() != KNotInitialized ) + { + return path; + } + } + } + } + //__MUL_ASSERT_DEBUG( false , KLInvalidArgument ); + MulDataPath path; + path.SetIndex(KNotInitialized); + return path; + } + +// ----------------------------------------------------------------------------- +// Path +// ----------------------------------------------------------------------------- +// +MulDataPath MulTree::Path(MulTreeNode& aNode) const + { + MulTreeNode* parentNode = aNode.Parent(); + std::vector pathArray; + while( parentNode && parentNode != mRootNode.get() ) + { + int index = parentNode->Index(); + pathArray.push_back( parentNode->Index() ); + parentNode = parentNode->Parent(); + } + + int count = pathArray.size(); + + MulDataPath path; + for( int i= pathArray.size()- 1 ; i >=0 ; i-- ) + { + path.Append( pathArray[i] ); + } + pathArray.clear(); + return path; + } + +// ----------------------------------------------------------------------------- +// NodeCount +// ----------------------------------------------------------------------------- +// +int MulTree::NodeCount() const + { + int nodeCount =NodeCount( mRootNode.get() ); + return nodeCount; + } + +// ----------------------------------------------------------------------------- +// NodeCount +// ----------------------------------------------------------------------------- +// +int MulTree::NodeCount(MulTreeNode* aCurrentNode ) const + { + int nodeCount = 0; + if(aCurrentNode->HasChild()) + { + nodeCount = aCurrentNode->ChildCount(); + for(int i=0;i< aCurrentNode->ChildCount();i++) + { + nodeCount+= NodeCount(aCurrentNode->Child(i)); + } + } + return nodeCount; + } + +// ----------------------------------------------------------------------------- +// ExpandedNodeCount +// ----------------------------------------------------------------------------- +// +int MulTree::ExpandedNodeCount() const + { + int nodeCount = ExpandedNodeCount( mRootNode.get() ); + return nodeCount; + } + +// ----------------------------------------------------------------------------- +// ExpandedNodeCount +// ----------------------------------------------------------------------------- +// +int MulTree::ExpandedNodeCount(MulTreeNode* aCurrentNode ) const + { + int nodeCount = 0; + if( aCurrentNode->HasChild() && aCurrentNode->IsExpanded() ) + { + nodeCount = aCurrentNode->ChildCount(); + for( int i=0; i< aCurrentNode->ChildCount() ; i++ ) + { + nodeCount+= ExpandedNodeCount( aCurrentNode->Child(i) ); + } + } + return nodeCount; + } + +// ----------------------------------------------------------------------------- +// NodeIndex +// ----------------------------------------------------------------------------- +// +int MulTree::NodeIndex( const MulDataPath& aPath, int aIndex ) const + { + MulDataPath path( aPath ); + path.SetIndex( aIndex ); + + int absoluteIndex = -1; + int index = NodeIndex( mRootNode.get(), path, absoluteIndex ); + + return index; + } + +// ----------------------------------------------------------------------------- +// NodeIndex +// ----------------------------------------------------------------------------- +// +int MulTree::NodeIndex( MulTreeNode* aCurrentNode, const MulDataPath& aPath, int& aAbsoluteIndex ) const + { + MulTreeNode* currentNode = aCurrentNode; + if( currentNode->HasChild() ) + { + for(int i = 0 ; i < currentNode->ChildCount() ; i++ ) + { + aAbsoluteIndex++; + MulTreeNode* childNode = currentNode->Child(i); + +#ifdef _DEBUG + bool hasChild = childNode->HasChild(); + int count = childNode->ChildCount(); + bool isExpanded = childNode->IsExpanded(); +#endif //_DEBUG + + MulDataPath path = Path(*childNode); + path.SetIndex(i); + + if( path.IsEqual(aPath) ) + { + return aAbsoluteIndex; + } + else if( childNode->HasChild() && childNode->IsExpanded() ) + { + int index = NodeIndex( childNode, aPath, aAbsoluteIndex ); + if( index != KNotInitialized ) + { + return index; + } + } + } + } + return KNotInitialized; + } + + } //namespace Alf + + //End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulvarianttype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulvarianttype.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,309 @@ +/* +* Copyright (c) 2007-2008 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: MulVarianttype implementation +* +*/ + + +#include + +#include +#include + +#include "mulassert.h" + +using namespace osncore; +using namespace std; + +namespace Alf + { + +_LIT( KUnknownDataType, "Unknown data type" ); + +// --------------------------------------------------------------------------- +// Defination of class MulVariantTypeImpl +// --------------------------------------------------------------------------- +// + +class MulVariantType::MulVariantTypeImpl + { +public: + + ~MulVariantTypeImpl() + { + if( mDataType == IMulVariantType::EDes ) + { + if( mData.mDes ) + { + delete mData.mDes; + } + } + else if( mDataType == IMulVariantType::EMap ) + { + if( mData.mMap ) + { + delete mData.mMap; + } + } + + } + + MulVariantTypeImpl() + { + mData.mDes = NULL; + mData.mMap = NULL; + mDataType = IMulVariantType::EUnknown; + } + +public: + + union TData + { + bool mBool; // Boolean + int mInt; // 32-bit integer + uint mUint; // 32-bit unsigned integer + double mReal; // 64-bit real + HBufC* mDes; // 16 bit descriptor + IAlfMap* mMap; + }; + + TData mData; + IMulVariantType::TMulType mDataType; + + }; + +void MulVariantType::Construct( TMulType aType ) + { + mVarData.reset( new (EMM) MulVariantTypeImpl() ); + mVarData->mDataType = aType; + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType() + { + Construct(IMulVariantType::EUnknown ); + // No implementation required + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType( const TDesC& aDes ) + { + Construct(IMulVariantType::EDes ); + mVarData->mData.mDes = aDes.AllocL(); + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType(const int& aValue) + { + Construct(IMulVariantType::EInt ); + mVarData->mData.mInt = aValue; + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType(const uint& aValue) + { + Construct(IMulVariantType::EUint ); + mVarData->mData.mUint = aValue; + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType(const double& aValue) + { + Construct(IMulVariantType::EReal ); + mVarData->mData.mReal = aValue; + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType(const bool& aValue) + { + Construct(IMulVariantType::EBool ); + mVarData->mData.mBool = aValue; + } + +// --------------------------------------------------------------------------- +// MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::MulVariantType( IAlfMap& aData ) + { + Construct(IMulVariantType::EMap ); + mVarData->mData.mMap = aData.clone(); + } + +// --------------------------------------------------------------------------- +// ~MulVariantType +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVariantType::~MulVariantType() + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// MulType +// --------------------------------------------------------------------------- +// +OSN_EXPORT IMulVariantType::TMulType MulVariantType::Type() const + { + return mVarData->mDataType; + } + +// --------------------------------------------------------------------------- +// DesC +// --------------------------------------------------------------------------- +// +OSN_EXPORT const TDesC& MulVariantType::DesC() const + { + if ( Type() != IMulVariantType::EDes ) + { + __MUL_ASSERT(false, KUnknownDataType ); + } + return *mVarData->mData.mDes; + } + +// --------------------------------------------------------------------------- +// Clone +// --------------------------------------------------------------------------- +// +OSN_EXPORT std::auto_ptr< IMulVariantType > MulVariantType::Clone() + { + std::auto_ptr clone; + + switch( Type() ) + { + case IMulVariantType::EBool: + { + clone.reset( new (EMM) MulVariantType( boolean() ) ); + return clone; + } + case IMulVariantType::EInt: + { + clone.reset( new (EMM) MulVariantType( integer() ) ) ; + return clone; + } + case IMulVariantType::EUint: + { + clone.reset( new (EMM) MulVariantType( uinteger() ) ); + return clone; + } + case IMulVariantType::EReal: + { + clone.reset( new (EMM) MulVariantType( real() ) ); + return clone; + } + case IMulVariantType::EDes: + { + clone.reset( new (EMM) MulVariantType( DesC() ) ) ; + return clone; + } + case IAlfVariantType::EMap: + { + clone.reset( new (EMM) MulVariantType( Map() ) ) ; + return clone; + } + case IAlfVariantType::ECustomData: //delebrate fallthrough + default : + { + __MUL_ASSERT( false, KUnknownDataType ); + return clone; + } + } + } + +// --------------------------------------------------------------------------- +// boolean +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool MulVariantType::boolean() const + { + if ( Type() != IMulVariantType::EBool ) + { + __MUL_ASSERT( false, KUnknownDataType ); + } + return mVarData->mData.mBool; + } + +// --------------------------------------------------------------------------- +// integer +// --------------------------------------------------------------------------- +// +OSN_EXPORT int MulVariantType::integer() const + { + if ( Type() != IMulVariantType::EInt ) + { + __MUL_ASSERT( false, KUnknownDataType ); + } + return mVarData->mData.mInt; + } + +// --------------------------------------------------------------------------- +// uinteger +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint MulVariantType::uinteger() const + { + if ( Type() != IMulVariantType::EUint ) + { + __MUL_ASSERT( false, KUnknownDataType ); + } + return mVarData->mData.mUint; + } + +// --------------------------------------------------------------------------- +// real +// --------------------------------------------------------------------------- +// +OSN_EXPORT double MulVariantType::real() const + { + if ( Type() != IMulVariantType::EUint ) + { + __MUL_ASSERT( false, KUnknownDataType ); + } + return mVarData->mData.mReal; + } + +// --------------------------------------------------------------------------- +// map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap& MulVariantType::Map() const + { + if ( Type() != IMulVariantType::EMap ) + { + __MUL_ASSERT( false, KUnknownDataType ); + } + return *mVarData->mData.mMap; + } + + }// namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/muldatamodel/src/mulvisualitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/muldatamodel/src/mulvisualitem.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,374 @@ +/* +* Copyright (c) 2007-2008 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: Visual item class +* +*/ + + +#include + +#include +#include + +#include +#include + +#include // for Pow function +#include "mul/mulmodelutility.h" + +using namespace osncore; +using namespace std; + +namespace Alf + { +// --------------------------------------------------------------------------- +// Defination of class MulAttribute +// --------------------------------------------------------------------------- +// +class MulVisualItem::MulAttribute + { +public: //Constructor and destructor + + /** + * C++ constructor. + */ + MulAttribute():mValue(NULL),mFlag(0) + { + } + + /** + * C++ constructor. + * + * @param aValue value of the attribute + * @param aAttributeFlags property of this attribute + */ + MulAttribute( IMulVariantType* aValue, int aAttributeFlags = 0 ) + { + mValue = aValue; + mFlag = aAttributeFlags; + } + + /** + * Copy constructor. + * + * @param aAttribute existing attribute + */ + MulAttribute( const MulAttribute& aAttribute ) + { + mValue = aAttribute.mValue->Clone().release(); + mFlag = aAttribute.mFlag; + } + + /** + * Destructor. + */ + ~MulAttribute() + { + delete mValue; + } + +public: //data + + IMulVariantType* mValue ; //own + int mFlag ; + + }; + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVisualItem::MulVisualItem( ) + { + // Clearing dirty bit flags to 0; + mBitAttrFlag1 = 0; + mBitAttrFlag2 = 0; + } + +// --------------------------------------------------------------------------- +// Copy Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVisualItem::MulVisualItem( const MulVisualItem& aVisualItem ) + { + map mapToCopy = aVisualItem.mVisualItem; + map::iterator itr; + for( itr = mapToCopy.begin(); itr!= mapToCopy.end(); ++itr ) + { + mVisualItem[itr->first] = new (EMM) MulAttribute( *itr->second ); + } + mBitAttrFlag1 = aVisualItem.mBitAttrFlag1; + mBitAttrFlag2 = aVisualItem.mBitAttrFlag2; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT MulVisualItem::~MulVisualItem() + { + map::iterator itr; + for( itr = mVisualItem.begin(); itr!= mVisualItem.end(); ++itr ) + { + delete itr->second; + itr->second = NULL; + } + mVisualItem.clear(); + } + +// --------------------------------------------------------------------------- +// Add new attributes to visual item +// --------------------------------------------------------------------------- +// +//OSN_EXPORT void MulVisualItem::SetAttribute( mulvisualitem::TVisualAttribute aName, +// const UString& aValue, int aAttributeFlags ) +// { +// auto_ptr variantdata(new (EMM) MulVariantType( aValue )); +// +// SetAttribute( aName, variantdata.release(),aAttributeFlags,EDoesOwn); +// } + +// --------------------------------------------------------------------------- +// Add new attributes to visual item +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulVisualItem::SetAttribute( mulvisualitem::TVisualAttribute aName, + const TDesC& aValue, int aAttributeFlags ) + { + auto_ptr variantdata(new (EMM) MulVariantType( aValue )); + + SetAttribute( aName, variantdata.release(),aAttributeFlags,EDoesOwn); + } + + +// --------------------------------------------------------------------------- +// Add new attributes to visual item +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulVisualItem::SetAttribute( mulvisualitem::TVisualAttribute aName, + int aValue,int aAttributeFlags ) + { + auto_ptr variantdata(new ( EMM ) MulVariantType( aValue )); + + SetAttribute(aName,variantdata.release(),aAttributeFlags,EDoesOwn); + } + + +// --------------------------------------------------------------------------- +// Add new attributes to visual item +// --------------------------------------------------------------------------- +// +OSN_EXPORT void MulVisualItem::SetAttribute( mulvisualitem::TVisualAttribute aName, IMulVariantType* aValue, + int aAttributeFlags , + TAttributeOwnership /*aAttributeOwership*/ ) + { + map::iterator findIter = mVisualItem.find( aName ); + if( findIter != mVisualItem.end() ) + { + delete findIter->second; + findIter->second = NULL; + mVisualItem.erase( aName ); + } + mVisualItem[aName] = new (EMM) MulAttribute(aValue,aAttributeFlags ); + SetDirty(aName, true); + } + + +// --------------------------------------------------------------------------- +// Is the input attribute dirty, to be queried before a redraw +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool MulVisualItem::IsDirty(mulvisualitem::TVisualAttribute aAttr) const +{ + int i = (int)aAttr; + TReal base = 2.0; + TReal r = 0.0; + TReal val = 0.0; + TInt err = KErrNone; + + // If mBitAttrflag is binary 101, AND'ing it with 100(attribute 3) will + // set 100 to return true for attribute 3 being dirty + + // if attribute index <18 check against mBitAttrFlag1, else check + // against mBitAttrFlag2 + if(i < 18) + { + val = i; + err = Math::Pow(r, base, val); + if(KErrNone != err) + return true; + + return mBitAttrFlag1 & (int)r; + } + else + { + val = (int)(mulvisualitem::KMul_n) - i; + err = Math::Pow(r, base, val); + if(KErrNone != err) + return true; + + return mBitAttrFlag2 & (int)r; + } + +} + + +// --------------------------------------------------------------------------- +// Set the attribute as dirty in this Visual item based on input flag +// --------------------------------------------------------------------------- +// +void MulVisualItem::SetDirty(mulvisualitem::TVisualAttribute aAttr, bool aDirty) +{ + int i = (int)aAttr; + TReal base = 2.0; + TReal r = 0.0; + TReal val = i; + TInt err = KErrNone; + // If mBitAttrflag is binary 001, OR'ing it with 100(attribute 3) will + // set 101 to set bit for attribute 3 as 1 in dirty flag + if(aDirty) + { + // if attribute index <18 operate on mBitAttrFlag1 + // else operate against mBitAttrFlag1 + if(i < 18) + { + err = Math::Pow(r,base,val); + mBitAttrFlag1 |= (int)r; + } + else + { + err = Math::Pow(r,base,(TReal)((int)(mulvisualitem::KMul_n) - i)); + mBitAttrFlag2 |= (int)r; + } + } + else + { + // if attribute index <18 operate on mBitAttrFlag1 + // else operate against mBitAttrFlag1 + if(i < 18) + { + err = Math::Pow(r,base,val); + mBitAttrFlag1 &= ~(int)r; + } + else + { + err = Math::Pow(r, base,(TReal)((int)(mulvisualitem::KMul_n) - i)); + mBitAttrFlag2 &= ~(int)r; + } + } + if(KErrNone != err) + throw std::invalid_argument("Error setting dirty flag for attribute"); +} + + +// --------------------------------------------------------------------------- +// ResetDirtyAttribute +// --------------------------------------------------------------------------- +// +void MulVisualItem::ResetDirtyAttribute(const MulVisualItem& aVisualItem) +{ + mBitAttrFlag1 = aVisualItem.mBitAttrFlag1; + mBitAttrFlag2 = aVisualItem.mBitAttrFlag2; +} +// --------------------------------------------------------------------------- +// Attribute +// --------------------------------------------------------------------------- +// +OSN_EXPORT IMulVariantType* MulVisualItem::Attribute( mulvisualitem::TVisualAttribute aName ) const + { + map::const_iterator findIter = mVisualItem.find( aName ); + if( findIter != mVisualItem.end() ) + { + MulAttribute* attribute = findIter->second; + IMulVariantType* attributeValue = attribute->mValue; + return attributeValue; + } + else + { + //throw std::invalid_argument("Invalid attribute name."); + return NULL; + } + } + +// --------------------------------------------------------------------------- +// AttributeAsInt +// --------------------------------------------------------------------------- +// +OSN_EXPORT int MulVisualItem::AttributeAsInt( mulvisualitem::TVisualAttribute aName ) const + { + IMulVariantType* attributeValue = Attribute(aName); + if( attributeValue ) + { + return attributeValue->integer(); + } + throw std::invalid_argument("Invalid attribute name."); + } + +// --------------------------------------------------------------------------- +// AttributeAsString +// --------------------------------------------------------------------------- +// +OSN_EXPORT const TDesC& MulVisualItem::AttributeAsString( mulvisualitem::TVisualAttribute aName ) const + { + IMulVariantType* attributeValue = Attribute(aName); + if( attributeValue ) + { + return attributeValue->DesC(); + } + throw std::invalid_argument("Invalid attribute name."); + } + +// --------------------------------------------------------------------------- +// ExistingAttributes +// --------------------------------------------------------------------------- +// +OSN_EXPORT const std::vector MulVisualItem::Attributes() const + { + map::const_iterator itr; + std::vector attributesName; + for( itr = mVisualItem.begin(); itr!= mVisualItem.end(); ++itr ) + { + attributesName.push_back( itr->first ); + } + return attributesName; + } + +// --------------------------------------------------------------------------- +// Flag +// --------------------------------------------------------------------------- +// +int MulVisualItem::Flag( mulvisualitem::TVisualAttribute aName ) + { + MulAttribute* attribute = mVisualItem.find( aName )->second; + return attribute->mFlag; + } + +// --------------------------------------------------------------------------- +// RemoveAttribute +// --------------------------------------------------------------------------- +// +void MulVisualItem::RemoveAttribute( mulvisualitem::TVisualAttribute aName ) + { + map::iterator findIter = mVisualItem.find( aName ); + if( findIter != mVisualItem.end() ) + { + delete findIter->second; + findIter->second = NULL; + mVisualItem.erase( aName ); + } + } + + }// namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/bwins/mulloggingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/bwins/mulloggingu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + ?Close@RMulLogClient@@QAEXXZ @ 1 NONAME ; void RMulLogClient::Close(void) + ?CommitToFileL@RMulLogManager@@QAEXABVTDesC16@@@Z @ 2 NONAME ; void RMulLogManager::CommitToFileL(class TDesC16 const &) + ?CreateL@RMulLogManager@@QAEXXZ @ 3 NONAME ; void RMulLogManager::CreateL(void) + ?Open@RMulLogClient@@QAEHVTObjectId@@@Z @ 4 NONAME ; int RMulLogClient::Open(class TObjectId) + ?Release@RMulLogManager@@QAEXXZ @ 5 NONAME ; void RMulLogManager::Release(void) + ?Write@RMulLogClient@@QAEXABVTDesC8@@@Z @ 6 NONAME ; void RMulLogClient::Write(class TDesC8 const &) + ?WriteFormat@MulLogger@@YAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 7 NONAME ; void MulLogger::WriteFormat(class TRefByValue, ...) + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/eabi/mulloggingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/eabi/mulloggingu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + _ZN13RMulLogClient4OpenE9TObjectId @ 1 NONAME + _ZN13RMulLogClient5CloseEv @ 2 NONAME + _ZN13RMulLogClient5WriteERK6TDesC8 @ 3 NONAME + _ZN14RMulLogManager13CommitToFileLERK7TDesC16 @ 4 NONAME + _ZN14RMulLogManager7CreateLEv @ 5 NONAME + _ZN14RMulLogManager7ReleaseEv @ 6 NONAME + _ZN9MulLogger11WriteFormatE11TRefByValueIK6TDesC8Ez @ 7 NONAME + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006-2007 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: Logging client side + * +*/ + + + +PRJ_PLATFORMS + +ARMV5 WINSCW +PRJ_MMPFILES +mullogging.mmp \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/group/mullogging.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/group/mullogging.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006 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: MMP for Logging utility +* +*/ + +#include + +#include +#include + +TARGET mullogging.dll +TARGETTYPE dll +UID 0x1000008d 0x2000FA89 + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE mullogger.cpp +SOURCE mullogchunk.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/inc/mullog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/inc/mullog.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,419 @@ +/* +* Copyright (c) 2006-2008 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: Logging macros +* +*/ + + +#ifndef MULLOG_H +#define MULLOG_H + +// log on debug builds because of performance +#ifdef _DEBUG +#define MUL_LOGGING_ENABLED +#endif + +#ifndef MUL_LOGGING_ENABLED + + // empty declarations to clean up code + #define MUL_LOG_ENTRY_EXIT( s ) + #define MUL_LOG_ENTRY_EXIT_LEAVE_L( s ) + #define MUL_LOG_INFO( s ) + #define MUL_LOG_INFO1( s, i ) + #define MUL_LOG_INFO2( s, i, j ) + #define MUL_LOG_INFO3( s, i, j, k ) + #define MUL_LOG_INFO4( s, i, j, k, l ) + #define MUL_LOG_INFO5( s, i, j, k, l, m ) + #define MUL_LOG_WARNING( s ) + #define MUL_LOG_WARNING1( s, i ) + #define MUL_LOG_WARNING2( s, i, j ) + #define MUL_LOG_WARNING3( s, i, j, k ) + #define MUL_LOG_ERROR( s ) + #define MUL_LOG_ERROR1( s, i ) + #define MUL_LOG_ERROR2( s, i, j ) + #define MUL_LOG_ERROR3( s, i, j, k ) + #define MUL_FUNC( s ) + #define MUL_FUNCL( s ) + #define MUL_DEBUG1( s ) + #define MUL_DEBUG2( s, i ) + #define MUL_DEBUG3( s, i, j ) + #define MUL_DEBUG4( s, i, j, k ) + #define MUL_DEBUG5( s, i, j, k, l ) + +#else + +// only include headers if logging is enabled +#include +#include +#include "mullogger.h" + + + /** + * Helper macro for defining debug string with filename + * Note! this is internal so dont use outside this header + */ + #ifdef __arm__ + // use the module name instead as its the filename without path + #define MUL_DEBUG_STR( cat, str ) __MODULE__ "(%d) : " ##cat " : " ##str + #else + // put full file paths off for __FILE__ macro to make the log entries shorter + #pragma fullpath_file off + #define MUL_DEBUG_STR( cat, str ) __FILE__ "(%d) : " ##cat " : " ##str + #endif + + /** + * Helper macro for defining debug string with filename and linenumber + * @param category the category string for the log entry + * @param string the string for the log entry + * Note! this is internal so dont use outside this header + */ + #define MUL_DEBUG_LINE( category, string ) \ + TPtrC8((const TText8*) MUL_DEBUG_STR( category, string ) ), __LINE__ + + /** + * Output to mul logger + * Note! this is internal so dont use outside this header + */ + #define MUL_DEBUG_PRINT MulLogger::WriteFormat + + // LOGGING MACROS + /** + * Logs the entry and exit point of the function + * Does not log the filename nor linenumber as inlining does not work + * if you want to log the filename and linenumber, + * use MUL_LOG_INFO macros instead + * Example usage: + * MUL_LOG_ENTRY_EXIT( "CFoo::Bar()" ); + * @param a string to be added to the log + */ + #define MUL_LOG_ENTRY_EXIT( s ) TMulFunctionTrace _tracer( _L8( s ) ) + + /** + * Logs the entry, exit and possible leave point of the function. + * Note! cannot be used in a non leaving function or inside a LC function + * as this macro uses the cleanup stack + * Does not log the filename nor linenumber as inlining does not work + * if you want to log the filename and linenumber, + * use MUL_LOG_INFO macros instead + * Example usage: + * MUL_LOG_ENTRY_EXIT_LEAVE_L( "CFoo::Bar()" ); + * @param a string to be added to the log + * @deprecated use MUL_LOG_ENTRY_EXIT instead as it also detects leave and does not require cleanupstack to work + */ + #define MUL_LOG_ENTRY_EXIT_LEAVE_L( s ) \ + TMulFunctionTraceWithLeaveDetection _tracer( _L8( s ) ); \ + CleanupClosePushL( _tracer ) + + /** + * Logs a single line of information and the filename and linenumber + * Example usage: + * MUL_LOG_INFO( "CFoo::Bar()" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define MUL_LOG_INFO( s ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ) ) + + /** + * Logs a single line of information with one parameter + * and the filename and linenumber + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * Example usage: + * MUL_LOG_INFO1( "CFoo::Bar(%d)", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_INFO1( s, i ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ), i ) + + /** + * Logs a single line of information with two parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_INFO2( "CFoo::Bar(%d,%f)", aInt, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_INFO2( s, i, j ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ), i, j ) + + /** + * Logs a single line of information with three parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_INFO3( "CFoo::Bar(%d,%S,%f)", aInt, &aDesC, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_INFO3( s, i, j, k ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ), i, j, k ) + + /** + * Logs a single line of information with four parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_INFO4( "CFoo::Bar(%d,%f,%S,%s)", aInt, aFloat, "string" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + * @param l, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_INFO4( s, i, j, k, l ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ), i, j, k, l ) + + /** + * Logs a single line of information with five parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_INFO5( + * "CFoo::Bar(%.1f,%.2f,%.3f,%.4f,%.5f)", aFloat1, aFloat2, aFloat3, aFloat4, aFloat5 ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + * @param l, value to be inserted to the string, can be of any type + * @param m, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_INFO5( s, i, j, k, l, m ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "info", s ), i, j, k, l, m ) + + /** + * Logs a single line of warning and the filename and linenumber + * Example usage: + * MUL_LOG_WARNING( "Incorrect state, resetting state" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define MUL_LOG_WARNING( s ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "warning", s ) ) + + /** + * Logs a single line of warning with one parameter + * and the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_WARNING1( "Incorrect parameter %d", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_WARNING1( s, i ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "warning", s ), i ) + + /** + * Logs a single line of warning with two parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_WARNING2( "Incorrect parameter %f, defaulting to %f", aInputFloat, KDefaultFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_WARNING2( s, i, j ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "warning", s ), i , j ) + + /** + * Logs a single line of warning with three parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_WARNING3( "Incorrect size (%d,%d), scale is %f", aWidth, aHeight, aScale ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_WARNING3( s, i, j, k ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "warning", s ), i, j, k ) + + /** + * Logs a single line of error and the filename and linenumber. + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_ERROR( "Incorrect state, going to panic" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define MUL_LOG_ERROR( s ) MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "error", s ) ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_ERROR1( "Incorrect parameter %d, panicing", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_ERROR1( s, i ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "error", s ), i ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_ERROR2( "Incorrect size (%d,%d), panicking", aWidth, aHeight ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_ERROR2( s, i, j ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "error", s ), i, j ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * MUL_LOG_ERROR3( "Incorrect state %d,%d,%f, panicking", aInt, aInt2, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define MUL_LOG_ERROR3( s, i, j, k ) \ + MUL_DEBUG_PRINT( MUL_DEBUG_LINE( "error", s ), i, j, k ) + + // Old macros for compatibility + ///@deprecated, use MUL_LOG_ENTRY_EXIT instead + #define MUL_FUNC( s ) MUL_LOG_ENTRY_EXIT( s ) + ///@deprecated, use MUL_LOG_ENTRY_EXIT_LEAVE_L instead + #define MUL_FUNCL( s ) MUL_LOG_ENTRY_EXIT_LEAVE_L( s ) + ///@deprecated, use MUL_LOG_INFO instead + #define MUL_DEBUG1( s ) MUL_LOG_INFO( s ) + ///@deprecated, use MUL_LOG_INFO1 instead + #define MUL_DEBUG2( s, i ) MUL_LOG_INFO1( s, i ) + ///@deprecated, use MUL_LOG_INFO2 instead + #define MUL_DEBUG3( s, i, j ) MUL_LOG_INFO2( s, i, j ) + ///@deprecated, use MUL_LOG_INFO3 instead + #define MUL_DEBUG4( s, i, j, k ) MUL_LOG_INFO3( s, i, j, k ) + ///@deprecated, use MUL_LOG_INFO4 instead + #define MUL_DEBUG5( s, i, j, k, l ) MUL_LOG_INFO4( s, i, j, k, l ) + + /** + * TRAP instrumentation for Leave + */ + #undef TRAP_INSTRUMENTATION_LEAVE + #define TRAP_INSTRUMENTATION_LEAVE( aResult ) \ + MUL_LOG_INFO1( "Leave %d TRAPPED", aResult ) + + /** + * Helper class to track function entry and exit. + */ + class TMulFunctionTrace + { + public: + inline TMulFunctionTrace( TRefByValue< const TDesC8 > aName ) + : iStr( aName ) + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Entry : %S" ), &iStr ); + } + inline ~TMulFunctionTrace() + { + if( std::uncaught_exception() ) + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Leave: %S" ), &iStr ); + } + else + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Exit : %S" ), &iStr ); + } + } + private: + TPtrC8 iStr; + }; + + /** + * Helper class to track function entry, exit and possible leave. + * Never instantiate this class by itself. + * Only ever user the macro MUL_FUNCL as this calls CleanupClosePushL + * If you don't use the macro the destructor will panic in CleanupStack::Pop( this ) + * DO NOT use this in a LC method such as NewLC. + * Cleanup stack will be popped in the wrong order causing unwanted behaviour + */ + class TMulFunctionTraceWithLeaveDetection + { + public: + inline TMulFunctionTraceWithLeaveDetection( TRefByValue aName ) + : iStr( aName ), iLeave( EFalse ) + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Entry : %S" ), &iStr ); + } + inline ~TMulFunctionTraceWithLeaveDetection() + { + // Did we leave + if( iLeave ) + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Leave : %S" ), &iStr ); + } + else + { + // not using MUL_DEBUG2 as this function does not inline + MUL_DEBUG_PRINT( _L8( "Exit : %S" ), &iStr ); + // Remove this from Cleanup. + CleanupStack::Pop( this ); + } + } + void Close() // This is only called if a leave happens. + { + iLeave = ETrue; + } + private: + TPtrC8 iStr; + TBool iLeave; + }; + +#endif // MULLOG_H + +#endif // +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/inc/mullogchunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/inc/mullogchunk.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2006-2007 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: Logging to chunk wrapper for MC Photos +* +*/ + + +#ifndef T_MULLOGCHUNK_H +#define T_MULLOGCHUNK_H + +// EXTERNAL INCLUDES +#include +#include + +/** + * RMulLogUtility. + * Encapsulates the use of RChunk for log writing + */ +NONSHARABLE_CLASS( RMulLogUtility ) + { + public: + /** + * Opens the log chunk with given name + * @param aName, the full name of the chunk + * @param aReadOnly, whether to open in readonly or read-write + */ + TInt Open( const TDesC& aName, TBool aReadOnly ); + + /** + * Creates the log chunk with given name + * @param aName, the full name of the chunk + */ + void CreateL( const TDesC& aName ); + + /** + * Closes the opened chunk. This needs to be called + * before an object of this class goes out of scope + */ + void Close(); + + /** + * @return the size of the log chunk + */ + TInt ChunkSize(); + + /** + * @return the chunk unique Id (set by client) + */ + TObjectId Id(); + + /** + * Sets the unique id for the log chunk + * @param aId the id to set for the chunk + */ + void SetId( TObjectId aId ); + + /** + * @return Current chunk write address + */ + TUint8* CurrentAddress(); + + /** + * Sets the current write address + * @param New write address + */ + void SetCurrentAddress( TUint8* aValue ); + + /** + * @return Last address written to file + */ + TUint8* LastLoggedAddress(); + + /** + * Sets the last logged address + * @param New last logged address + */ + void SetLastLoggedAddress( TUint8* aValue ); + + /** + * @return The topmost writable address of the chunk + */ + TUint8* BaseAddress(); + + /** + * @return The bottom most writable address of the chunk + */ + TUint8* LastAddress(); + + private: + + /// Own: chunk to write to + RChunk iChunk; + }; + +/** + * RMulLogClient. + * Client API for log writing to chunk + */ +NONSHARABLE_CLASS( RMulLogClient ) + { + public: + + /** + * Opens the log chunk with the given unique id + * @param aId unique id for the log writing thread + */ + IMPORT_C TInt Open( TObjectId aId ); + + /** + * Closes the log handle, needs to be called before an + * object of this class goes out of scope + */ + IMPORT_C void Close(); + + /** + * Writes a descriptor to the log + * @param aLogEntry the log entry to write + */ + IMPORT_C void Write( const TDesC8& aLogEntry ); + + private: + + /// Own: log utility + RMulLogUtility iLogUtility; + + }; + +/** + * RMulLogManager. + * Management API for log creation and committing to file + */ +NONSHARABLE_CLASS( RMulLogManager ) + { + public: + + /** + * Creates the log chunks + */ + IMPORT_C void CreateL(); + + /** + * Releases the log chunks + */ + IMPORT_C void Release(); + + /** + * Writes the log to a file + * One file is created per chunk. + * @param aFolder the directory where to store the logs + */ + IMPORT_C void CommitToFileL( const TDesC& aFolder ); + + private: + + // helper method to write all descriptors of a chunk to a + // file + void CommitToFileL( RMulLogUtility& aUtility, RFile& aFile ); + + private: + + /// Own: log utility + RMulLogUtility iLogUtility1; + /// Own: log utility + RMulLogUtility iLogUtility2; + /// Own: file server handle + RFs iFs; + + }; + +#endif // T_MULLOGCHUNK_H + + \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/inc/mullogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/inc/mullogger.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006-2007 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: Logging utility for MUL +* +*/ + + +#ifndef T_MULLOGGER_H +#define T_MULLOGGER_H + +// CLASS HEADER +#include "mullogger.h" + +// EXTERNAL INCLUDES +#include + +namespace MulLogger + { + /** + * Logging utility, writes the given log to a shared chunk if the chunk + * exists or to RDebug if not. + * Note! due to performance reasons only 8 bit descriptor allowed + * @param The descriptor containing the format string. + * @param The arguments to append to the format string (ellipsis notation) + */ + IMPORT_C void WriteFormat( TRefByValue aFmt, ... ); + } + +#endif // T_MULLOGGER_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/src/mullogchunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/src/mullogchunk.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,451 @@ +/* +* Copyright (c) 2006-2007 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: Logging to chunk wrappe for Mul +* +*/ + + +// CLASS HEADER +#include "mullogchunk.h" + +// EXTERNAL INCLUDES +#include + +// LOCAL DECLARATIONS +namespace + { + // size for the chunks + const TInt KLogChunkSize = 1000000; // 1 million bytes + // name for chunk 1 + _LIT( KLogChunk1Name, "MUL_Logchunk1" ); + // name for chunk 2 + _LIT( KLogChunk2Name, "MUL_Logchunk2" ); + // extension for log file + _LIT( KLogFileExtension, ".log" ); + // carriage return / line feed + _LIT8( KLogCR, "\r" ); + _LIT8( KLogLF, "\n" ); + // constant for machine word alignment + const TInt KBytesInAWord = sizeof( TInt32 ); + } + +inline void Panic(TInt aReason) + { + _LIT(applicationName,"Mul Logging"); + User::Panic(applicationName, aReason); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::Open +// ----------------------------------------------------------------------------- +TInt RMulLogUtility::Open( const TDesC& aName, TBool aReadOnly ) + { + // open the chunk + return iChunk.OpenGlobal( aName, aReadOnly ); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::CreateL +// ----------------------------------------------------------------------------- +void RMulLogUtility::CreateL( const TDesC& aName ) + { + // create the chunk, leave if error + TInt error = iChunk.CreateGlobal( aName, KLogChunkSize, KLogChunkSize ); + // dont treate already exists as an error + if( KErrAlreadyExists == error ) + { + // open in read-write + User::LeaveIfError( iChunk.OpenGlobal( aName, EFalse ) ); + } + else + { + User::LeaveIfError( error ); + } + + // initialise the iChunk to all zeros. + Mem::FillZ( iChunk.Base(), iChunk.Size() ); + // initialise current address to base + SetCurrentAddress( BaseAddress() ); + // initialise last logged address to base + SetLastLoggedAddress( BaseAddress() ); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::Close +// ----------------------------------------------------------------------------- +void RMulLogUtility::Close() + { + iChunk.Close(); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::ChunkSize +// ----------------------------------------------------------------------------- +TInt RMulLogUtility::ChunkSize() + { + return iChunk.Size(); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::Id +// ----------------------------------------------------------------------------- +TObjectId RMulLogUtility::Id() + { + // take chunk base address + TUint8* ptr_in_chunk = iChunk.Base(); + // cast that to TObjectId* + TObjectId* ptr_as_tobjectid = reinterpret_cast< TObjectId* >( ptr_in_chunk ); + // return the id + return *ptr_as_tobjectid; + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::SetId +// ----------------------------------------------------------------------------- +void RMulLogUtility::SetId( TObjectId aId ) + { + // take chunk base address + TUint8* ptr_in_chunk = iChunk.Base(); + // cast that to TObjectId* + TObjectId* ptr_as_tobjectid = reinterpret_cast< TObjectId* >( ptr_in_chunk ); + // assign the id in place + *ptr_as_tobjectid = aId; + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::CurrentAddress +// ----------------------------------------------------------------------------- +TUint8* RMulLogUtility::CurrentAddress() + { + // take chunk base address plus object id + TUint8* ptr_in_chunk = iChunk.Base() + sizeof( TObjectId ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // dereference that pointer to read the 32 bits that are the address + TUint32 value_of_pointer = *ptr_as_tint; + // then return the value as TUint8* + return reinterpret_cast< TUint8* >( value_of_pointer ); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::SetCurrentAddress +// ----------------------------------------------------------------------------- +void RMulLogUtility::SetCurrentAddress( TUint8* aValue ) + { + // take chunk base address plus object id + TUint8* ptr_in_chunk = iChunk.Base() + sizeof( TObjectId ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // assign the addres to TInt + TUint32 new_value = reinterpret_cast< TUint32 >( aValue ); + // ensure we're byte aligned - ARM requires 32 bit alignment to machine word + // boundary!! + TInt remainder = new_value % KBytesInAWord; + if ( remainder > 0 ) + { + new_value += ( KBytesInAWord - remainder ); + } + // set the new value to the chunk + *ptr_as_tint = new_value; + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::LastLoggedAddress +// ----------------------------------------------------------------------------- +TUint8* RMulLogUtility::LastLoggedAddress() + { + // take chunk base address plus object id plus one pointer + TUint8* ptr_in_chunk = + iChunk.Base() + sizeof( TObjectId ) + sizeof( TUint8* ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // dereference that pointer to read the 32 bits that are the address + TUint32 value_of_pointer = *ptr_as_tint; + // then return the value as TUint8* + return reinterpret_cast< TUint8* >( value_of_pointer ); + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::SetLastLoggedAddress +// ----------------------------------------------------------------------------- +void RMulLogUtility::SetLastLoggedAddress( TUint8* aValue ) + { + // take chunk base address plus object id plus one pointer + TUint8* ptr_in_chunk = + iChunk.Base() + sizeof( TObjectId ) + sizeof( TUint8* ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // assign the addres to TInt + TUint32 new_value = reinterpret_cast< TUint32 >( aValue ); + // ensure we're byte aligned - ARM requires 32 bit alignment to machine word + // boundary!! + TInt remainder = new_value % KBytesInAWord; + if ( remainder > 0 ) + { + new_value += ( KBytesInAWord - remainder ); + } + // set the new value to the chunk + *ptr_as_tint = new_value; + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::BaseAddress +// ----------------------------------------------------------------------------- +TUint8* RMulLogUtility::BaseAddress() + { + // take chunks base address + TUint8* base = iChunk.Base(); + // calculate the topmost write address, our header is + // TObjectId and two TUint8* + return base + sizeof( TObjectId ) + sizeof( TUint8* ) * 2; + } + +// ----------------------------------------------------------------------------- +// RMulLogUtility::LastAddress +// ----------------------------------------------------------------------------- +TUint8* RMulLogUtility::LastAddress() + { + // return chunks base address plus its size + return iChunk.Base() + iChunk.Size(); + } + +// ----------------------------------------------------------------------------- +// RMulLogClient::Open +// ----------------------------------------------------------------------------- +EXPORT_C TInt RMulLogClient::Open( TObjectId aId ) + { + // try to open first log chunk, in read-write mode + TInt err = iLogUtility.Open( KLogChunk1Name(), EFalse ); + if ( err != KErrNone ) + { + return err; + } + // check id + TObjectId id = iLogUtility.Id(); + if ( id == TObjectId( 0 ) ) + { + // no id set, so reserve this for us and use this chunk + iLogUtility.SetId( aId ); + } + // check if our id was there? + else if( id != aId ) + { + // not our chunk, try second chunk in read-write mode + err = iLogUtility.Open( KLogChunk2Name(), EFalse ); + if ( err != KErrNone ) + { + return err; + } + // check id + id = iLogUtility.Id(); + if ( id == TObjectId( 0 ) ) + { + // no id, reserve this for us and use this chunk + iLogUtility.SetId( aId ); + } + else if ( id != aId ) + { + // both chunks already reserved, return error + return KErrNotFound; + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// RMulLogClient::Close +// ----------------------------------------------------------------------------- +EXPORT_C void RMulLogClient::Close() + { + iLogUtility.Close(); + } + +// ----------------------------------------------------------------------------- +// RMulLogClient::Write +// ----------------------------------------------------------------------------- +EXPORT_C void RMulLogClient::Write( const TDesC8& aLogEntry ) + { + // get the size of log entry (in bytes) + TInt num_bytes = aLogEntry.Size(); + // take current address and chunk size to ensure log entry fits + TUint8* current_address = iLogUtility.CurrentAddress(); + // calculate the new current address, we write the size and the data + TUint8* after_write = current_address + num_bytes + sizeof( TInt ); + // chck that we fit + if( after_write >= iLogUtility.LastAddress() ) + { + // we dont fit in the end + // need to mark the old current_address so that + // manager knows we jumped to the start + TInt* last_indicator_ptr = + reinterpret_cast< TInt* >( current_address ); + // assign KErrNotFound there + *last_indicator_ptr = KErrNotFound; + // write this entry to the base address + current_address = iLogUtility.BaseAddress(); + } + // we need to store the size in the chunk first so take a TInt* + TInt* size_ptr = reinterpret_cast< TInt* >( current_address ); + // assign new value in place + *size_ptr = num_bytes; + // increase address + current_address += sizeof( TInt ); + // copy the data, first target, then source and last number of bytes + Mem::Copy( current_address, aLogEntry.Ptr(), num_bytes ); + // and set the new current address + iLogUtility.SetCurrentAddress( current_address + num_bytes ); + } + +// ----------------------------------------------------------------------------- +// RMulLogManager::CreateL +// ----------------------------------------------------------------------------- +EXPORT_C void RMulLogManager::CreateL() + { + // connect to the file server + User::LeaveIfError( iFs.Connect() ); + + // create two log chunks + iLogUtility1.CreateL( KLogChunk1Name ); + iLogUtility2.CreateL( KLogChunk2Name ); + } + +// ----------------------------------------------------------------------------- +// RMulLogManager::Release +// ----------------------------------------------------------------------------- +EXPORT_C void RMulLogManager::Release() + { + // close file server handle + iFs.Close(); + + // release both log chunks + iLogUtility1.Close(); + iLogUtility2.Close(); + } + +// ----------------------------------------------------------------------------- +// RMulLogManager::CommitToFileL +// ----------------------------------------------------------------------------- +EXPORT_C void RMulLogManager::CommitToFileL( const TDesC& aFolder ) + { + // open the file + RFile file; + CleanupClosePushL( file ); + + // chunk1 + // create the file name + TFileName fileName; + fileName = aFolder; + fileName.Append( KLogChunk1Name ); + fileName.Append( KLogFileExtension ); + // try to open the file + TInt err = file.Open( iFs, fileName, EFileWrite ); + if ( err == KErrNotFound ) + { + // file doesn't exist so create it + err = file.Create( iFs, fileName, EFileWrite ); + } + User::LeaveIfError( err ); + // write the first chunk to file + CommitToFileL( iLogUtility1, file ); + // close the file + file.Close(); + + // chunk2 + // reset the file name + fileName.Zero(); + // create the file name + fileName = aFolder; + fileName.Append( KLogChunk2Name ); + fileName.Append( KLogFileExtension ); + // try to open the file + err = file.Open( iFs, fileName, EFileWrite ); + if ( err == KErrNotFound ) + { + // file doesn't exist so create it + err = file.Create( iFs, fileName, EFileWrite ); + } + User::LeaveIfError( err ); + // write the second chunk to file + CommitToFileL( iLogUtility2, file ); + + CleanupStack::PopAndDestroy( &file ); + } + +// ----------------------------------------------------------------------------- +// RMulLogManager::CommitToFileL +// ----------------------------------------------------------------------------- +void RMulLogManager::CommitToFileL( RMulLogUtility& aUtility, RFile& aFile ) + { + // Need to explicitly move to the end of the file as it's not done + // automatically on call to Write + TInt pos = 0; + TInt err = aFile.Seek( ESeekEnd, pos ); + User::LeaveIfError( err ); + TPtr8 logEntryPtr( 0, 0 ); + TInt logEntrySize = 0; + + // what's previously been logged to the file? + TUint8* lastLoggedAddress = aUtility.LastLoggedAddress(); + + // how much more has been added to the chunk? + TUint8* currentAddress = aUtility.CurrentAddress(); + + // write each of the chunk's logged entries to the file + TInt32* sizePtr = NULL; + while ( currentAddress != lastLoggedAddress && err == KErrNone ) + { + // get the logEntry's size + sizePtr = reinterpret_cast< TInt32* >( lastLoggedAddress ); + logEntrySize = *sizePtr; + if ( logEntrySize == KErrNotFound ) + { + // logged entries have wrapped around the end of the chunk + // so start from the beginning + lastLoggedAddress = aUtility.BaseAddress(); + sizePtr = reinterpret_cast< TInt32* >( lastLoggedAddress ); + logEntrySize = *sizePtr; + } + // set an error - this will be reset to KErrNone if we succeed + // with finding and writing a log entry + err = KErrNotFound; + if ( logEntrySize > 0 ) + { + // move the current address to the data + lastLoggedAddress += sizeof( TInt32 ); + // extract the log entry's data + logEntryPtr.Set( lastLoggedAddress, logEntrySize, logEntrySize ); + // write the log entry to the file + err = aFile.Write( logEntryPtr ); + // append carriage return and line feed to the entry + err = aFile.Write( KLogCR ); + err = aFile.Write( KLogLF ); + // ensure we align to a multiple of a 4-byte boundary + TInt remainder = logEntrySize % KBytesInAWord; + if ( remainder > 0 ) + { + // not aligned so add some padding + logEntrySize += ( KBytesInAWord - remainder ); + } + + // update the last logged address + lastLoggedAddress += logEntrySize; + } + } + // update the last logged address + aUtility.SetLastLoggedAddress( lastLoggedAddress ); + // + // commit the data + err = aFile.Flush(); + User::LeaveIfError( err ); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mullogging/src/mullogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mullogging/src/mullogger.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006-2007 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: Logging utility for MC Photos +* +*/ + + +// CLASS HEADER +#include "mullogger.h" + +// EXTERNAL INCLUDES +#include +//#include + +// INTERNAL INCLUDES +//#include "mullogchunk.h" + +namespace MulLogger + { + /// constants + const TInt KMaxLoggingBufferLength = 256; + + +/** + * TDes overflow handler + * Default overflow handler panics and we dont want to do + * that in logging so need to implement our own handler. + */ +class TDes8OverFlowHandler : public TDes8Overflow + { + public: // from TDes8Overflow + /// @ref TDes8Overflow::Overflow + void Overflow( TDes8& /*aDes*/ ) + { + // do nothing, we cant allocate so just eat the error + } + }; + +// ----------------------------------------------------------------------------- +// MulLogger::WriteFormat +// ----------------------------------------------------------------------------- +EXPORT_C void WriteFormat( TRefByValue< const TDesC8 > aFmt, ... ) + { + /// writeable buffer, in emulator this is in stack + TBuf8< KMaxLoggingBufferLength > gWriteBuffer; + // take the ellipsis parameter + VA_LIST args; + VA_START( args, aFmt ); + // create overflow handler + TDes8OverFlowHandler overflowhandler; + // clear old data by setting length to zero + gWriteBuffer.SetLength( 0 ); + // append the parameters to the descriptor + gWriteBuffer.AppendFormatList( aFmt, args, &overflowhandler ); + // end the ellipsis handling + VA_END( args ); + + TBuf16<256> buffer; + buffer.Copy(gWriteBuffer); + RDebug::Print(_L("MUL:-%S"),&buffer); + + } // namespace + +} // namespace diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_cover_handle.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/mui_cover_handle.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_dl_progress_lsc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/mui_dl_progress_lsc.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_handle.png Binary file mulwidgets/mulsliderwidget/data/mui_handle.png has changed diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_slider_lsc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/mui_slider_lsc.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_slider_progress.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/mui_slider_progress.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/mui_slider_prt.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/mui_slider_prt.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_slider_zoom_in.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_slider_zoom_in.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_slider_zoom_out.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_slider_zoom_out.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_audio_off.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_audio_off.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_audio_on.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_audio_on.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_minus.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_minus.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_plus.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/data/qgn_indi_volumeslider_plus.svg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007-2008 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: Build information file for Slider widget component +* +*/ + +#include + +PRJ_PLATFORMS + +ARMV5 WINSCW + + +PRJ_EXPORTS +../rom/mulsliderwidget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mulsliderwidget.iby) + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE mulsliderwidget.mif +OPTION HEADERFILE mulsliderwidget.mbg +OPTION SOURCEFILE iconlist.txt +END + +PRJ_MMPFILES + +mulsliderwidget.mmp + +PRJ_TESTMMPFILES + + + + +PRJ_TESTEXPORTS diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/group/iconlist.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/group/iconlist.txt Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,2 @@ +-c24,8 qgn_indi_nslider_zoom_in +-c24,8 qgn_indi_nslider_zoom_out \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/group/mulsliderwidget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/group/mulsliderwidget.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ +#include +//#include "../../../group/stdinc.mmh" //for STL includes +#define ALF_LINK_STDCPP_DLL + +TARGET mulsliderwidget.dll +TARGETTYPE PLUGIN + +UID 0x10009d8d 0x2000FA7F + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + + + +SOURCEPATH ../src +SOURCE mulsliderwidgetfactoryplugin.cpp +SOURCE mulsliderwidget.cpp +SOURCE mulslidercontrol.cpp +SOURCE mulslidermodel.cpp +SOURCE mulprogressbarslider.cpp +SOURCE mulhorizontalslider.cpp +SOURCE mulsliderlongtaptimer.cpp +SOURCE mulverticalslider.cpp +SOURCE mulsliderutils.cpp + +USERINCLUDE ../../common/inc +USERINCLUDE ../../muldatamodel/inc +USERINCLUDE ../inc +USERINCLUDE ../../mullogging/inc +USERINCLUDE ../../../inc + +MW_LAYER_SYSTEMINCLUDE +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY osncore.lib +LIBRARY alfclient.lib +LIBRARY alfwidgetmodel.lib +LIBRARY alfwidgetutils.lib +LIBRARY charconv.lib +LIBRARY libc.lib +LIBRARY libstdcpp.lib +LIBRARY cone.lib +LIBRARY gdi.lib +LIBRARY libpthread.lib +LIBRARY aknlayout2hierarchy.lib +LIBRARY aknlayout2scalable.lib +LIBRARY avkon.lib +LIBRARY cdlengine.lib +LIBRARY mulutility.lib +LIBRARY mulmodelutility.lib +LIBRARY aknicon.lib +LIBRARY aknskins.lib +LIBRARY fbscli.lib +LIBRARY touchfeedback.lib + + +LANG SC +START RESOURCE 2000FA7F.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET mulsliderwidget.rsc +#endif +END diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/imulsliderbaseelementinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/imulsliderbaseelementinternal.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007 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: interface for the slider base element internal functions. + * +*/ + +#ifndef I_MULSLIDERBASEELEMENTINTERNAL_H +#define I_MULSLIDERBASEELEMENTINTERNAL_H + +//Widget Model include +#include + +//Toolkit include +#include +#include +#include +namespace Alf + { + enum SliderLCTIDs + { + EHSliderPane,// horizontal slider aacf_slider_pane(0) for base layout + EHSliderBase, + EHSliderCentre, + EHSliderCenter,// horizontal slider aaslider_bg_pane(0) for track + EHSliderRight, + EHSliderLeft, + EHSliderHandle,// horizontal slider aacf_slider_pane_g1(0) for thumb + EHSliderHandleExtended, + EVSliderPane, // vertical slider aaslider_pane(2) for mainlayout + EVSliderBackground, // vertical slider aaslider_pane_g1(2) for mainlayout + EVSliderBgPane , // aaslider_bg_pane_cp001 + EVSliderTop , + EVSliderMiddle , + EVSliderEnd , + EVSliderPlus, //aid_touch_size_slider_max + EVSliderMinus, //aid_touch_size_slider_min + EVSliderMarker, //aacf_slider_pane_g1 + EVSliderMarkerExtended, + EVSliderZoomText, //aaslider_pane_t3 + EVSliderAudioImage, + EVSliderInnerRect, + EPSliderLeft, + EPSliderCentre, + EPSliderRight + }; +enum TOperation +{ +ENop, // Nothing is going on. +EMoveItem // Item is begin moved. +}; +/** + * @namespace mulsliderbaseelementinternal + * + * internal interface. + */ +namespace mulsliderbaseelementinternal + { + static const IfId ident = + { + 0,"mulsliderbaseelementinternal" + }; + } + + +class IMulSliderBaseElementInternal : public IAlfInterfaceBase + { + +public: + + + static inline const IfId& type() + { + return mulsliderbaseelementinternal :: ident; + } + + /** + * Notified when the base layout of Slider changes . + * Relayouts all the visuals with respect to the new size. + */ + + virtual void baseLayoutSizeChanged()=0; + /** + * Creates the Visualization of Slider + * + */ + + virtual void createVisualization(sliderTemplate aTemplate) = 0; + /** + * Updates the Visualization of Slider + * + */ + + virtual void updateVisualization() = 0; + /** + * Updates the Text Visualization of Slider + * + */ + + virtual void updateTextVisualization() = 0; + /** + * Stops all the event handling operations + * + */ + + virtual void stopEvents() + { + + } + /** + * API to make the widget transparent. + * @param aTransparent - True will make it transparent. + * - False for Opaque. + */ + + virtual void MakeTransparent( bool /*aTransparent*/ ) + { + + } + /** + * API to Handle Long Tap events. + */ + virtual AlfEventStatus handleLongTap() + { + return EEventNotHandled; + } + + /** + *virtual Destructor. + * + */ + virtual ~IMulSliderBaseElementInternal() {} + + }; // end of class IMulSliderBaseElementInternal + + } // end of namespace Alf + +#endif // I_MULSLIDERBASEELEMENTINTERNAL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulprogressbarslider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulprogressbarslider.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2007 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: Header for slider presentation elements. + * +*/ + + +#ifndef MUL_SLIDERPROGRESSIVE_H +#define MUL_SLIDERPROGRESSIVE_H + +//INCLUDES + +#include "alf/alfelement.h" +#include "mulslidermodel.h" +#include "imulsliderbaseelementinternal.h" +#include +#include +namespace Alf + { + class CAlfWidgetControl; + /** + * Default Base Element of the slider. + */ + class MulSliderProgressive : + public AlfElement, + public IAlfWidgetEventHandler, + public IMulSliderBaseElementInternal, + public MAlfBitmapProvider + { + public: + /** + * Constructor + * @param aControl Widget control. + * @param aName Name of the item element. + * @param aCustomData . + * @param mNode . + * @since S60 ?S60_version + */ + MulSliderProgressive ( + CAlfWidgetControl& aControl, + const char* aName, AlfCustomInitDataBase* /*aCustomData*/); + /** + * Destructor + */ + virtual ~MulSliderProgressive(); + + /** + * bitmap provider. + * @since S60 ?S60_version + * @param aId bitmap ID. + * @param aBitmap bitmap. + * @param aMaskBitmap mask for the bitmap. + * @return + */ + void ProvideBitmapL (TInt aId, + CFbsBitmap *& aBitmap, + CFbsBitmap *& aMaskBitmap); + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the widget class. + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried + * interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerType eventHandlerType(); + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerExecutionPhase eventExecutionPhase(); + + + //-------------------------------------------------------------------------- + //Overriden Apis from IAlfWidgetEventHandlers + //-------------------------------------------------------------------------- + // + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. + * Pointer event handlers cannot be identified directly, + * since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to + * simulate the actual pointer event. + * @since S60 ?S60_version + * @param aEvent The event. + * @param aControl + * @return ETrue if the event can be processed. + * Otherwise EFalse. + */ + bool accept( + CAlfWidgetControl& aControl, const TAlfEvent& aEvent) const; + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return ETrue if the event was processed. + * Otherwise EFalse. + */ + virtual AlfEventStatus offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ); + /** + * Defines the widget states, where the event handler is active. + * By default, if this method + * is not called, the event handler is expected + * to be active in all states. + * @param aStates A bitmask defining the widget + * states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . + * The high 16 bits are + * available for states defined by the client code. + */ + void setActiveStates(unsigned int aStates); + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * @param aData A data structure which contains + * for example id of the event + * handler. + */ + virtual void setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + /** + * Returns AlfWidgetEventHandlerInitData. + * @return A pointer to AlfWidgetEventHandlerInitData structure + * which contains for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + //-------------------------------------------------------------------------- + //Overriden Apis from IMulSliderBaseElementInternal + //-------------------------------------------------------------------------- + // + + /** + * Notified when the base layout of slider changes . + * Relayouts all the visuals with respect to the new size. + */ + void baseLayoutSizeChanged(); + + /** + * update visualization + * + */ + void updateVisualization(); + + /** + * create visulization for slider + * @param aTemplateId - template id + */ + void createVisualization(sliderTemplate aTemplateId); + + + /** + * Updates Text visualization. + * + */ + void updateTextVisualization(); + + private: + + /** + * layoutVisuals setpos visulization for slider + * @param aTemplateId - template id + */ + void layoutVisuals(sliderTemplate templateid); + + /** + * initializeSliderData to initialize the model and widget pointers + */ + void initializeSliderData(); + + /** + * Normalise the template specific data with that from the Model. + */ + + void NormalizeRange(); + /** + * Sets the position of the handle + * + * @param aCurrTick The new position of the progress bar + * + */ + void SetTickPosition(int aCurrTick); + + private: // Class Data + struct MulSliderProgressBarImpl* mData; + MulSliderModel * mSliderModel; + MulSliderWidget * mSliderWidget; + CFbsBitmap* iBitmap; + }; // end of class + + } // end of namespace Alf + +#endif //MUL_SLIDERPROGRESSIVE_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulslidercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulslidercontrol.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,198 @@ +/* +* 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: Control interface with utilities for slider widget. +* +*/ + +#ifndef MUL_SLIDERCONTROL_H +#define MUL_SLIDERCONTROL_H + +//WidgetModel Includes +#include +#include +#include "alf/alfelement.h" +#include +//Osn Includes +#include + + +using namespace osncore; +using namespace Alf; + +// Forward declarations +class TAlfCustomEventCommand; + +const float roundOff = 0.5; +namespace Alf + { + // Forward declaration +class IAlfModel; +class AlfModelOperation; +class MulSliderControl : public CAlfWidgetControl + { +public: + + /** + * Constructor. + */ + MulSliderControl ( CAlfEnv& aEnv ); + + /** + * Class Destructor. + * @since S60 ?S60_version + */ + virtual ~MulSliderControl(); + + //-------------------------------------------------------------------------- + //Overriden Apis from Base class CAlfControl + //-------------------------------------------------------------------------- + // + + /** + * Notifies the owner that the layout of a visual has been recalculated. + * Called only when the EAlfVisualFlagLayoutUpdateNotification flag has + * been set for the visual. + * + * @param aVisual Visual that has been laid out. + */ + void VisualLayoutUpdated ( CAlfVisual& aVisual ); + + /** + * Returns top level layout. Returns NULL if this control does not + * implement the IAlfHostAPI interface or if there is no base layout. + * + * @return Pointer to top level layout, or NULL if not available. + */ + CAlfLayout* ContainerLayout ( const CAlfControl* aConnected ) const; + +// from base class CAlfWidgetControl + + /** + * @see IAlfWidgetControl + */ + AlfEventStatus handleEvent( const TAlfEvent& aEvent ); + + /** + * Update the presentation according to the data changes. + * + * @since S60 ?S60_version + * @param aArrayOfOperation An Array containing the operations performed on + * the model. + */ + void dataChanging ( const AlfModelOperation& aOperation ); + + /** + * removes an element. + */ + void removeAndDestroyElement(const IAlfElement& aElement ); + + +// From base class IAlfInterfaceBase + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the control classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + IAlfInterfaceBase* makeInterface ( const IfId& aType ); + +public: + + /** + * Generates the feedback based on the events recieved + * + */ + void TactileEffectOnTouchandHold(); + + /** + * Generates the feedback based on the events recieved + * + * @param aEvent Events recieved by the widget on Drag + * @param aIntensity Intensity of the feedback.If not passed default will be 50 + */ + void TactileEffectOnDrag(TAlfEvent& aEvent , int aIntensity = 50 ); + + /** + * Generates the feedback based on the thumb release + * or drag on thumb is stopped + */ + void TactileEffectOnRelease(); + +private: + + /** + * Rounds float to int + * + * @param aFloatValue float value + * @return int + */ + inline int roundFloatToInt ( float aFloatValue ) + { + return(int)(aFloatValue + roundOff); + } + + /** + * Sets whether or not tactile feedback is enabled. + * + * @param aEnabled Whether or not tactile is enabled. + */ + void EnableTactileFeedback( bool aEnabled ); + +private: + + /** + * Default contructor + */ + MulSliderControl(); + + /** + * IAlfAttributeOwner implementation. Own. + */ + + /** + * height of the Layout. + */ + int mLayoutHeight; + + /** + * width of the Layout. + */ + int mLayoutWidth; + + /** + * tactile is enabled or not. + */ + bool mEnableTactile; + + /** + * Tactile Feedback for drag started + */ + bool mDragTactileFeedbackStarted; + /** + * pointer to get the current tactile instance + */ + MTouchFeedback *mTactilefdbInstance; + + }; // class MulSliderControl + + } // namespace Alf + +#endif //MUL_SLIDERCONTROL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderdefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderdefinitions.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007-2008 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: header for defining all the common variables +* +*/ + +#ifndef MULSLIDERDEFINITIONS_H_ +#define MULSLIDERDEFINITIONS_H_ + +namespace Alf + { + // For Slider template class + static const char* const KHORPROGDWNLD = "\\resource\\slider\\mui_dl_progress_lsc.svg"; + static const char* const KHORPROGCTR = "\\resource\\slider\\mui_slider_progress.svg"; + static const char* const KHORHANDLE = "\\resource\\slider\\mui_cover_handle.svg"; + static const char* const KHORCENTRE = "\\resource\\slider\\mui_slider_lsc.svg"; + static const char* const KVOLAUDIOOFF = "\\resource\\slider\\qgn_indi_volumeslider_audio_off.svg"; + static const char* const KVOLAUDIOON = "\\resource\\slider\\qgn_indi_volumeslider_audio_on.svg"; + static const char* const KVOLPLUS = "\\resource\\slider\\qgn_indi_volumeslider_plus.svg"; + static const char* const KVOLMINUS = "\\resource\\slider\\qgn_indi_volumeslider_minus.svg"; + static const char* const KZOOMIN = "\\resource\\slider\\qgn_indi_slider_zoom_in.svg"; + static const char* const KZOOMOUT = "\\resource\\slider\\qgn_indi_slider_zoom_out.svg"; + static const char* const KVERTCENTRE = "\\resource\\slider\\mui_slider_prt.svg"; + static const char* const KVERTHANDLE = "\\resource\\slider\\mui_cover_handle.svg"; + const float KRoundupvalue = 0.5; + const float KMinopacity = 0.4; + + const int KImageHeight = 50; + const int KImageWidth = 50; + + const int KHandleImageWidth = 56; + const int KHandleImageHeight = 47; + const int KYToleranceInPixel = 10; + const int KXToleranceInPixel = 10; + + const float KMaxopacity = 0.7; + + const int KVariety0 = 0; + const int KVariety1 = 1; + const int KVariety2 = 2; + const int KVariety3 = 3; + const int KVariety4 = 4; + const int KVariety5 = 5; + const int KVariety6 = 6; + const int KVariety7 = 7; + const int KVariety8 = 8; + } //namespace Alf + +#endif /*MULSLIDERDEFINITIONS_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderhorizontal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderhorizontal.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,459 @@ +/* +* Copyright (c) 2007 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: Header for presentation elements - horizontal slider. + * +*/ + + + + +#ifndef MUL_SLIDERHORIZONTAL_H +#define MUL_SLIDERHORIZONTAL_H + +//INCLUDES +#include +#include "alf/alfelement.h" +#include +#include +#include +#include + + +#include + +#include +#include "mulslidermodel.h" + +#include "imulsliderbaseelementinternal.h" + +namespace duiuimodel + { + class DuiNode; + } + +using namespace osncore; + +namespace Alf + { + struct MulSliderPos; + + +// Forward declarations +class IAlfWidgetEventHandler; +class CAlfWidgetControl; +class MulSliderLongTapTimer; + +/** + * Default Base Element of the Slider. + */ +class MulSliderHorizontal : + public AlfElement, + public IAlfWidgetEventHandler, + public IMulSliderBaseElementInternal, + public MAlfBitmapProvider + { +public: + + /** + * Constructor + * @param aControl Widget control. + * @param aName Name of the item element. + * @param aCustomData . + * @param mNode . + * @since S60 ?S60_version + */ + MulSliderHorizontal ( + CAlfWidgetControl& aControl, + const char* aName, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Destructor + */ + virtual ~MulSliderHorizontal(); + + /** + * bitmap provider. + * @since S60 ?S60_version + * @param aId bitmap ID. + * @param aBitmap bitmap. + * @param aMaskBitmap mask for the bitmap. + * @return + */ + void ProvideBitmapL (TInt aId, + CFbsBitmap *& aBitmap, + CFbsBitmap *& aMaskBitmap); + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the Button widget class. + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + + + + //void createVisualization(); + //-------------------------------------------------------------------------- + //Overriden Apis from IAlfWidgetEventHandlers + //-------------------------------------------------------------------------- + // + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. + * Pointer event handlers cannot be identified directly, + * since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * @since S60 ?S60_version + * @param aEvent The event. + * @param aControl + * @return ETrue if the event can be processed. + * Otherwise EFalse. + */ + bool accept(CAlfWidgetControl& aControl, const TAlfEvent& aEvent) const; + + + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerType eventHandlerType(); + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerExecutionPhase eventExecutionPhase(); + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return ETrue if the event was processed. + * Otherwise EFalse. + */ + + + virtual AlfEventStatus offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ); + + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . The high 16 bits are + * available for states defined by the client code. + */ + void setActiveStates(unsigned int aStates); + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + + /** + * Returns AlfWidgetEventHandlerInitData. + * @return A pointer to AlfWidgetEventHandlerInitData structure + * which contains for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + /** + * Friend class for timer functions. + * + */ + friend class MulSliderLongTapTimer; + + +// From IAlfScrollBarBaseElementInternal + + /** + * Notified when the base layout of scrollbar changes . + * Relayouts all the visuals with respect to the new size. + */ + void baseLayoutSizeChanged(); + + /** + * Initialises slider data + */ + void initializeSliderData(); + /** + * Updates visualization + */ + void updateVisualization(); + /** + * Updates text visualization + */ + void updateTextVisualization(); + /** + * handles Long tap event + */ + AlfEventStatus handleLongTap(); + + /** + * Changes Thumb image + */ + void changeThumbImage(bool aPressed = false); + /** + * Gets thumb minimum length. + */ + void getThumbMinMaxLength(); + /** + * Creates visualization + */ + void createVisualization(sliderTemplate aTemplateId); + // Creates Slider Template 3 ( Zoom Slider) + //void createZoomSlider(); + /** + * create a Dual progressive slider + */ + void createDualProgressiveSlider(); + + private: // New Methods + + /** + * SetBackgroundBrush + * + */ + void SetBackgroundBrush(); + + /** + * Retrieves the data for the slider from the model into structure + */ + void RetrieveData(); + + /** + * Sets the position of the handle + * + * @param aCurrTick The new position of the handle + */ + void SetThumbPosition();//int aCurrTick); + + /** + * Sets the text for the counter visual + * + * @param aNewString The counter visual text value + * @throw Invalid Argument incase there is no layout at zeroth position + */ + void SetTextLabels(const UString& aNewString); + + /** + * Sets the image for the image visual + * + * @param aImagePath The path of the new image + * @throw Invalid Argument incase there is no layout at zeroth position + */ + void SetNewImagePath(const UString& aImagePath); + + /** + * Sets the image for the image visual from thr provided texture id + * + * @param aTextureId The texture id of the new image + * @throw Invalid Argument incase there is no layout at zeroth position + */ + void SetNewImageTexture(const int aTextureId); + + /** + * Notifies about the initiation of pointer down event on the visual. + * + * @returns true after the drag has started + */ + //bool StartDrag(CAlfVisual *aDragVisual); + + /** + * Sets the starting position of the pointer doen event and will + * start ignoring the visual for further possible pointer events + * + * @param aOperation true to signify start of drag. + */ + //void Begin(TBool aOperation); + + /** + * Checks if the drag event is On + * + * @returns true if the drag event is on. + */ + //bool BeingDragged() const; + + /** + * Clears the flag for ignoring the visual for pointer events. + */ + //void StopDrag(); + + /** + * Handles the key events only. + * + * @param aEvent event to be handled + * @returns if the event was handled or not + */ + AlfEventStatus HandleKeyEvents(const TAlfEvent& aEvent); + + /** + * Handles the pointer events only. + * + * @aControl The alfwidget control + * @param aEvent Event to be handled + * @returns if the event was handled or not + */ + AlfEventStatus HandlePointerEvents( TAlfEvent* aEvent); + /** + * Handles pointer down event + */ + AlfEventStatus handlePointerDownEvent(TAlfEvent * aPntrEvent); + /** + * Checks if the slider visual is hit + * + * @param aVisual Visual that has been touched. + * @param aPointerPt position of the pointer + * @param aEvent Event to be handled + * @returns true/false if the visual is touched + */ + bool IsSldVisualHit(const CAlfVisual& aVisual,TPoint aPointerPt,const TAlfEvent& aEvent); + + /** + * Checks if the hit point is within the tappable area + * + * @param aPointerPt position of the pointer + * @param aEvent Event to be handled + * @returns true/false if the point is in tappable area + */ + bool InTappableArea(const TPoint& aPointerPt,const TAlfEvent& aEvent) ; + + /** + * Converts pixel to value according to range of slider + * @param aPixel The pixel value passed + * @param aMaxPixel The maximum value to be considered for calculation + * returns rounded int value after conversion + */ + int PixelToValue(int aPixel,int aMaxPixel); + + /** + * Converts value to pixel according to range of slider + * @param aVal The value passed + * @param aMaxPixel The maximum value to be considered for calculation + * returns rounded int pixel after conversion + */ + int ValueToPixel(int aVal, int aMaxPixel); + + /** + * Creates the new image for the given path + * @param aImageVisual The visual to which the image is to be set + * @param aPath The new path of the image + * @returns Returns the new image to be set + */ + TAlfImage CreateImageFromImagePath( const CAlfImageVisual& aImageVisual, const TPtrC8& aPath ); + + /** + * Sets the new value for max and min range considering min range as zero.Its helpful + * for the negative min range values or greater than zero min range values. + * + * @param aMap Contains data.Used to get the data from current model. + */ + void NormalizeRange(/*IAlfMap& aMap*/); + + /** + * Stores the value for x and y coordinate of baselayout position in structure. + * Later the values from the structure is used to get/set the relative values + * according to the new position of baselayout. + */ + void RelativePos(); + void mirrorPointerPosition(const TPoint& aPointerPos ); + + /* + * Change volume icon + */ + void VolumeIconChange(bool aFlag,int aValue); +private: + /** + * IsSliderVisual + */ + bool IsSliderVisual(CAlfVisual *aVisual); + + + /** returns pixel values + */ + void ConvertDataToPixels(); + + /** + * updateModelPrimaryValue + * + */ + void updateModelPrimaryValue(int aNewPosValue); + /** + * Start drag + */ + bool initializeThumbDragData( const TPoint& aPointerPos ); + + /** + * Stop drag + */ + bool stopDrag(); + + + /** + * Handles pointer Events + */ + void handlePointerUpEvent(); + /** + * Snaps primary value to ticks + */ + void snapPrimaryValueToTicks(); + /** + * Set images for three part track + * + */ + void setTrackImage(); + /** + * Checks if the track visual is Hit + */ + AlfEventStatus trackVisualHit(CAlfVisual * aHitVisual); + /** + * layout the visuals + * + */ + void layoutVisuals(sliderTemplate aTemplateId); +private: // Class Data + +// auto_ptr< MulSliderHorizontalImpl>mData; // Owned + struct MulHorizontalSliderDataImpl* mData; +// auto_ptr mData; + auto_ptr mPosData; // Structure for storing current and previous values +// const UString& mStyle; + auto_ptr mLongTapTimer; + CAlfVisual *mDragVisual; + MulSliderModel * mSliderModel; + MulSliderWidget * mSliderWidget; + }; // end of class AlfScrollBarDefaultLCTBaseElement + + } // end of namespace Alf + +#endif //MUL_SLIDERHORIZONTAL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderlongtaptimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderlongtaptimer.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007 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: Header for presentation elements - Slider long tap timer. +* +*/ + +#ifndef MULSLIDERLONGTAPTIMER_H_ +#define MULSLIDERLONGTAPTIMER_H_ + +#include +#include +#include +#include "imulsliderbaseelementinternal.h" + + +namespace Alf + { + +class MulSliderLongTapTimer: public CActive + { + + enum TState + { + //To indicate the event is in running state. + ERunning, + + //To indicate the event is in stopped state. + EStopped + }; +public: + /** + * Constructor + * @param aBaseElement + */ + MulSliderLongTapTimer(IMulSliderBaseElementInternal* aSliderElement); + + /** + * Destructor + */ + ~MulSliderLongTapTimer(); + + /** + * Start the Timer. + */ + void Start(); + + /** + * Stops the Timer. + */ + void Stop(); + + /** + * user code runs under this active object. + */ + void RunL(); + + /** + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + +private: + + RTimer iTimer; + TState iState; + IMulSliderBaseElementInternal *iBaseElement; + }; + + } + +#endif /*MULSLIDERLONGTAPTIMER_H_*/ diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulslidermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulslidermodel.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,363 @@ +/* +* Copyright (c) 2007 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: Header for presentation element - slider model interface. +* +*/ + + +#ifndef MUL_SLIDERMODEL_H +#define MUL_SLIDERMODEL_H + +// Widget Model and Exported API includes +#include + +// OsnCore includes +#include +#include +#include "imulsliderbaseelementinternal.h" +#include +#include +// Namespace +using namespace osncore; + +namespace Alf + { + +//Forward Declarations +class AlfModel; +class MulSliderWidget; + +/** + * slider model implementation. + * + * Implements utility methods to create and update + * the data hierarchy of a slider. + */ +class MulSliderModel : public IMulSliderModel + { +public: + ///////////////////////////////////////// + /////// FROM MULSLIDER////////////////// + /** + * Set the value of the primary thumb. + * + * @param aValue Position of the primary thumb. + * + */ + void SetPrimaryValue(int aValue) ; + + /** + * Return the value of the primary thumb of the slider. + * + * @return Value of the primary thumb. + * + */ + int PrimaryValue() const ; + + /** + * Set the value of the secondary thumb. + * + * @param aValue Position of the secondary thumb. + * + */ + void SetSecondaryValue(int aValue) ; + + /** + * Return the value of the secondary thumb of the slider. + * + * @return Value of the secondary thumb. + * + */ + int SecondaryValue() const ; + + /** + * Return the total number of ticks. + * + * @return Number of ticks (int) + * + */ + int TotalTicks() const ; + + + /** + * Set Template that will be used to represent data. + * + * @param aTemplateId Template associated with the widget. + * + */ + void SetTemplate( sliderTemplate aTemplateId) ; + + /** + * Get Template that will be used to represent data. + * + * + * + */ + sliderTemplate GetTemplate(); + + /** + * SetRightText that will be used to represent data. + * + * @param aRightText + * + */ + void SetRightText(char* aRightText) ; + + /** + * GetRightText that will be used to represent data. + * + * + * + */ + const char* GetRightText() ; + + /** + * SetLeftText that will be used to represent data. + * + * @param aLeftText + * + */ + void SetLeftText(char* aLeftText) ; + + /** + * GetLeftText that will be used to represent data. + * + * + * + */ + const char* GetLeftText() ; + + /** + * SetPercentText that will be used to represent data. + * + * + */ + void SetPercentText(char* aPercText) ; + + /** + * GetPercentText that will be used to represent data. + * + * + */ + const char* GetPercentText() ; + + /** + * SetMinRange that will be used to represent data. + * + * + */ + void SetMinRange(int aMinRange) ; + + /** + * GetMinRange that will be used to represent data. + * + * + */ + int MinRange()const ; + + /** + * SetMaxRange that will be used to represent data. + * + * + */ + void SetMaxRange(int aMaxRange) ; + + /** + * MaxRange that will be used to represent data. + * + * + */ + int MaxRange()const ; + + /** + * SetTick that will be used to represent data. + * + * + */ + void SetTick(int aTick) ; + + /** + * GetTick that will be used to represent data. + * + * + */ + int Tick()const ; + + /** + * Constructor. + */ + MulSliderModel(); + + /** + * Destructor. + */ + ~MulSliderModel(); + + + + /** From base class IAlfModel + * + */ + + /** + * Add a new observer to be notified of any changes in the model. + * + * @param aObserver The model change observer to be added. + * @return void + * @since S60 ?S60_version + */ + void addModelChangeObserver(IAlfModelChangeObserver& aObserver); + + /** + * Remove an observer which is added to get notified of any changes + * in the model. + * + * @param aObserver The model change observer to be removed. + * @return void + * @since S60 ?S60_version + */ + void removeModelChangeObserver(IAlfModelChangeObserver& aObserver); + + /** + * API to change the model completely at one short. + * + * @see IAlfModel + * @param aData The new data. + * @return void + * @since S60 ?S60_version + */ + void setData(IAlfVariantType* aData); + + /** + * Change a given of data fields in the model . All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @param aData The new data to be set. + * @since S60 ?S60_version + */ + void updateData(int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData); + + /** + * Add a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @param aData The new data. + * @return void + * @since S60 ?S60_version + */ + void addData(int aNumContainerIndices, + int* aContainerIndices, + IAlfVariantType* aData); + + /** + * Remove a number of data fields in the model data. All model change + * observers are notified about the change. + * + * @param aNumContainerIndices The number of indices in aContainerIndices. + * @param aContainerIndices The container indices to find the correct + * location in the data hierarchy.The ownership + * is transferred. + * @return void + * @since S60 ?S60_version + */ + void removeData(int aNumContainerIndices, int* aContainerIndices); + + /** + * API for executing batch operations + * + * @param aOperationsArray An RPOinterArray containing the list of + * operations to be executed in batch. + * @return void + * @since S60 ?S60_version + */ + void executeOperations(AlfPtrVector& aOperationsArray); + + /** + * API for executing one operation at a Time + * + * @param aOperation An Operation to be executed on the model. + * @since S60 ?S60_version + */ + void executeOperation(AlfModelOperation* aOperation); + + /** + * Clears the Model. + * + * @return void + * @since S60 ?S60_version + */ + void clearModel(); + + IAlfVariantType* data() const; + + IAlfInterfaceBase* makeInterface(const IfId& aType); + + /** + * Get the Element Interface. + * + * @return The Element pointer. + * @since S60 ?S60_version + */ + IMulSliderBaseElementInternal* GetElement(); + + + /** + * SetData + */ + void SetData(const MulVisualItem& aSliderItem); + + + /** + * Data + */ + const MulVisualItem& Data() const; + + + /* + * IsLandscape + */ + bool IsLandscape(); + + + /** + * pointer to slidermodelData. + */ + void storeWidget(MulSliderWidget* aWidget); + + void UpdateElement(); + +private: + + /* + * pointer to slidermodelData. + */ + struct SliderModelDataImpl *mSldrModelData; + + AlfModel* mModel; //Owned + }; // class MulSliderModel + + } // End of namespace Alf + +#endif // MUL_SLIDERMODEL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderutils.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 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: Header for presentation element - Utilities for slider widget. +* +*/ + + +#ifndef MUL_SLIDERUTILS_H +#define MUL_SLIDERUTILS_H + + +#include "imulsliderbaseelementinternal.h" +#include +#include + +namespace Alf + { + + +/** + * Slider Utils implementation. + * + * Implements utility methods to support the slider + */ +class MulSliderUtils + { +public: + + /** + * Get the component layout rect value from lct. + * + * @param aId SliderLCTIDs, the LCTID of the component. + * @param aLayout CAlfLayout, the parent layout of the component. + * @param aVariety variety ID of the component. + */ + static TAknLayoutRect GetComponentRect(SliderLCTIDs aId, CAlfLayout *aLayout, int aVariety); + + /** + * Get the text component layout rect value. + * + * @param aId SliderLCTIDs, the LCTID of the component. + * @param aLayout CAlfLayout, the parent layout of the component. + * @param aVariety variety ID of the component. + */ + static TAknLayoutText GetTextComponentRect(SliderLCTIDs aId, CAlfLayout *aLayout, int aVariety); + + + }; // class MulSliderUtils + + } // End of namespace Alf + +#endif // MUL_SLIDERUTILS_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulslidervertical.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulslidervertical.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2007 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: Header for presentation element - vertical slider. + * +*/ + + + + +#ifndef MUL_SLIDERVERTICAL_H +#define MUL_SLIDERVERTICAL_H + +//INCLUDES +#include +#include "alf/alfelement.h" +#include +#include +#include +#include + +#include +#include + +#include "mulslidermodel.h" +#include +#include "imulsliderbaseelementinternal.h" + + +namespace duiuimodel + { + class DuiNode; + } + +using namespace osncore; + +namespace Alf + { + struct MulSliderPos; + + +// Forward declarations +class IAlfWidgetEventHandler; +class CAlfWidgetControl; +class MulSliderLongTapTimer; + +/** + * Default Base Element of the Scrollbar. + */ +class MulSliderVertical : + public AlfElement, + public IAlfWidgetEventHandler, + public IMulSliderBaseElementInternal, + public MAlfBitmapProvider + { +public: + + /** + * Constructor + * @param aControl Widget control. + * @param aName Name of the item element. + * @param aCustomData . + * @param mNode . + * @since S60 ?S60_version + */ + MulSliderVertical ( + CAlfWidgetControl& aControl, + const char* aName, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Destructor + */ + virtual ~MulSliderVertical(); + + /** + * bitmap provider. + * @since S60 ?S60_version + * @param aId bitmap ID. + * @param aBitmap bitmap. + * @param aMaskBitmap mask for the bitmap. + * @return + */ + void ProvideBitmapL (TInt aId, + CFbsBitmap *& aBitmap, + CFbsBitmap *& aMaskBitmap); + + /** + * From IAlfInterfaceBase. + * Getter for interfaces provided by the Button widget class. + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + + + /** + * Sets the text for the counter visual + * + * @param aNewString The counter visual text value + * @throw Invalid Argument incase there is no layout at zeroth position + */ + void SetTextLabels(const char* aStr); + + + //-------------------------------------------------------------------------- + //Overriden Apis from IAlfWidgetEventHandlers + //-------------------------------------------------------------------------- + // + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. + * Pointer event handlers cannot be identified directly, + * since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * @since S60 ?S60_version + * @param aEvent The event. + * @param aControl + * @return ETrue if the event can be processed. + * Otherwise EFalse. + */ + bool accept(CAlfWidgetControl& aControl, const TAlfEvent& aEvent) const; + + + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerType eventHandlerType(); + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventHandlerExecutionPhase eventExecutionPhase(); + /** + * Called when an input event is being offered to this event handler. + * The return value is used to indicate if the event was processed. + * Processed events may not be offered to other event handlers. + * @since S60 ?S60_version + * @param aControl The parent control of this event handler. + * @param aEvent The event. + * @return ETrue if the event was processed. + * Otherwise EFalse. + */ + + + virtual AlfEventStatus offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ); + + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . The high 16 bits are + * available for states defined by the client code. + */ + void setActiveStates(unsigned int aStates); + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + + /** + * Returns AlfWidgetEventHandlerInitData. + * @return A pointer to AlfWidgetEventHandlerInitData structure + * which contains for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + /** + * Friend class for timer functions. + * + */ + friend class MulSliderLongTapTimer; + + + //-------------------------------------------------------------------------- + //Overriden Apis from IMulSliderBaseElementInternal + //-------------------------------------------------------------------------- + // + + /** + * Notified when the base layout of scrollbar changes . + * Relayouts all the visuals with respect to the new size. + */ + void baseLayoutSizeChanged(); + + /** + * createVisualization + * @param aTemplateId .aTemplateId takes 3 or 9 as parameter. + */ + void createVisualization(sliderTemplate aTemplateId); + + /** + * updateVisualization + * Notified when the base layout of scrollbar changes . + * Relayouts all the visuals with respect to the new size. + */ + void updateVisualization(); + + /** + * Updates Text visualization. + * + */ + + void updateTextVisualization(); + /** + * Sets transparency for the Widget + * @param aTransparent - opacity level + */ + void MakeTransparent(bool aVal); + /** + *Stops all event handling + * + * + */ + void stopEvents() ; + private: + /** + * Set skin images on scrollbar track + */ + void setTrackImage(); + + /** + * Set skin images on scrollbar thumb + */ + void setThumbImage(); + /** + * Sets the position of the handle + * + * + */ + void SetThumbPosition(); + + /** + * Handles the key events only. + * + * @param aEvent event to be handled + * @returns The return value is used to indicate if the event was processed. + */ + AlfEventStatus HandleKeyEvents(const TAlfEvent& aEvent); + + /** + * Handles the pointer events only. + * + * + * @param aEvent Event to be handled + * @returns The return value is used to indicate if the event was processed. + */ + AlfEventStatus HandlePointerEvents( TAlfEvent* aEvent); + + /** + * handles the pointerDown event + * + * @param aEvent Event to be handled + * @returns The return value is used to indicate if the event was processed. + */ + AlfEventStatus handlePointerDownEvent(TAlfEvent * aPntrEvent); + + +private: + + + /** + * IsSliderVisual + * + */ + bool IsSliderVisual(CAlfVisual *aVisual); + + + /** + * layout the visuals + * + */ + void layoutVisuals( sliderTemplate aTemplateId) ; + + + + /** + * + * initializes Model and Widget Pointer + */ + void initializeSliderData(); + + /** + * SetBackgroundBrush + * + */ + void SetBackgroundBrush(); + + /** + * ConvertDataToPixels + * + */ + void ConvertDataToPixels(); + + /** + * updateModelPrimaryValue + * + */ + void updateModelPrimaryValue(int aNewPosValue); + + /** + * Start drag + */ + bool initializeThumbDragData(const TPoint& aPointerPos); + + + /** + * Stop drag + */ + bool stopDrag(); + + /** + * handlePointerUpEvent + */ + void handlePointerUpEvent(); + + /** + * snapPrimaryValueToTicks + */ + void snapPrimaryValueToTicks(); + + /** + * trackVisualHit + */ + AlfEventStatus trackVisualHit(CAlfVisual * aHitVisual); + + /** + * Texture for Visuals of slider. + * + */ + TAlfImage skinTexture(TSize aPrtImageSize, TSize aLscImageSize, TInt aPrtSkinId, TInt aLscSkinId ); + + /* + * Get the Feedback Intensity + */ + TInt feedbackIntensity(); + + +private: // Class Data + + + struct MulVerticalSliderDataImpl* mData; + + // Structure for storing current and previous values + auto_ptr mPosData; + + + auto_ptr mLongTapTimer; + MulSliderModel * mSliderModel; + MulSliderWidget * mSliderWidget; + + }; // end of class + + } // end of namespace Alf + +#endif //MUL_SLIDERVERTICAL_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderwidget.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,340 @@ +/* +* 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: Widget interface with utilities for slider widget. +* +*/ + +#ifndef ALF_SCROLLBARWIDGET_H +#define ALF_SCROLLBARWIDGET_H + +// ToolKit Includes +#include + +// WidgetModel Includes +#include +#include "alf/alfwidget.h" +#include + +// Widget Includes +#include +#include + + +// Forward Declarations +// From Alfred Client +class CAlfEnv; +class CAlfDisplay; +class CAlfControl; + +// From namespace Alf +namespace Alf + { +// Forward Declarations +class IAlfVariantType; +class IAlfElement; +class IAlfWidgetEventHandler; +class INode; +class IAlfWidgetFactoryBase; +class CAlfWidgetControl; +class IAlfModel; +class AlfElement; +class AlfVisualTemplate; +//class AlfScrollBarWidgetAttributeOwner; + } + +//From name space duiuimodel +namespace duiuimodel + { +class DuiNode; + } + + +namespace Alf + { + class IMulSliderBaseElementInternal; + + /** + * A basic slider widget implementation. + * Contains methods for creating the default + * building blocks for the slider widget. + */ +class MulSliderWidget : public IMulSliderWidget + { +public: + + /** + * Creator Method. + * + * @param aEnv The environment for the widget. + * @param aContainer The container widget where this widget is contained. + * @param aWidgetId The name of the widget. Not Owned. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @param aCustomData Custom data. Not Owned. + * @param aNode Node. Not Owned. + * @return MulSliderWidget , or NULL if it does not create + */ + static MulSliderWidget* create(CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Virtual Destructor. + */ + virtual ~MulSliderWidget(); + + // From IAlfInterfaceBase + /** + * Getter for interfaces provided by the slider widget class. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + IAlfInterfaceBase* makeInterface(const IfId& aType); + + // From IAlfWidget + + /** + * Return the control + */ + CAlfWidgetControl* control() const; + + /** + * getter for the parent container. The ownership is not passed. + * @param none + * @return the parent container or NULL if the widget is the root-widget. + */ + virtual IAlfContainerWidget* parent() const; + + /** + * Setter for the control. The control is owned by the Alfred environment. + * + * @since S60 ?S60_version + * @param aControl The control for this widget. + * @param aDeletePreviousControl delete previous control.TRUE by default. + * @return void. + */ + void setControl(CAlfWidgetControl* aControl, + bool aDeletePreviousControl = true); + /** + API returns the Slider Model of the widget. + */ + IMulSliderModel& SliderModel() ; + /** + * Gets the model. + */ + IAlfModel* model(); + + /** + * Sets the model. + + * @return void. + */ + void setModel(IAlfModel* aModel, bool /*param*/); + + /** + * Return the widget name + */ + const char* widgetName() const; + + /** + * sets the focus to the child. + + * @return void. + */ + void setChildFocus(bool /*aFocus*/); + + + + /** + * Sets the presentation for the widget using presentation XML file. + + * Destroys any existing presentation. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML or if no control + * is associated with the widget. + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + virtual void setPresentation(const char* aFilePath); + + /** + * Set the transparency for the background of the slider widget. + * + * @param True, to set background as transparent + * @param False, to set background as opaque + */ + void MakeTransparent( bool aTransparent ) ; + + /** + * Enable/Disable key handling . + * + * @param aVal: True, to handle keyevents by Application + * False, to handle keyevents as defined in the control + */ + void SetHandleKeyEvent( bool aVal ) ; + /** + * API to show the widget + * @param aShow - Shows the widget on value True. + * @param aTransitionTime - Transition time for widget to be shown. + */ + void ShowWidget(bool aShow, int aTransitionTime =0); + /** + * API returns true if the widget is hidden + */ + bool IsHidden(); + /** + * API returns the container layout. + */ + const CAlfLayout& ContainerLayout(); + /** + * Update template . + * + * @param aTemplateId: template id + * + */ + void changeTemplate(int aTemplateId); + /** + * Adds event Handling for the Widget. + * + * @param aObserver: Observer of widget. + * + */ + void AddEventHandler( IAlfWidgetEventHandler& aObserver) ; + /** + * Remove an observer to widget + * + * @param aObserver Observer of widget. + */ + void RemoveEventHandler( IAlfWidgetEventHandler& aObserver); + /** + * Returns opcaity of the widget. + * + */ + bool GetOpacity(); + /** + * Returns true if Key handling is enabled by widget. + * + */ + bool IsKeyEnabled(); + + /** + * returns the Slider element + */ + IMulSliderBaseElementInternal* GetSliderElement(); + + +protected: + + /** + * C++ constructor. + * + * @param aEnv The environment for the widget. + * @param aContainer The container widget where this widget is contained. + * @param aWidgetId The name of the widget. Not Owned. + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @param aCustomData Custom data. + * @param aNode Node. Not Owned. + */ + MulSliderWidget(CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Methods to create different default elements and control of scroll bar. + * + * @param aEnv The environment for the widget. + * @param aDisplay The display for the widget. + * @return void. + */ + void constructDefault(CAlfEnv& aEnv, + AlfCustomInitDataBase* aCustomData=NULL); + + /** + * Constructs widget from declaration. + * + * @param aEnv The environment for the widget. + * @param aNode declaration node. + * @return void. + */ + void constructComponentsFromNode(CAlfEnv& aEnv, + DuiNode& aNode); + + /** + * Constructs widget from declaration. Recursive. + * + * @param aNode declaration node. + */ + void processTreeRecursively( DuiNode& aNode ); + + /** + * Creates the the widget using presentation XML file. + * Other widget parts are default. + * @param aEnv Alf Client Environment + * @param aFilePath Path to XML file describing the presentation + * of the widget. Not Owned. + * @exception AlfWidgetException if no visualization node available + * in Presentation XML + * @exception bad_alloc + * @since S60 ?S60_version + * @return void. + */ + void constructFromPresentationXML(CAlfEnv& aEnv, const char *aFilePath); + + /** + * Creates the default control. + * + * @param aEnv The environment for the widget. + * @return The Control. + */ + CAlfWidgetControl *constructDefaultControl(CAlfEnv& aEnv); + +private : + /** + * Creates a Slider elment. + * @param - aElementId + */ + void CreateSliderElement(const char* aElementId); + +private: + + /** + * Base widget. Own. + */ + + auto_ptr mWidget; + + /* + * IAlfAttributeOwner implementation. Own. + */ + //auto_ptr mAttributeOwner; + + IMulSliderBaseElementInternal* mElement; + IMulSliderModel * mSliderModel; + CAlfWidgetControl * mSliderControl; + bool mOpacity; + bool mHandleKeyEvent; + }; // class MulSliderWidget + + } // namespace Alf + +#endif // C_ALFSCROLLBARWIDGET_H diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/inc/mulsliderwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/inc/mulsliderwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,109 @@ +/* +* 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: Factory plugin for slider widget. +* +*/ + +#ifndef MUL_SLIDERWIDGETFACTORYPLUGIN_H +#define MUL_SLIDERWIDGETFACTORYPLUGIN_H + +// Includes +#include +#include +#include +#include "mulslidervertical.h" + +enum ESliderProductInfo + { + ESliderWidget, + + ESliderModel, + + ESliderHorizontalElement, + + ESliderVerticalElement, + + ESliderProgressbarElement + }; +namespace Alf + { + +class IfId; + + /** + * Plugin factory to create widget factory + * + * @lib alfwidgetfactory.dll + * @since S60 5.0 + */ +class MulSliderWidgetFactoryPlugin: public IAlfFactoryPlugin + { + +public: + + /** + * Two-phased Symbian constructor. + */ + static MulSliderWidgetFactoryPlugin* NewL(); + + /** + * Destructor + */ + virtual ~MulSliderWidgetFactoryPlugin(); + + // from IAlfFactoryPlugin + + /** + * Create factory product. + * @since Series 60 5.0 + * @param aProduct Product to create. + * @param aInitData Initialization data for product + * @return Instance or NULL + */ + IAlfInterfaceBase* createProduct ( const char* aProduct, void* aInitData ); + + /** + * Count available products + * + * @since S60 5.0 + * @return Product count + */ + int productCount() const; + + /** + * Fetch product info by index + * + * @param aIndex List index + * @since S60 5.0 + * @return Descriptor describing product + */ + const char* productInfo ( int aIndex ) const; + + /** + * From IAlfInterfaceBase. + * Creates interface based on the given type. + */ + IAlfInterfaceBase* makeInterface ( const IfId& aType ); + }; + + } // namespace Alf + + /** + * Exported factory function required by ECOM-framework + */ + OSN_IMPORT const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ); + +#endif //MUL_SLIDERWIDGETFACTORYPLUGIN_H +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/rom/mulsliderwidget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/rom/mulsliderwidget.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007-2008 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: Slider Widget iby file. +* +*/ + +#ifndef __MULSLIDERWIDGET_IBY__ +#define __MULSLIDERWIDGET_IBY__ + + +ECOM_PLUGIN( mulsliderwidget.dll, mulsliderwidget.rsc ) + +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,mulsliderwidget) + +#endif // __MULSLIDERWIDGET_IBY__ + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/2000FA7F.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/2000FA7F.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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: Slider widget resource file +* +*/ + +#include +#include "alf/alfecompluginfactoryuid.rh" + + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x2000FA7F; +interfaces = + { + INTERFACE_INFO + { + interface_uid = KFactoryPluginUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2000FA80; + version_no = 1; + display_name = ""; + default_data = "mulsliderwidget||mulslidermodel"; + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulhorizontalslider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulhorizontalslider.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1207 @@ +/* +* Copyright (c) 2007 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: The implementation for presentation elements. +* +*/ + +#include +#include +//Toolkit Includes +// Alfred Client includes +#include +#include +#include +#include +#include +#include +#include +#include + +//Widget Model Includes +#include +#include +#include + +//Avkon Includes +#include +#include +#include +#include + +//slider widget includes +#include +#include "mulsliderhorizontal.h" +#include "mulsliderwidget.h" +#include "mulslidercontrol.h" +#include "mulslidermodel.h" +#include "mulsliderdefinitions.h" + +#include "mulsliderutils.h" + +//Timer function includes +#include "mulsliderlongtaptimer.h" + + +namespace Alf + { + +// Structure to store data for the slider element class + + struct MulHorizontalSliderDataImpl + { + + bool mOperation;// Drag state + float mTickInPixels;// Tick size in Pixel + bool mIsLongTapObserverSet;// Is LongTap Event observer set + CAlfVisual * mVisual;// Stores thje current visual hit + TPoint mDragPoint;// Point at which drag started + TPoint mLongTapPos;// Point at which button down happened + bool mLongTapStarted;// Long tap timer started (true) + int mDragStartStep;// Tick positon of Drag Start + int mCurrTick;// Stores current tick + int mTrackStartPoint;// Slider Track Start Point in pixel + int mTick;// Stores Tick Size + bool mLayoutMirrored;// + int mdirection;// 0 - nomovement,1 left movement 2 right + int mImageTextureId; // to differtiate between textures + int mTrackTopTextureId;// to store the auto generated texture id's + int mTrackBottomTextureId; + int mTrackMiddleTextureId; + int mMarkerTextureId; + // Visualization Layouts + CAlfLayout* mMainLayout; + CAlfLayout* mBaseSliderLayout; + CAlfLayout* mSliderCentre; + CAlfImageVisual* mTrackLeftImage; + CAlfImageVisual* mTrackMiddleImage; + CAlfImageVisual* mTrackRightImage; + CAlfLayout* mSliderCentreGhost; + CAlfImageVisual* mSliderHandle; + CAlfLayout* mSliderHandleGhost; + CAlfImageVisual* mSliderProgressDownload; + CAlfImageVisual* mSliderProgressCentre; + CAlfTexture* mTexture; + + MulHorizontalSliderDataImpl() + { + mOperation = 0; + mTickInPixels = 0; + mIsLongTapObserverSet = 0; + mDragPoint.SetXY(0,0) ; + mLongTapPos.SetXY(0,0); + mLongTapStarted = 0; + mDragStartStep = 0; + mCurrTick = 0; + mTrackStartPoint = 0; + mImageTextureId = 0; + mTrackTopTextureId = 0 ; + mTrackBottomTextureId = 0; + mTrackMiddleTextureId = 0; + mMarkerTextureId = 0; + mVisual = NULL; + mMainLayout = NULL; + mBaseSliderLayout = NULL; + mSliderCentre = NULL; + mSliderHandle = NULL; + mSliderProgressCentre = NULL; + mBaseSliderLayout = NULL; + mSliderCentreGhost = NULL; + mSliderHandleGhost = NULL; + mLayoutMirrored = false; + mdirection = 0; + } + + }; + + // Bitmaps for slider +_LIT(KAvkonBitmapFile,"\\resource\\apps\\avkon2.mbm"); +//_LIT(KImageViewerBitmapFile,"\\resource\\apps\\ImageViewer.mif"); +// Bitmap Texture ID +const TInt KAlfTrackTopTextureId = 1; +const TInt KAlfTrackBottomTextureId = 2; +const TInt KAlfTrackMiddleTextureId = 3; +const TInt KAlfMarkerTextureId = 4; +//const TInt KAlfMarkerSelectedTextureId = 5; + +// --------------------------------------------------------------------------- +// C++ default constructor. +// --------------------------------------------------------------------------- +// +MulSliderHorizontal::MulSliderHorizontal( + CAlfWidgetControl& aControl, + const char* aName, + AlfCustomInitDataBase* /*aCustomData*/) + : mData(NULL) + { + // Base class (AlfElement) construct + construct(aControl, aName); + mData = new (EMM) MulHorizontalSliderDataImpl; + mPosData.reset(new(EMM)MulSliderPos); + // Timer for generating tap and hold repeat events + mLongTapTimer.reset(new (EMM) MulSliderLongTapTimer(this)); + mDragVisual = NULL; + mSliderModel = NULL; + mSliderWidget = NULL; + // Store the widget and model pointer + initializeSliderData(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulSliderHorizontal::~MulSliderHorizontal() + { + if(mData) + { + + (&control().Env())->TextureManager().UnloadTexture(mData->mTrackTopTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mTrackBottomTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mTrackMiddleTextureId); + // (&control().Env())->TextureManager().UnloadTexture(KAlfMarkerSelectedTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mMarkerTextureId); + // Visualization Data + delete mData; + } + else + { + + } + + }//End of Destructor + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Getter for interfaces provided by the slider widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderHorizontal::makeInterface( + const IfId& aType) + { + UString param (aType.mImplementationId); + if (param == IAlfWidgetEventHandler::type().mImplementationId) + { + return static_cast(this); + } + + else if (param == + IMulSliderBaseElementInternal::type().mImplementationId) + { + return static_cast(this); + } + else + { + return AlfElement ::makeInterface(aType); + } + + } + + +//-------------------------------------------------------------------------- +// APIs from the IMulSliderBaseElement +//-------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// Gets called when the parent layout is relayouted. +// resets all the anchor points and updates the visualization +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::baseLayoutSizeChanged() + { + mData->mMainLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); + if(mData->mMainLayout) + { + // This is a hack to resolve screen refresh issue + control().Env().RefreshCallBack(&(control().Env())); + // Layout the visualization with correct LCT values + layoutVisuals(mSliderModel->GetTemplate()); + // Convert all the user defined data to pixels + ConvertDataToPixels(); + // Set the thumb position to the current tick + SetThumbPosition(); + if(!mSliderModel->IsLandscape()) + { + if(mSliderWidget->GetOpacity()) + { + TAlfTimedValue opacity(1,0); + mData->mMainLayout->SetOpacity(opacity); + } + } + else + { + TAlfTimedValue opacity(0,0); + mData->mMainLayout->SetOpacity(opacity); + } + } + + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::setActiveStates( + unsigned int /*aStates*/) + { + //do nothing + } + + + +// --------------------------------------------------------------------------- +// initializes Model and Widget Pointer +// --------------------------------------------------------------------------- +// + +void MulSliderHorizontal::initializeSliderData() + { + // initialize the Slider Widget Pointer; + IAlfWidgetFactory& widgetFactory = + AlfWidgetEnvExtension::widgetFactory(control().Env()); + mSliderWidget = static_cast(widgetFactory.findWidget( + control().widget()->widgetName())); + + // initialize the Slider Model Pointer; + mSliderModel = static_cast(mSliderWidget->model()); + } + +// --------------------------------------------------------------------------- +// layoutVisuals +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::layoutVisuals(sliderTemplate /*aTemplateId*/) + { + // TAknLayoutRect to store the Lct rect + TAknLayoutRect layoutRect; + CAlfControl* ctrl = (CAlfControl*)&control(); + + //get the lct rect for mBaseSliderLayout and set it + //aacf_slider_pane(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderPane, + mData->mMainLayout, + KVariety0); + mData->mBaseSliderLayout->SetRect( + TRect( TPoint( 0,0 ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + mData->mSliderCentreGhost->SetRect( + TRect( TPoint( 0,0 ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + //get the lct rect for mSliderCentre and set it + //aaslider_bg_pane(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderCenter, + mData->mBaseSliderLayout, + KVariety0); + + + mData->mSliderCentre->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight))) ; + + + + //TAknLayoutRect handleGostRect = layoutRect; + //get the lct rect for mSliderHandle and set it + //aacf_slider_pane_g1(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderHandle,mData->mBaseSliderLayout,KVariety1); + + // This is a correction since the handle LCT data is not correct + /* mData->mSliderHandle->SetRect( + TRect( TPoint(handleGostRect.Rect().iTl.iX + + (handleGostRect.Rect().Size().iWidth - + layoutRect.Rect().Size().iWidth)/2 , + handleGostRect.Rect().iTl.iY + + (handleGostRect.Rect().Size().iHeight - + layoutRect.Rect().Size().iHeight)/2 ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; */ + mData->mSliderHandle->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + mData->mSliderHandleGhost->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + mData->mBaseSliderLayout->Pos().iX.ValueNow() ), + TSize( layoutRect.Rect().Size().iWidth, + mData->mBaseSliderLayout->Size().iY.ValueNow() ))) ; + //get the lct rect for mTrackLeftImage and set it + //aaslider_bg_pane_g1(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderLeft,mData->mSliderCentre,0); + + mData->mTrackLeftImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + //get the lct rect for mTrackMiddleImage and set it + //aaslider_bg_pane_g2_copy1(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderCentre,mData->mSliderCentre,0); + + mData->mTrackMiddleImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + //get the lct rect for mTrackRightImage and set it + //aaslider_bg_pane_g2(0) + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderRight,mData->mSliderCentre,0); + + mData->mTrackRightImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + + if(mData->mTrackLeftImage && + mData->mTrackMiddleImage && + mData->mTrackRightImage) + { + setTrackImage(); + } + + if(mData->mSliderHandle) + { + mData->mImageTextureId = KAlfMarkerTextureId; + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfMarkerTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent))); + + TAlfImage markerImage(*mData->mTexture ); + mData->mSliderHandle->SetImage(markerImage); + + } + + } + +// --------------------------------------------------------------------------- +// Used for setting images for the track +// --------------------------------------------------------------------------- +// + +void MulSliderHorizontal::setTrackImage() + { + TInt flags = EAlfTextureFlagSkinContent; + flags |= EAlfTextureFlagAutoSize; + CAlfControl* ctrl = (CAlfControl*)&control(); + //create texture for leftimage + mData->mImageTextureId = KAlfTrackTopTextureId; + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfTrackTopTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagRetainResolution| + EAlfTextureFlagSkinContent))); + + TAlfImage trackLeftImage(*mData->mTexture ); + + //create texture for middleimage + mData->mImageTextureId = KAlfTrackMiddleTextureId; + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfTrackMiddleTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagRetainResolution| + EAlfTextureFlagSkinContent))); + TAlfImage trackMiddleImage(*mData->mTexture ); + //create texture for right image + mData->mImageTextureId = KAlfTrackBottomTextureId; + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfTrackBottomTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagRetainResolution| + EAlfTextureFlagSkinContent))); + + TAlfImage trackRightImage(*mData->mTexture ); + // Set Image on visuals + if(AknLayoutUtils::LayoutMirrored()) + { + mData->mTrackLeftImage->SetImage(trackRightImage); + mData->mTrackRightImage->SetImage(trackLeftImage); + } + else + { + mData->mTrackLeftImage->SetImage(trackLeftImage); + mData->mTrackRightImage->SetImage(trackRightImage); + } + + mData->mTrackMiddleImage->SetImage(trackMiddleImage); + + }//End of setImage + +// --------------------------------------------------------------------------- +// ProvideBitmapL() +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::ProvideBitmapL (TInt aId, + CFbsBitmap *& aBitmap, + CFbsBitmap *& aMaskBitmap) + { + TAknLayoutRect layoutRect; + TRect rect; + TSize size; + switch(mData->mImageTextureId) + { + case KAlfTrackTopTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_end_left, + EMbmAvkonQgn_graf_nslider_end_left_mask ); + + + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderLeft,mData->mSliderCentre,KVariety0); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mTrackTopTextureId = aId; + } + break; + case KAlfTrackBottomTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_end_right, + EMbmAvkonQgn_graf_nslider_end_right_mask ); + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderRight, + mData->mSliderCentre, + KVariety0); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + + + mData->mImageTextureId = 0; + mData->mTrackBottomTextureId = aId; + } + break; + case KAlfTrackMiddleTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_middle, + EMbmAvkonQgn_graf_nslider_middle_mask ); + + //AknIconUtils::SetSize( aBitmap,TSize(304,14),EAspectRatioNotPreserved); + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderCentre, + mData->mSliderCentre, + KVariety0); + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mTrackMiddleTextureId = aId; + } + break; + case KAlfMarkerTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_marker, + EMbmAvkonQgn_graf_nslider_marker_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EHSliderHandle, + mData->mBaseSliderLayout, + KVariety1); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mMarkerTextureId = aId; + } + default: + break; + + } + } + + +// --------------------------------------------------------------------------- +// ConvertDataToPixels +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::ConvertDataToPixels() + { + // Calculate the range in pixel values + int distance = (mData->mSliderCentre->Size().iX.ValueNow() - + mData->mSliderHandle->Size().iX.ValueNow()); + if((mSliderModel->MaxRange() - mSliderModel->MinRange()) != 0) + { + // Calculate Tick Size in Pixels + mData->mTickInPixels = + (float)distance /(mSliderModel->MaxRange() + - mSliderModel->MinRange()) ; + } + // Get the track start pixel value + mData->mTrackStartPoint = mData->mSliderCentre->Pos().iX.ValueNow() ; + // Store current tick + mData->mCurrTick = mSliderModel->PrimaryValue() ; + mData->mTick = mSliderModel->Tick(); + } + + +// --------------------------------------------------------------------------- +// createVisualization +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::createVisualization(sliderTemplate /*aTemplateId*/) + { + // Create the visualization + CAlfControl* ctrl = (CAlfControl*)&control(); + // Visual Hierarchy creation + //creating mMainLayout + mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL); + // set the flag for Notifications and mirroring + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + mData->mMainLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + // create mBaseSliderLayout + mData->mBaseSliderLayout = CAlfLayout::AddNewL(*ctrl,mData->mMainLayout); + mData->mBaseSliderLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + //create dummy layout for slider track + mData->mSliderCentreGhost = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + //create dummy layout for slider Thumb + // create imagevisual for slider track + mData->mSliderCentre = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + mData->mTrackLeftImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + mData->mTrackMiddleImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + mData->mTrackRightImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + + // create imagevisual for slider thumb + mData->mSliderHandle = + CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + // Attach brush and transfer its ownership to the visual. + mData->mSliderHandleGhost = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + + // Get the widget opacity and apply on root visual + mSliderWidget->ShowWidget(mSliderWidget->GetOpacity(),0); + } + + +// --------------------------------------------------------------------------- +// eventHandlerType +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType MulSliderHorizontal::eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + + +// --------------------------------------------------------------------------- +// eventExecutionPhase +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulSliderHorizontal::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + +// --------------------------------------------------------------------------- +// offerEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderHorizontal::offerEvent( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) + { + AlfEventStatus ret = EEventNotHandled; + if(!mSliderWidget->IsHidden()) + { + if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventMissedPointerUp) + { + mData->mLongTapStarted = false; + ret=EEventHandled; + handlePointerUpEvent(); + } + } + // handle key events + else if(aEvent.IsKeyEvent() && mSliderWidget->IsKeyEnabled()) + { + ret = HandleKeyEvents(aEvent); + } + // Pointer drag events and single tap events + else if(aEvent.IsPointerEvent()) + { + ret = HandlePointerEvents((TAlfEvent *)&aEvent); + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// handleLongTap ( Long TapTimer calls inside its RUNL) +// --------------------------------------------------------------------------- +// + AlfEventStatus MulSliderHorizontal::handleLongTap() + { + mData->mMainLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); + //CAlfVisual * focusvisual = aEvent->Visual(); + AlfEventStatus ret = EEventNotHandled; + if (mData->mVisual == mData->mSliderCentre || mData->mVisual == mData->mSliderCentreGhost) + { + mData->mLongTapStarted = true; + ret = trackVisualHit(mData->mVisual); + // Handle Long tap timer tactile feedback + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnTouchandHold(); + } + + // ret = HandlePointerEvents(aEvent); + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + return ret; + } + + +// --------------------------------------------------------------------------- +// HandleKeyEvents +// --------------------------------------------------------------------------- +// + AlfEventStatus MulSliderHorizontal::HandleKeyEvents(const TAlfEvent& aEvent) + { + AlfEventStatus ret = EEventNotHandled; + int newPos = 0; + int data = 0; + if(AknLayoutUtils::LayoutMirrored()) + { + data= - mData->mTick; + } + else + { + data= mData->mTick; + } + if(aEvent.Code() == EEventKey ) + { + if(aEvent.KeyEvent().iScanCode == EStdKeyRightArrow) + { + ret = EEventHandled; + newPos = mSliderModel->PrimaryValue() + data; + updateModelPrimaryValue(newPos); + } + else if(aEvent.KeyEvent().iScanCode == EStdKeyLeftArrow) + { + ret = EEventHandled; + newPos = mSliderModel->PrimaryValue() - data; + updateModelPrimaryValue(newPos); + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// Sends drag Up or Down event, according to the hit position +// on track +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderHorizontal::trackVisualHit(CAlfVisual * /*aHitVisual*/) + { + + //Find the thumb Anchor Layout. + TAlfTimedPoint thumbVisPos = mData->mSliderHandle->Pos(); + TAlfTimedPoint thumbVisSize = mData->mSliderHandle->Size(); + //Check if click was above/to left or below/to right of + //thumb + if (mData->mLongTapPos.iX < thumbVisPos.iX.ValueNow()) + {// Pointer down happened left side of Handle + + int newPos = mSliderModel->PrimaryValue() - mData->mTick; + if(mData->mLongTapStarted) + { + if(mData->mdirection !=2) + { + // Move Handle + updateModelPrimaryValue(newPos); + mData->mdirection = 1; + } + } + } + else if (mData->mLongTapPos.iX > (thumbVisPos.iX.ValueNow() + + thumbVisSize.iX.ValueNow()) ) + { + // Pointer down happened right side of Handle + int newPos = mSliderModel->PrimaryValue() + mData->mTick; + if(mData->mLongTapStarted) + { + if(mData->mdirection !=1) + { + // Move Handle + updateModelPrimaryValue(newPos); + mData->mdirection = 2; + } + } + } + else + { + if(mData->mIsLongTapObserverSet) + { + // Stop the long tap timer + mLongTapTimer->Stop(); + mData->mLongTapStarted = false; + if(AknLayoutUtils::LayoutMirrored() ) + { + mData->mLongTapPos.iX = mData->mMainLayout->Size().iX.ValueNow() - + mData->mLongTapPos.iX; + } + mData->mIsLongTapObserverSet = EFalse; + if(!mData->mOperation) + { + mData->mVisual = mData->mSliderHandle; + initializeThumbDragData( + mData->mLongTapPos); + } + } + else + { + //Do Nothing. + } + } + return EEventHandled; + } + + +// --------------------------------------------------------------------------- +// handles the pointerDown event +// +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderHorizontal::handlePointerDownEvent(TAlfEvent * aPntrEvent) + { + CAlfVisual * focusvisual = aPntrEvent->Visual(); + AlfEventStatus result = EEventNotHandled; + if (focusvisual) + { + mData->mVisual = focusvisual; + + if (IsSliderVisual(focusvisual)) + { + control().processEvent(TAlfEvent(ECustomEventIconClick)); + control().Display()->Roster().SetPointerEventObservers( + EAlfPointerEventReportDrag ,control()); + if(!mData->mOperation) + { + mData->mIsLongTapObserverSet = ETrue; + //mData->mLongTapPos = aPntrEvent->PointerEvent().iParentPosition; + mirrorPointerPosition(aPntrEvent->PointerEvent().iParentPosition); + mData->mLongTapStarted = true; + mLongTapTimer->Start(); + // Dont send custom event at pointer up + + } + //Tick Movement + if (focusvisual == mData->mSliderCentre || + focusvisual == mData->mSliderCentreGhost) + { + mData->mLongTapStarted = true; + return trackVisualHit(focusvisual); + } + + // Drag + else if (focusvisual == mData->mSliderHandle || + focusvisual == mData->mSliderHandleGhost ) + { + // Initialize the drag variables + if(!mData->mOperation) + { + initializeThumbDragData( + aPntrEvent->PointerEvent().iParentPosition); + //Tactile Feedback for thumb touch + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnTouchandHold(); + } + + result = EEventHandled; + } + } + + } + return result; + } + + +// --------------------------------------------------------------------------- +// HandlePointerEvents +// --------------------------------------------------------------------------- +// + AlfEventStatus MulSliderHorizontal::HandlePointerEvents(TAlfEvent* aEvent) + { + AlfEventStatus ret = EEventHandled; + if (aEvent->PointerEvent().iType == TPointerEvent::EButton1Down) + { + mData->mdirection = 0; + ret = handlePointerDownEvent(aEvent); + } + // Drag Events + else if (aEvent->PointerEvent().iType == TPointerEvent::EDrag) + { + + if(!mData->mOperation) + {// Drag during tap and hold on track . + if(mData->mIsLongTapObserverSet) + {// Store the new pointer position + //mData->mLongTapPos=aEvent->PointerEvent().iParentPosition; + mirrorPointerPosition(aEvent->PointerEvent().iParentPosition); + } + else + { + //Do Nothing. + } + } + else + { + // Drag on Handle + if(mData->mIsLongTapObserverSet && + mData->mVisual && + mData->mSliderHandle && + mData->mSliderHandleGhost) + { + // Store the new pointer position + mirrorPointerPosition(aEvent->PointerEvent().iParentPosition); + } + else + { + // Do nothing + } + int dist; + // Calculate the distance moved from the drag start point + if(AknLayoutUtils::LayoutMirrored()) + { + dist = mData->mDragPoint.iX - + aEvent->PointerEvent().iParentPosition.iX ; + } + else + { + dist = aEvent->PointerEvent().iParentPosition.iX - + mData->mDragPoint.iX ; + } + // Calculate the new tick position + int precision = KRoundupvalue; + if(dist<0) + { + precision = -KRoundupvalue; + } + int newPos= (int)(((float)dist / mData->mTickInPixels ) + precision) + + mData->mDragStartStep; + // send tactile sensitive event + // Update the model hence update visualization + updateModelPrimaryValue(newPos); + } + // Tactile Feedback for Drag + //Tactile Feedback for thumb drag + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnDrag(*aEvent); + } + else if(aEvent->PointerUp() ) + { + mData->mLongTapStarted = false; + handlePointerUpEvent(); + + } + else + { + //Do Nothing. + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// updateModelPrimaryValue +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::updateModelPrimaryValue( int aNewPosValue) + { + // Validate the new tick value + if(aNewPosValue< mSliderModel->MinRange()) + { + aNewPosValue = mSliderModel->MinRange(); + } + else if(aNewPosValue > mSliderModel->MaxRange()) + { + aNewPosValue = mSliderModel->MaxRange(); + } + if(mSliderModel->PrimaryValue() != aNewPosValue && mData->mTick != 0) + { + // Update visualization and model only if data is changed + mPosData.reset(new(EMM)MulSliderPos); + mPosData->mPreviousValue = mSliderModel->PrimaryValue() ; + mSliderModel->SetPrimaryValue(aNewPosValue); + mPosData->mCurrentValue =aNewPosValue; + mData->mCurrTick = aNewPosValue; + + // Send event to the slider widget + TAlfEvent customevent(ETypePrimaryValueChange, + (uint)mPosData.get()); + control().processEvent(customevent); + } + } + + +// --------------------------------------------------------------------------- +// snapPrimaryValueToTicks +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::snapPrimaryValueToTicks() + { + // If the position is not a multiple of ticks then + //snap to the nearest tick multiple + + int currHandlePos = mSliderModel->PrimaryValue() - mSliderModel->MinRange(); + int tick = mSliderModel->Tick(); + int newPos = currHandlePos + mSliderModel->MinRange(); + if(mSliderModel->PrimaryValue() < mSliderModel->MaxRange()) + { + int diff = 0; + if(tick > 0) //model + { + diff = currHandlePos - ((currHandlePos /tick) * tick); + } + if(diff !=0) + { + newPos = currHandlePos + tick - diff + mSliderModel->MinRange(); + } + } + + // Update model + updateModelPrimaryValue(newPos); + } + + +// --------------------------------------------------------------------------- +// handlePointerUpEvent +// +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::handlePointerUpEvent() + { + // if thumb or track is clicked, change the graphics + // Send event if single click has hapened + + snapPrimaryValueToTicks(); + + if(mData->mOperation) + { + //Somehow missed the Up event? + stopDrag(); + //Tactile Feedback For Thumb Release + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnRelease(); + } + if(mData->mIsLongTapObserverSet) + { + // Stop the long tap timer + mLongTapTimer->Stop(); + // Un-register with the roster for long tap events + control().Display()->Roster().SetPointerEventObservers(0, + control()); + mData->mIsLongTapObserverSet = EFalse; + } + else + { + //Do Nothing. + } + } + + +// --------------------------------------------------------------------------- +// UpdateVisualization +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::updateVisualization() + { + ConvertDataToPixels(); + SetThumbPosition(); + } + +// --------------------------------------------------------------------------- +//Mirror pointer position +// --------------------------------------------------------------------------- +// +void MulSliderHorizontal::mirrorPointerPosition(const TPoint& aPointerPos ) + { + mData->mLongTapPos = aPointerPos; + if(AknLayoutUtils::LayoutMirrored()) + { + mData->mLongTapPos.iX = mData->mMainLayout->Size().iX.ValueNow() - + mData->mLongTapPos.iX ; + } + } +// --------------------------------------------------------------------------- +// SetThumbPosition +// --------------------------------------------------------------------------- +// + +void MulSliderHorizontal::SetThumbPosition() + { + // Current primary value in pixels + int newTickVal = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) * + mData->mTickInPixels; + // Handle + int handleY = mData->mSliderHandle->Pos().iY.ValueNow(); + int ghostHandleY = mData->mSliderHandleGhost->Pos().iY.ValueNow(); + // Handle new pos + int widthDiff = (mData->mSliderHandleGhost->Size().iX.ValueNow() - + mData->mSliderHandle->Size().iX.ValueNow())/2; + TAlfRealPoint pnt(mData->mTrackStartPoint + newTickVal,handleY); + // Ghost Handle ( Extended) new pos + TAlfRealPoint pnt1(mData->mTrackStartPoint - + widthDiff/2 + newTickVal,ghostHandleY); + // Set the position + mData->mSliderHandle->SetPos(pnt,0); + mData->mSliderHandleGhost->SetPos(pnt1,0); + + // Update visualization variables + mData->mCurrTick = mSliderModel->PrimaryValue(); + } + + +// --------------------------------------------------------------------------- +// accept +// --------------------------------------------------------------------------- +// +bool MulSliderHorizontal::accept( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) const + { + // Accept only key or pointer events. + if(aEvent.IsKeyEvent()||aEvent.IsPointerEvent()) + { + return true; + } + else + { + return false; + } + } + + +// --------------------------------------------------------------------------- +//initializeThumbDragData +// --------------------------------------------------------------------------- +// +bool MulSliderHorizontal::initializeThumbDragData( const TPoint& aPointerPos ) + { + TRAPD(err,control().Display()->Roster().SetPointerDragThreshold(control(), + TAlfXYMetric(TAlfMetric(KXToleranceInPixel,EAlfUnitPixel), + TAlfMetric(KYToleranceInPixel,EAlfUnitPixel))) ); + + if(mData->mVisual && err == KErrNone) + { + mData->mOperation = EMoveItem; + mData->mDragPoint = aPointerPos; + mData->mDragStartStep = mSliderModel->PrimaryValue(); + + } + else + { + // Do Nothing + } + return ETrue; + } + + +// --------------------------------------------------------------------------- +// stopDrag +// +// --------------------------------------------------------------------------- +// +bool MulSliderHorizontal::stopDrag() + { + TRAPD(err, + control().Display()->Roster().SetPointerEventObservers( + 0, + control())); + if(err == KErrNone) + { + mData->mVisual = NULL; + mData->mOperation = ENop; + return ETrue; + } + return EFalse; + } + + + + +// --------------------------------------------------------------------------- +// IsSliderVisual +// +// --------------------------------------------------------------------------- +// +bool MulSliderHorizontal::IsSliderVisual(CAlfVisual *aVisual) + { + if(aVisual == mData->mSliderCentre|| + aVisual == mData->mTrackLeftImage || + aVisual == mData->mTrackMiddleImage || + aVisual == mData->mTrackRightImage || + aVisual == mData->mSliderCentreGhost|| + aVisual == mData->mSliderHandle|| + aVisual == mData->mSliderHandleGhost) + { + return true; + } + return false; + } + + void MulSliderHorizontal::updateTextVisualization() + { + + } + }//namespace Alf + +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulprogressbarslider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulprogressbarslider.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,562 @@ +/* +* Copyright (c) 2007 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: Implementation for presentation element- progressbar. +* +*/ + +//Toolkit Includes +#include +#include + +// Alfred Client includes +#include +#include +#include +#include +#include +#include + +//Widget Model Includes +#include + +//Avkon Includes +#include +#include +#include + +//OpenC Includes + +#include + +//slider widget includes +#include "mulprogressbarslider.h" +#include "mulutility.h" +#include "mulsliderutils.h" +#include "mulsliderwidget.h" +#include "mulslidermodel.h" +#include "mulsliderdefinitions.h" + +// Textureid's used for comparison +const TInt KAlfProgressBarTextureId = 1; +const TInt KAlfFrameLeftTextureId = 2; +const TInt KAlfFrameCentreTextureId = 3; +const TInt KAlfFrameRightTextureId = 4; +namespace Alf + { +// Structure to store data for the progressbar element class +struct MulSliderProgressBarImpl + { + int mMaxRange; //Store Max range for progressbar from model + int mMinRange; //Store Min range for progressbar from model + int mTempMin; //Temporary stores the min range + int mTempMax; //Temporary stores the max range + int mTick; // Store Tick value for progressbar from model + int mImageTextureId; // to differtiate between textures + bool mOrientationLandScape; // check for landscape + sliderTemplate mTemplateId; //slider template id + CAlfLayout* mMainLayout; //slider main layout + int mProgressBarTextureId;// to store the auto generated texture id's + int mFrameLeftTextureId ; + int mFrameCentreTextureId; + int mFrameRightTextureId ; + CAlfLayout* mBaseSliderLayout; + CAlfImageVisual* mSliderProgressCentre; + CAlfImageVisual* mSliderSecProgressCentre; + CAlfImageVisual* mFrameLeftImage; + CAlfImageVisual* mFrameRightImage; + CAlfImageVisual* mFrameCentreImage; + CAlfTexture* mTexture; + MulSliderProgressBarImpl() + { + mTick = 0; + mMaxRange = 0; + mMinRange = 0; + mTempMax = 0; + mTempMin = 0; + mImageTextureId = 0; + mTemplateId = ESliderTemplateNone; + mProgressBarTextureId = 0; + mFrameLeftTextureId = 0; + mFrameCentreTextureId = 0; + mFrameRightTextureId = 0; + mBaseSliderLayout = NULL; + mSliderProgressCentre = NULL; + mSliderSecProgressCentre = NULL; + mOrientationLandScape = false; + } + }; +// --------------------------------------------------------------------------- +// MulSliderProgressive default constructor. +// --------------------------------------------------------------------------- +// +MulSliderProgressive::MulSliderProgressive( + CAlfWidgetControl& aControl, + const char* aName , + AlfCustomInitDataBase* /*aCustomData*/) + : mData(NULL) + { + // Base class (AlfElement) construct + construct(aControl, aName); + mData = new (EMM) MulSliderProgressBarImpl; + iBitmap = new (EMM) CFbsBitmap; + // initializes the mSlliderModel and mSliderWidget + initializeSliderData(); + + } +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulSliderProgressive::~MulSliderProgressive() + { + // Visualization Data + if(mData) + { + (&control().Env())->TextureManager().UnloadTexture(mData->mProgressBarTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mFrameLeftTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mFrameRightTextureId); + (&control().Env())->TextureManager().UnloadTexture(mData->mFrameCentreTextureId); + + delete mData; + delete iBitmap; + } + else + { + + } + + }//End of Destructor + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Getter for interfaces provided by the slider widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderProgressive::makeInterface( + const IfId& aType) + { + UString param (aType.mImplementationId); + if (param == IAlfWidgetEventHandler::type().mImplementationId) + { + return static_cast(this); + } + + else if (param == + IMulSliderBaseElementInternal::type().mImplementationId) + { + return static_cast(this); + } + + IAlfInterfaceBase* interface = 0; + interface = AlfElement::makeInterface(aType); + return interface; + } + +// --------------------------------------------------------------------------- +// Gets called when the parent layout is relayouted. +// resets all the anchor points and updates the visualization +// --------------------------------------------------------------------------- +// +void MulSliderProgressive::baseLayoutSizeChanged() + { + mData->mMainLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); + control().Env().RefreshCallBack(&(control().Env())); + // Layout the visualization w.r.t. mainlayout + layoutVisuals(mSliderModel->GetTemplate()); + if(mSliderModel->IsLandscape()) + { + if(mSliderWidget->GetOpacity()) + { + TAlfTimedValue opacity(1,0); + mData->mMainLayout->SetOpacity(opacity); + } + } + else + { + TAlfTimedValue opacity(0,0); + mData->mMainLayout->SetOpacity(opacity); + } + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + updateVisualization(); + } +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// setActiveStates +// --------------------------------------------------------------------------- +void MulSliderProgressive::setActiveStates( + unsigned int /*aStates*/) + { + //do nothing + } + +// --------------------------------------------------------------------------- +// initializes Model and Widget Pointer +// --------------------------------------------------------------------------- +// +void MulSliderProgressive::initializeSliderData() + { + // initialize the Slider Widget Pointer; + IAlfWidgetFactory& widgetFactory = + AlfWidgetEnvExtension::widgetFactory(control().Env()); + mSliderWidget = static_cast(widgetFactory.findWidget( + control().widget()->widgetName())); + + // initialize the Slider Model Pointer; + mSliderModel = static_cast(mSliderWidget->model()); + } + +// --------------------------------------------------------------------------- +// Bitmap provider +// --------------------------------------------------------------------------- +// +void MulSliderProgressive::ProvideBitmapL (TInt aId, + CFbsBitmap *& aBitmap, + CFbsBitmap *& aMaskBitmap) + { + TAknLayoutRect layoutRect; + + switch(mData->mImageTextureId) + { + case KAlfProgressBarTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, aMaskBitmap, KAvkonBitmapFile, + EMbmAvkonQgn_graf_bar_progress, + EMbmAvkonQgn_graf_bar_progress_mask ); + + TInt aHandle = aBitmap->Handle(); + + iBitmap->Duplicate(aHandle); + + AknIconUtils::SetSize( aBitmap,TSize(50,14),EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mProgressBarTextureId = aId; + } + break; + case KAlfFrameLeftTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, aMaskBitmap, KAvkonBitmapFile, + EMbmAvkonQgn_graf_bar_frame_side_l, + EMbmAvkonQgn_graf_bar_frame_side_l_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderLeft, + mData->mMainLayout, + KVariety0); + + AknIconUtils::SetSize( aBitmap,TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iWidth), + EAspectRatioNotPreserved); + + // AknIconUtils::SetSize( aBitmap,TSize(7,17),EAspectRatioNotPreserved); + + mData->mImageTextureId = 0; + mData->mFrameLeftTextureId = aId; + } + break; + case KAlfFrameRightTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, aMaskBitmap, KAvkonBitmapFile, + EMbmAvkonQgn_graf_bar_frame_side_r, + EMbmAvkonQgn_graf_bar_frame_side_r_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderRight, + mData->mMainLayout, + KVariety0); + + AknIconUtils::SetSize( aBitmap,TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iWidth), + EAspectRatioNotPreserved); + + // AknIconUtils::SetSize( aBitmap,TSize(7,17),EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mFrameRightTextureId = aId; + } + break; + case KAlfFrameCentreTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, aMaskBitmap, KAvkonBitmapFile, + EMbmAvkonQgn_graf_bar_frame_center, + EMbmAvkonQgn_graf_bar_frame_center_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderCentre, + mData->mMainLayout, + KVariety0); + + AknIconUtils::SetSize( aBitmap,TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iWidth), + EAspectRatioNotPreserved); + + // AknIconUtils::SetSize( aBitmap,TSize(308,17),EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mData->mFrameCentreTextureId = aId; + } + default: + break; + + } + + } +//---------------------------------------------------------------------------- +// layoutVisuals +//---------------------------------------------------------------------------- +void MulSliderProgressive::layoutVisuals(sliderTemplate aTemplateid) + { + + TAknLayoutRect layoutRect; + mData->mTemplateId = aTemplateid; + //Get the mainlayout rect + int mainX = mData->mMainLayout->Pos().iX.ValueNow(); + int mainY = mData->mMainLayout->Pos().iY.ValueNow(); + int mainWidth = mData->mMainLayout->Size().iX.ValueNow(); + int mainHeight = mData->mMainLayout->Size().iY.ValueNow(); + if (mData->mTemplateId == ESliderTemplate7 ) + { + + + mData->mBaseSliderLayout->SetRect( + TRect( TPoint(0,0 ), + TSize( mainWidth, mainHeight ))) ; + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderLeft, + mData->mMainLayout, + KVariety0); + + mData->mSliderProgressCentre->SetRect( + TRect( TPoint(0,0), + TSize( 0, layoutRect.Rect().Size().iHeight ))) ; + + mData->mFrameLeftImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderCentre, + mData->mMainLayout, + KVariety0); + + mData->mFrameCentreImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + + layoutRect = MulSliderUtils::GetComponentRect( + EPSliderRight, + mData->mMainLayout, + KVariety0); + mData->mFrameRightImage->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + } + + + } + +//---------------------------------------------------------------------------- +// createVisualization +//---------------------------------------------------------------------------- +void MulSliderProgressive::createVisualization(sliderTemplate templateid) + { + mData->mTemplateId = templateid; + CAlfControl *ctrl = &control(); + + // Visual Hierarchy creation + mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL); + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + mData->mMainLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + mData->mBaseSliderLayout = CAlfLayout::AddNewL(*ctrl, mData->mMainLayout); + mData->mBaseSliderLayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + mData->mSliderProgressCentre = CAlfImageVisual::AddNewL( + *ctrl,mData->mBaseSliderLayout); + mData->mFrameLeftImage = CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + mData->mFrameCentreImage = CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + mData->mFrameRightImage = CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + + if(mData->mFrameLeftImage) + { + mData->mImageTextureId = KAlfFrameLeftTextureId; + // Create the texture from bitmap provider + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfFrameLeftTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagAutoSize| + EAlfTextureFlagSkinContent))); + + int height = mData->mTexture->Size().iHeight; + int width = mData->mTexture->Size().iWidth; + + TAlfImage aImageLeft(*mData->mTexture ); + mData->mFrameLeftImage->SetImage(aImageLeft); + //mData->mFrameLeftImage->SetOpacity(0.5); + } + if(mData->mFrameCentreImage) + { + mData->mImageTextureId = KAlfFrameCentreTextureId; + // Create the texture from bitmap provider + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfFrameCentreTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagAutoSize|EAlfTextureFlagSkinContent))); + + int height = mData->mTexture->Size().iHeight; + int width = mData->mTexture->Size().iWidth; + TAlfImage aImageCentre(*mData->mTexture ); + mData->mFrameCentreImage->SetImage(aImageCentre); + } + + if(mData->mFrameRightImage) + { + mData->mImageTextureId = KAlfFrameRightTextureId; + // Create the texture from bitmap provider + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfFrameRightTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagAutoSize|EAlfTextureFlagSkinContent))); + + int height = mData->mTexture->Size().iHeight; + int width = mData->mTexture->Size().iWidth; + + + TAlfImage aImageRight(*mData->mTexture ); + + mData->mFrameRightImage->SetImage(aImageRight); + } + + if(mData->mSliderProgressCentre) + { + mData->mImageTextureId = KAlfProgressBarTextureId; + // Create the texture from bitmap provider + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId/*KAlfProgressBarTextureId*/, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagAutoSize|EAlfTextureFlagSkinContent))); + int height = mData->mTexture->Size().iHeight; + int width = mData->mTexture->Size().iWidth; + TAlfImage aImage(*mData->mTexture ); + mData->mSliderProgressCentre->SetImage(aImage); + } + + } + +// --------------------------------------------------------------------------- +// OfferEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderProgressive::offerEvent( + CAlfWidgetControl&/* aControl*/, + const TAlfEvent& /*aEvent*/ ) + { + // progress bar doesnt have any event handling + return EEventNotHandled; + } + +// --------------------------------------------------------------------------- +// UpdateVisualization +// --------------------------------------------------------------------------- +void MulSliderProgressive::updateVisualization() + { + // Call to function to set relative + //values for ranges if min range is not zero + NormalizeRange(); + int currTick = mSliderModel->PrimaryValue(); + // Calculating the relative currtick if the MinRange is not zero. + if (currTick >0 ) + { + currTick = currTick - mData->mTempMin; + } + // Set the new thumbimage position. + SetTickPosition(currTick); + } +// --------------------------------------------------------------------------- +// NormalizeRange +// --------------------------------------------------------------------------- + void MulSliderProgressive::NormalizeRange() + { + + mData->mMaxRange = mSliderModel->MaxRange(); + mData->mMinRange = mSliderModel->MinRange(); + mData->mTick = mSliderModel->Tick(); + mData->mTempMax = mData->mMaxRange; + mData->mTempMin = mData->mMinRange; + mData->mMaxRange = mData->mMaxRange - mData->mMinRange; + mData->mMinRange = 0; + } + +// --------------------------------------------------------------------------- +// accept +// --------------------------------------------------------------------------- +// +bool MulSliderProgressive::accept( + CAlfWidgetControl& /*aControl*/, + const TAlfEvent& /*aEvent*/) const + { + return false; + } +//--------------------------------------------------------------------------- +//MulSliderProgressive eventHandlerType +//------------------------------------------------------------------------- +IAlfWidgetEventHandler::AlfEventHandlerType MulSliderProgressive:: + eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + +//--------------------------------------------------------------------------- +//MulSliderProgressive eventExecutionPhase +//------------------------------------------------------------------------- +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulSliderProgressive:: + eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } +// --------------------------------------------------------------------------- +// SetTickPosition +// --------------------------------------------------------------------------- +void MulSliderProgressive::SetTickPosition(int aCurrTick) + { + //Getting slider width + int sliderWidth = mData->mBaseSliderLayout->Size().Target().iX; + //Getting the slider progress height + int sliderProgressHeight = mData->mSliderProgressCentre->Size().Target().iY; + //calculating the current postion of slider progress width + int curpos =(sliderWidth * aCurrTick)/(mData->mMaxRange - mData->mMinRange); + //setting the slider progress width + mData->mSliderProgressCentre->SetSize( + TAlfRealPoint(curpos,sliderProgressHeight),0); + int sliderProgressWidth = mData->mSliderProgressCentre->Size().Target().iX; + AknIconUtils::SetSize(iBitmap,TSize(sliderProgressWidth,sliderProgressHeight),EAspectRatioNotPreserved); + } + + +//--------------------------------------------------------------------------- +//updateTextVisualization +//------------------------------------------------------------------------- + void MulSliderProgressive::updateTextVisualization() + { + // do nothing + } + }//namespace Alf + +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulslidercontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulslidercontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2007, 2008 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: Control Implementation with utilities for slider widget. +* +*/ + +// Toolkit includes +#include +#include +#include + +// Widget model includes +#include +#include +#include "alf/alfattribute.h" +#include +#include "alf/alfmodeloperation.h" +#include + +// libc includes +#include +#include +#include + +//Widget includes + +//Internal includes +#include "mulslidercontrol.h" +#include "mulsliderwidget.h" +#include "mulslidermodel.h" +#include "imulsliderbaseelementinternal.h" + +//namespaces +using namespace osncore; +using namespace mulsliderwidget; + + +namespace Alf + { +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +MulSliderControl::MulSliderControl(CAlfEnv& aEnv) : + CAlfWidgetControl(aEnv) + { + mLayoutHeight = -1; //this means that the first draw is yet to happen. + mLayoutWidth = -1; //this means that the first draw is yet to happen. + mDragTactileFeedbackStarted = false; + mEnableTactile = false; // Next statement will make it true + mTactilefdbInstance = NULL; + EnableTactileFeedback(true); + } + + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +MulSliderControl::~MulSliderControl() + { + + } + + +// --------------------------------------------------------------------------- +// Notifies the owner that the layout of a visual has been recalculated. +// Called only when the EAlfVisualFlagLayoutUpdateNotification flag has +// been set for the visual. +// --------------------------------------------------------------------------- +// +void MulSliderControl::VisualLayoutUpdated(CAlfVisual& aVisual) + { + + TPoint visualSize = aVisual.Size().IntValueNow(); + + if((mLayoutWidth == -1 && visualSize.iX) == 0 || + (mLayoutHeight == -1 && visualSize.iY) == 0) + { + //return; /*No size assigned yet*/ + } + else + { + //do nothing + } + + if(mLayoutWidth == visualSize.iX && + mLayoutHeight == visualSize.iY) + { + //return; /* No change in layout size */ + } + else + { + //do nothing + } + + mLayoutWidth = visualSize.iX; + mLayoutHeight = visualSize.iY; + IAlfElement* baseelement = findElement ("BaseElement"); + IMulSliderBaseElementInternal* elementInternal = + static_cast ( + baseelement->makeInterface(IMulSliderBaseElementInternal::type())); + if(elementInternal) + { + elementInternal->baseLayoutSizeChanged(); + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------------------------- +// Returns top level layout. +// --------------------------------------------------------------------------- +// +CAlfLayout* MulSliderControl::ContainerLayout( + const CAlfControl* /*aConnected*/) const + { + if(VisualCount()) + { + //Return the root layout of the control + return(static_cast (&Visual(0))); + } + else + { + return NULL; + } + } + + +// --------------------------------------------------------------------------- +// From base class CAlfWidgetControl +// Handle Alfred events. +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderControl::handleEvent( const TAlfEvent& aEvent ) + { + AlfEventStatus ret = EEventNotHandled; + IAlfElement *base = findElement("BaseElement"); + if(base) + { + IAlfWidgetEventHandler* element = + static_cast ( + base->makeInterface(IAlfWidgetEventHandler::type())); + + if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventMissedPointerUp) + { + ret = element->offerEvent(*this,aEvent); + } + } + else if(aEvent.IsKeyEvent() || + aEvent.IsPointerEvent()) + { + // if the type of base element is slider , then + // convert the event to custom event + IMulSliderBaseElementInternal* elementInternal = + static_cast ( + base->makeInterface(IMulSliderBaseElementInternal::type())); + ret = element->offerEvent(*this , aEvent); + } + else + { + } + } + return ret; + } + + +// --------------------------------------------------------------------------- +// From base class CAlfWidgetControl. +// Notification that data is about to change in the data model. +// --------------------------------------------------------------------------- +// +void MulSliderControl::dataChanging(const AlfModelOperation& /*aOperation*/) + {} + + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the list widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderControl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + + return CAlfWidgetControl::makeInterface(aType); + } + +// --------------------------------------------------------------------------- +// +// removeAndDestroyElement +// +// --------------------------------------------------------------------------- +// +void MulSliderControl::removeAndDestroyElement(const IAlfElement& /*aElement*/) + { + // reset the variables + mLayoutWidth = -1; + mLayoutHeight = -1; + + CAlfWidgetControl::removeAndDestroyElement(*findElement("BaseElement")); + } +//---------------------------------------------------------------------- +// +//enableTactileFeedback +//---------------------------------------------------------------------- +void MulSliderControl::EnableTactileFeedback(bool aEnabled) + { + if (!mTactilefdbInstance) + { + mEnableTactile = aEnabled; + mTactilefdbInstance = MTouchFeedback::Instance(); + } + } +//---------------------------------------------------------------------- +//TactileEffectOnTouch +// +//---------------------------------------------------------------------- +void MulSliderControl::TactileEffectOnTouchandHold() + { + if (mTactilefdbInstance) + { + mTactilefdbInstance->InstantFeedback(ETouchFeedbackSlider); + } + } +//---------------------------------------------------------------------- +//TactileEffectOnDrag +// +//---------------------------------------------------------------------- +void MulSliderControl::TactileEffectOnDrag(TAlfEvent& aEvent, int aIntensity) +{ + if (mTactilefdbInstance) + { + CCoeControl* ccoecntrl = static_cast(Display()->ObjectProvider()); + TInt intensity = aIntensity; + TTimeIntervalMicroSeconds32 timespan = 400000; + mTactilefdbInstance->StartFeedback(ccoecntrl,ETouchDynamicSlider,&aEvent.PointerEvent(),intensity,timespan); + mDragTactileFeedbackStarted = true; + } +} +//------------------------------------------------------------------------------- +// +// TactileEffectOnRelease +//-------------------------------------------------------------------------------- +// +void MulSliderControl::TactileEffectOnRelease() +{ + if (mTactilefdbInstance) + { + if ( mDragTactileFeedbackStarted ) + { + // Touch Release on Thumb after drag + CCoeControl* ccoecntrl = static_cast(Display()->ObjectProvider()); + mTactilefdbInstance->StopFeedback(ccoecntrl); + mDragTactileFeedbackStarted = false; + } + else + { + // Touch Release on thumb + mTactilefdbInstance->InstantFeedback(ETouchFeedbackSlider); + } + } +} +}//End of namespace Alf +//End of File + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulsliderlongtaptimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulsliderlongtaptimer.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007-2008 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: Slider long tap timer + * +*/ + + + +// Include Files + +// Class header +#include "mulsliderlongtaptimer.h" +#include "mulsliderdefinitions.h" + +const int KInitialtimeinterval = 200000; +const int KTimeinterval = 100000; +namespace Alf + { + +//--------------------------------------------------------------------------- +// Constructor +//--------------------------------------------------------------------------- +// +MulSliderLongTapTimer::MulSliderLongTapTimer( + IMulSliderBaseElementInternal* aBaseElement) + :CActive(EPriorityStandard) + { + iTimer.CreateLocal(); + iBaseElement = aBaseElement; + CActiveScheduler::Add(this); + iState = EStopped; + } + +//--------------------------------------------------------------------------- +// Destructor +//--------------------------------------------------------------------------- +// +MulSliderLongTapTimer::~MulSliderLongTapTimer() + { + Stop(); + iTimer.Close(); + } +//--------------------------------------------------------------------------- +// Activates the timer. +//--------------------------------------------------------------------------- +// +void MulSliderLongTapTimer::Start() + { + if (!IsActive()) + { + iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KInitialtimeinterval)); + SetActive(); + } + iState = ERunning; + } +//--------------------------------------------------------------------------- +// stops the timer. +//--------------------------------------------------------------------------- +// +void MulSliderLongTapTimer::Stop() + { + Cancel(); + iState = EStopped; + } +//--------------------------------------------------------------------------- +// Handles an active object's request completion event. +//--------------------------------------------------------------------------- +// +void MulSliderLongTapTimer::RunL() + { + IMulSliderBaseElementInternal* elementInternal = + static_cast ( + iBaseElement->makeInterface(IMulSliderBaseElementInternal::type())); + if(elementInternal) + { + // call handleLongTap of element to handle the longtap + elementInternal->handleLongTap(); + } + if (iState == ERunning) + { + iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KTimeinterval)); + SetActive(); + } + } + +//--------------------------------------------------------------------------- +// Implements cancellation of an outstanding request. +//--------------------------------------------------------------------------- +// +void MulSliderLongTapTimer::DoCancel() + { + iTimer.Cancel(); + } + + + } + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulslidermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulslidermodel.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,683 @@ +/* +* Copyright (c) 2007-2008 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: Implementation of slider model interface + * +*/ + +//Class headers +#include "mulslidermodel.h" + +// Alf headers + +#include +#include +#include + +// Osn Headers +#include //for new(EMM) +#include +#include +#include +#include + +// For Common strings + +#include "mulslidervertical.h" +#include "mulsliderwidget.h" + +const int KMaxrange = 100; +const int KTick = 1; +const int KSize = 50; +namespace Alf +{ + +struct SliderModelDataImpl + { + int mSldMaxRange;// Slider Maximum Value + int mSldMinRange;// Slider Maximum Value + int mSldTick;// Size of single click movement + int mSldPrimaryTick;// Current Handle Position + int mSldSecondaryTick;// Secondary progress position + char* mSldLeftText;// Left text + char* mSldRightText;// Right text + char* mSldPercentText;// Percentage text for zoom slider + MulSliderWidget* mSliderWidget; + IMulSliderBaseElementInternal * mSliderElement;// Element pointer + sliderTemplate mTemplateId; // template ID + std::auto_ptr mItem; + SliderModelDataImpl() + { + mItem = ( new (EMM) MulVisualItem() ); + mSldMaxRange = KMaxrange; + mSldMinRange = 0; + mSldTick = KTick; + mSldPrimaryTick = 0; + mSldSecondaryTick = 0; + mSldLeftText = NULL; + mSldRightText =NULL; + mSldPercentText = NULL; + mSliderWidget = NULL; + mSliderElement = NULL; + mTemplateId = ESliderTemplateNone; + } + }; + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +MulSliderModel::MulSliderModel(): +mModel ( NULL ) + { + mSldrModelData = new(EMM)SliderModelDataImpl(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulSliderModel::~MulSliderModel() + { + if(mSldrModelData) + { + delete mSldrModelData; + } + else + { + + } + } + +// --------------------------------------------------------------------------- +// SetData +// --------------------------------------------------------------------------- +// +void MulSliderModel::SetData(const MulVisualItem& aSliderItem) + { + + UString str; + + + if(aSliderItem.Attribute(mulvisualitem::KMulMaxRange)) + { + SetMaxRange( + aSliderItem.AttributeAsInt(mulvisualitem::KMulMaxRange)); + } + if(aSliderItem.Attribute(mulvisualitem::KMulMinRange)) + { + SetMinRange( + aSliderItem.AttributeAsInt(mulvisualitem::KMulMinRange)); + } + if(aSliderItem.Attribute(mulvisualitem::KMulTick)) + { + SetTick(aSliderItem. + AttributeAsInt(mulvisualitem::KMulTick)); + } + if(aSliderItem.Attribute(mulvisualitem::KMulPrimaryTick)) + { + SetPrimaryValue(aSliderItem. + AttributeAsInt(mulvisualitem::KMulPrimaryTick)); + } + if(aSliderItem.Attribute(mulvisualitem::KMulSecondaryTick)) + { + SetSecondaryValue(aSliderItem. + AttributeAsInt(mulvisualitem::KMulSecondaryTick)); + } + + if(aSliderItem.Attribute(mulvisualitem::KMulPercent1)) + { + + int percentValue = aSliderItem. + AttributeAsInt(mulvisualitem::KMulPercent1); + + _LIT8(KPercent,""); + TBuf8 PercentText(KPercent); + PercentText.AppendNum (percentValue); + PercentText.Append(_L("%")); + mSldrModelData->mSldPercentText = (char*)PercentText.PtrZ(); + + } + + UpdateElement(); + } + + +// --------------------------------------------------------------------------- +// Return MulVisual Item +// --------------------------------------------------------------------------- +// +const MulVisualItem& MulSliderModel::Data() const + { + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulMaxRange, + (int)mSldrModelData->mSldMaxRange); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulMinRange, + (int)mSldrModelData->mSldMinRange); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulTick, + (int)mSldrModelData->mSldTick); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulPrimaryTick, + (int)mSldrModelData->mSldPrimaryTick); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulSecondaryTick, + (int)mSldrModelData->mSldSecondaryTick); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulCounter1, + (int)mSldrModelData->mSldLeftText ); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulCounter2, + (int)mSldrModelData->mSldRightText ); + mSldrModelData->mItem->SetAttribute ( mulvisualitem::KMulPercent1, + (int)mSldrModelData->mSldPercentText ); + return *(mSldrModelData->mItem); + } + +// --------------------------------------------------------------------------- +// SetValue +// --------------------------------------------------------------------------- +// +void MulSliderModel::SetPrimaryValue(int aValue) + { + int maxRange = mSldrModelData->mSldMaxRange; + int minRange = mSldrModelData->mSldMinRange; + // Validate aValue + if(aValue != mSldrModelData->mSldPrimaryTick) + { + if( (aValue >= minRange) && (aValue <= maxRange)) + { + mSldrModelData->mSldPrimaryTick = aValue; + } + else if(aValue <= minRange) + { + mSldrModelData->mSldPrimaryTick = minRange; + } + else if(aValue >= maxRange) + { + mSldrModelData->mSldPrimaryTick = maxRange; + } + // Update the visualization + if(GetElement()) + { + GetElement()->updateVisualization(); + } + } + } + +// --------------------------------------------------------------------------- +// Gets the Slider Element +// --------------------------------------------------------------------------- +// +IMulSliderBaseElementInternal* MulSliderModel::GetElement() + { + if(mSldrModelData->mSliderWidget) + { + return mSldrModelData->mSliderWidget->GetSliderElement(); + } + else + { + + } + return NULL; + } + + + // --------------------------------------------------------------------------- +// update element visualization +// --------------------------------------------------------------------------- +// +void MulSliderModel::UpdateElement() + { + if(mSldrModelData->mSliderWidget) + { + if(mSldrModelData->mSliderWidget->GetSliderElement()) + { + mSldrModelData->mSliderWidget->GetSliderElement()->updateVisualization(); + } + } + } + +// --------------------------------------------------------------------------- +// Value +// --------------------------------------------------------------------------- +// +int MulSliderModel::PrimaryValue() const + { + return mSldrModelData->mSldPrimaryTick; + } + +// --------------------------------------------------------------------------- +// SetValue +// --------------------------------------------------------------------------- +// +void MulSliderModel::SetSecondaryValue(int aValue) + { + int maxRange = mSldrModelData->mSldMaxRange; + int minRange = mSldrModelData->mSldMinRange; + if(mSldrModelData->mSldSecondaryTick != aValue) + { + // Validate aValue + if( (aValue >= minRange) && (aValue <= maxRange)) + { + mSldrModelData->mSldSecondaryTick = aValue; + } + + UpdateElement(); + } + } + +// --------------------------------------------------------------------------- +// Value +// --------------------------------------------------------------------------- +// +int MulSliderModel::SecondaryValue() const + { + return mSldrModelData->mSldSecondaryTick; + } + + +// --------------------------------------------------------------------------- +// TotalTicks +// --------------------------------------------------------------------------- +// +int MulSliderModel::TotalTicks() const + { + //MUL_LOG_INFO("CMulSliderModel::TotalTicks"); + + int maxRange = mSldrModelData->mSldMaxRange; + int minRange = mSldrModelData->mSldMinRange; + int tick = mSldrModelData->mSldTick; + if(tick == 0) + { + tick = 1; + } + return ((maxRange-minRange)/tick); + } + +// --------------------------------------------------------------------------- +// SetTemplate +// --------------------------------------------------------------------------- +// +void MulSliderModel::SetTemplate( sliderTemplate aTemplateId) + { + if(mSldrModelData->mTemplateId != aTemplateId) + { + mSldrModelData->mTemplateId = aTemplateId; + if(mSldrModelData->mSliderWidget) + { + // Change the tempate + mSldrModelData->mSliderWidget->changeTemplate(aTemplateId); + } + else + { + //do nothing + } + } + } + +// --------------------------------------------------------------------------- +// makeInterface +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderModel::makeInterface( const IfId& aType) + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + IAlfInterfaceBase* ret(0); + UString param(aType.mImplementationId); + if ( param == IMulSliderModel::type().mImplementationId ) + { + ret = static_cast(this); + } + else if(param == IAlfModel::type().mImplementationId) + { + ret = static_cast(this); + } + return ret; + + } + +// --------------------------------------------------------------------------- +// SetMinRange +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetMinRange(int aMinRange) + { + // Validate aMinRange + if(aMinRange != mSldrModelData->mSldMinRange) + { + mSldrModelData->mSldMinRange = aMinRange; + + if(aMinRange > mSldrModelData->mSldMaxRange) + { + mSldrModelData->mSldMaxRange = aMinRange; + mSldrModelData->mSldTick = 0; + } + else + { + if(mSldrModelData->mSldTick > mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange || mSldrModelData->mSldTick == 0) + { + mSldrModelData->mSldTick = mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange; + } + } + + mSldrModelData->mSldPrimaryTick = aMinRange; + UpdateElement(); + } + + } + +// --------------------------------------------------------------------------- +// SetMaxRange +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetMaxRange(int aMaxRange) + { + if(aMaxRange != mSldrModelData->mSldMaxRange) + { + mSldrModelData->mSldMaxRange = aMaxRange; + + if(aMaxRange < mSldrModelData->mSldMinRange) + { + mSldrModelData->mSldMinRange = aMaxRange; + mSldrModelData->mSldTick = 0; + } + else + { + if(mSldrModelData->mSldTick > mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange || mSldrModelData->mSldTick == 0 ) + { + mSldrModelData->mSldTick = mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange; + } + } + + mSldrModelData->mSldPrimaryTick = mSldrModelData->mSldMinRange; + UpdateElement(); + } + } + +// --------------------------------------------------------------------------- +// MinRange +// --------------------------------------------------------------------------- +// + +int MulSliderModel::MinRange() const + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldMinRange; + } + +// --------------------------------------------------------------------------- +// MaxRange +// --------------------------------------------------------------------------- +// + +int MulSliderModel::MaxRange() const + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldMaxRange; + } +// --------------------------------------------------------------------------- +// SetTick +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetTick(int aTick) + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + if(aTick != mSldrModelData->mSldTick && aTick > 0) + { + if(aTick > mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange) + { + mSldrModelData->mSldTick = mSldrModelData->mSldMaxRange - mSldrModelData->mSldMinRange; + } + else + { + mSldrModelData->mSldTick = aTick; + } + mSldrModelData->mSldPrimaryTick = mSldrModelData->mSldMinRange; + if(GetElement()) + { + GetElement()->updateVisualization(); + } + } + } + +// --------------------------------------------------------------------------- +// Tick +// --------------------------------------------------------------------------- +// + +int MulSliderModel::Tick() const + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldTick; + } + + +// --------------------------------------------------------------------------- +// SetRightText +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetRightText(char* aRightText) + { + if(aRightText) + { + mSldrModelData->mSldRightText = aRightText; + UpdateElement(); + } + + } + +// --------------------------------------------------------------------------- +// SetLeftText +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetLeftText(char* aLeftText) + { + if(aLeftText) + { + mSldrModelData->mSldLeftText = aLeftText; + UpdateElement(); + } + } + +// --------------------------------------------------------------------------- +// SetPercentText +// --------------------------------------------------------------------------- +// + +void MulSliderModel::SetPercentText(char* aPercText) + { + if(aPercText) + { + mSldrModelData->mSldPercentText = aPercText; + if(GetElement()) + { + GetElement()->updateTextVisualization(); + } + } + + } + +// --------------------------------------------------------------------------- +// GetRightText +// --------------------------------------------------------------------------- +// + +const char* MulSliderModel::GetRightText() + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldRightText; + } + +// --------------------------------------------------------------------------- +// GetLeftText +// --------------------------------------------------------------------------- +// + +const char* MulSliderModel::GetLeftText() + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldLeftText; + } + +// --------------------------------------------------------------------------- +// GetPercentText +// --------------------------------------------------------------------------- +// + +const char* MulSliderModel::GetPercentText() + { + //MUL_LOG_INFO("CMulSliderModel::makeInterface"); + return mSldrModelData->mSldPercentText; + } + + +// --------------------------------------------------------------------------- +// addModelChangeObserver +// --------------------------------------------------------------------------- +// +void MulSliderModel::addModelChangeObserver( IAlfModelChangeObserver& /*aObserver*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::addModelChangeObserver"); + } + +// --------------------------------------------------------------------------- +// removeModelChangeObserver +// --------------------------------------------------------------------------- +// +void MulSliderModel::removeModelChangeObserver( IAlfModelChangeObserver& /*aObserver*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::removeModelChangeObserver"); + } + +// --------------------------------------------------------------------------- +// setData +// --------------------------------------------------------------------------- +// +void MulSliderModel::setData( IAlfVariantType* /*aData*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::setData"); + } + +// --------------------------------------------------------------------------- +// updateData +// --------------------------------------------------------------------------- +// +void MulSliderModel::updateData(int /*aNumContainerIndices*/,int* /*aContainerIndices*/, + IAlfVariantType* /*aData*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::updateData"); + } + +// --------------------------------------------------------------------------- +// addData +// --------------------------------------------------------------------------- +// +void MulSliderModel::addData(int /*aNumContainerIndices*/,int* /*aContainerIndices*/, + IAlfVariantType* /*aData*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::addData"); + } + +// --------------------------------------------------------------------------- +// removeData +// --------------------------------------------------------------------------- +// +void MulSliderModel::removeData(int /*aNumContainerIndices*/,int* /*aContainerIndices*/ ) + { + //MUL_LOG_INFO("CMulSliderModel::removeData"); + } + +// --------------------------------------------------------------------------- +// executeOperations +// --------------------------------------------------------------------------- +// +void MulSliderModel::executeOperations(AlfPtrVector& /*aOperationsArray*/) + { + //MUL_LOG_INFO("CMulSliderModel::executeOperations"); + + + } + +// --------------------------------------------------------------------------- +// executeOperation +// --------------------------------------------------------------------------- +// +void MulSliderModel::executeOperation(AlfModelOperation* /*aOperation*/) + { + //MUL_LOG_INFO("CMulSliderModel::executeOperation"); + } + +// --------------------------------------------------------------------------- +// clearModel +// --------------------------------------------------------------------------- +// +void MulSliderModel::clearModel() + { + //MUL_LOG_INFO("CMulSliderModel::clearModel"); + } + +// --------------------------------------------------------------------------- +// data +// --------------------------------------------------------------------------- +// +IAlfVariantType* MulSliderModel::data() const + { + //MUL_LOG_INFO("CMulSliderModel::data"); + return NULL; + } + +// --------------------------------------------------------------------------- +// StoreWidget +// --------------------------------------------------------------------------- +// +void MulSliderModel::storeWidget(MulSliderWidget* aWidget) + { + mSldrModelData->mSliderWidget = aWidget; + } +// --------------------------------------------------------------------------- +// GetTemplate +// --------------------------------------------------------------------------- +// +sliderTemplate MulSliderModel::GetTemplate() + { + return mSldrModelData->mTemplateId ; + } + +// --------------------------------------------------------------------------- +// IsLandscape +// +// --------------------------------------------------------------------------- +// + bool MulSliderModel::IsLandscape() + { + + bool landscape = false; + if(mSldrModelData->mSliderWidget) + { + TSize size = AlfUtil::ScreenSize(); + if(size.iHeight < size.iWidth) + { + landscape = true; + } + else if(size.iWidth < size.iHeight) + { + landscape = false; + } + } + return landscape; + } + + } // Namespace Alf + +//End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulsliderutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulsliderutils.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,291 @@ +/* +* 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: Utilities for slider widget. +* +*/ + + + + + +#include +#include "mulsliderdefinitions.h" +#include "mulsliderutils.h" +#include +#include +#include +#include +#include +#include "mulutility.h" + + +namespace Alf + { + + //------------------------------------------------------------------------ + // GetComponentRect + //------------------------------------------------------------------------ + TAknLayoutRect MulSliderUtils::GetComponentRect( + SliderLCTIDs aId,CAlfLayout *aLayout,int aVariety) + { + TAknLayoutRect layoutRect; + TPoint layoutRectSize = aLayout->Size().IntValueNow(); + + TRect rect2(0, + 0, + layoutRectSize.iX, + layoutRectSize.iY); + switch(aId) + { + case EVSliderPane: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel::aaslider_pane(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + + case EVSliderBackground: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_pane_g1(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + + case EVSliderBgPane: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_cp001(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2,LayoutHandle); + } + break; + + case EVSliderTop: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_cp001_g1(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2,LayoutHandle); + } + break; + + case EVSliderMiddle: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_cp001_g3(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2,LayoutHandle); + } + break; + + case EVSliderEnd: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_cp001_g2(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2,LayoutHandle); + } + break; + + case EVSliderPlus: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel::aaslider_pane_g4(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + + case EVSliderMinus: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_pane_g5(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + + case EVSliderMarker: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_pane_g2(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + + case EVSliderInnerRect: + { + TAknWindowLineLayout LayoutHandleInner = + AknLayoutScalable_UiAccel:: + aid_aaslider_pane_rect_inner(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandleInner); + } + break; + /*case EVSliderAudioImage: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_pane_g3(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2,LayoutHandle); + } + break;*/ + + case EHSliderPane: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aacf_slider_pane(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,TrackLayoutHandle); + } + break; + + case EHSliderBase: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aacf_slider_pane(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,TrackLayoutHandle); + } + break; + + case EHSliderCenter: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, TrackLayoutHandle); + } + break; + + case EHSliderLeft: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_g1(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,TrackLayoutHandle); + } + break; + + case EHSliderCentre: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_g2_copy1(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,TrackLayoutHandle); + } + break; + + case EHSliderRight: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_bg_pane_g2(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,TrackLayoutHandle); + } + break; + + /*case EHSliderHandle: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aaslider_pane_g2(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, TrackLayoutHandle); + } + break;*/ + case EHSliderHandle: + { + TAknWindowLineLayout TrackLayoutHandle = + AknLayoutScalable_UiAccel:: + aacf_slider_pane_g1(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, TrackLayoutHandle); + } + break; + case EVSliderMarkerExtended: + { + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aid_touch_size_slider_marker(aVariety).LayoutLine(); + layoutRect.LayoutRect( rect2,LayoutHandle); + } + break; + case EPSliderLeft: + { + TAknWindowLineLayout ProgressPaneLeft = + AknLayoutScalable_UiAccel:: + aalist_progress_pane_g1(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, ProgressPaneLeft); + } + break; + + case EPSliderCentre: + { + TAknWindowLineLayout ProgressPaneCentre = + AknLayoutScalable_UiAccel:: + aalist_progress_pane_g2(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, ProgressPaneCentre); + } + break; + + case EPSliderRight: + { + TAknWindowLineLayout ProgressPaneRight = + AknLayoutScalable_UiAccel:: + aalist_progress_pane_g3(aVariety).LayoutLine(); + layoutRect.LayoutRect(rect2, ProgressPaneRight); + } + break; + default: ; + + }// end of switch + + return layoutRect; + + } + + //------------------------------------------------------------------------- + // GetTextComponentRect + //------------------------------------------------------------------------- + TAknLayoutText MulSliderUtils::GetTextComponentRect( + SliderLCTIDs aId, CAlfLayout *aLayout, int aVariety) + { + TAknLayoutText textRect; + + TRect rect2(0, + 0, + aLayout->Size().iX.ValueNow(), + aLayout->Size().iY.ValueNow()); + switch(aId) + { + case EVSliderZoomText: + { + TAknTextLineLayout textLayout = + AknLayoutScalable_UiAccel::aaslider_pane_t3(aVariety).LayoutLine(); + textRect.LayoutText(rect2, textLayout ); + } + break; + + default: ; + + } + + return textRect; + } + + + } // End of namespace Alf + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulsliderwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulsliderwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,441 @@ +/* +* Copyright (c) 2007, 2008 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: Implementation for slider widget. + * +*/ + + +// Alfred Client includes +#include + +// Widget Model includes +#include "alf/alfelement.h" + +// Widget Includes +#include "imulsliderbaseelementinternal.h" +#include +// Internal includes +#include "mulslidervertical.h" +#include "mulsliderwidget.h" +#include "mulslidermodel.h" +#include "mulslidercontrol.h" +#include +using namespace mulsliderwidget; + +using Alf::CommonWidgetEvent; +namespace Alf + { + +// --------------------------------------------------------------------------- +// Creator Method. +// --------------------------------------------------------------------------- +// +MulSliderWidget* MulSliderWidget :: create( + CAlfEnv& aEnv, + IAlfContainerWidget& aContainer, + const char* aWidgetId, + AlfCustomInitDataBase* aCustomData) + { + + return (new( EMM ) MulSliderWidget(aEnv, + aContainer, aWidgetId,aCustomData)); + } + + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +MulSliderWidget::~MulSliderWidget() + { + if(mSliderModel) + { + delete mSliderModel; + } + else + { + + } + } + +/** + * Get the model for widget. + * + * @return model of the slider widget + */ +IMulSliderModel& MulSliderWidget::SliderModel() + { + return *mSliderModel; + } +/** + * Set the transparency for the background of the slider widget. + * + * @param True, to set background as transparent + * @param False, to set background as opaque + */ + void MulSliderWidget::MakeTransparent( bool aTransparent) + { + mElement->MakeTransparent(aTransparent); + } + +/** + * Enable/Disable key handling . + * + * @param aVal: True, to handle keyevents by Application + * False, to handle keyevents as defined in the control + */ +void MulSliderWidget::SetHandleKeyEvent( bool aVal ) + { + mHandleKeyEvent = aVal; + } +/** + * + * Returns KeyEvent enable status + * + */ +bool MulSliderWidget::IsKeyEnabled() + { + return mHandleKeyEvent; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidget. +// Getter for the parent container. The ownership not passed. +// --------------------------------------------------------------------------- +// +IAlfContainerWidget* MulSliderWidget::parent() const + { + return mWidget->parent(); + } + + +// From class MAlfInterfaceBase. + +// --------------------------------------------------------------------------- +// Getter for interfaces provided by the slider widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderWidget :: makeInterface(const IfId& aType) + { + UString param ( aType.mImplementationId ); + + if (param == IMulSliderWidget::type().mImplementationId) + { + return static_cast(this); + } + else if (param == IAlfWidget::type().mImplementationId) + { + return static_cast(this); + } + + else + { + //do nothing + } + + // @todo other interfaces + return mWidget->makeInterface(aType); + } + + +// From class IAlfWidget. + +// --------------------------------------------------------------------------- +// Getter for the control. The ownership is not passed. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl* MulSliderWidget :: control() const + { + //return mSliderControl; + return mWidget->control(); + } + + +// --------------------------------------------------------------------------- +// Setter for the control. The control is owned by the Alfred environment. +// --------------------------------------------------------------------------- +// +void MulSliderWidget :: setControl( + CAlfWidgetControl* aControl, bool /*aDeletePreviousControl*/ ) + { + mSliderControl = aControl; + mWidget->setControl(aControl); + } + + +// --------------------------------------------------------------------------- +// Getter for the model. The ownership is not passed. +// --------------------------------------------------------------------------- +// +IAlfModel* MulSliderWidget :: model() + { + return mSliderModel; + } + + +// --------------------------------------------------------------------------- +// Setter for the model. Ownership is passed and the old model is released. +// --------------------------------------------------------------------------- +// +void MulSliderWidget :: setModel( IAlfModel* aModel, bool /*aTakeOwnerShip*/) + { + + if(aModel==NULL) + { + // Destroy the visualization if Model is NULL. + if(mElement) + { + // Destroy the visual tree + mSliderControl->Visual(0).RemoveAndDestroyAllD(); + // Removes the element from control and destroys it + mSliderControl->removeAndDestroyElement(*((IAlfElement *)mElement)); + mElement = NULL; + } + delete mSliderModel; + mSliderModel = NULL; + } + else + { + if(mSliderModel) + { + delete mSliderModel; + mSliderModel = NULL; + } + mSliderModel = static_cast( aModel->makeInterface( + IMulSliderModel::type())); + MulSliderModel* sliderModel = (MulSliderModel*)mSliderModel; + // Store the widget pointer in model + sliderModel->storeWidget(this); + if(mElement) + { + // Destroy the visual tree + mSliderControl->Visual(0).RemoveAndDestroyAllD(); + // Removes the element from control and destroys it + mSliderControl->removeAndDestroyElement(*((IAlfElement *)mElement)); + mElement = NULL; + } + if(mSliderModel) + { + sliderTemplate tmplateID = sliderModel->GetTemplate(); + if(tmplateID != ESliderTemplateNone) + { + switch(tmplateID) + { + case ESliderTemplate3:// zoom slider + CreateSliderElement(KSliderVerticalElement); + break; + case ESliderTemplate7:// progressbar + CreateSliderElement(KSliderProgressbarElement); + break; + default:// rest all tempaltes are horizonatal + CreateSliderElement(KSliderHorizontalElement); + } + if(mElement) + { + mElement->createVisualization(tmplateID); + ShowWidget(!IsHidden()); + } + + } + } + } + }// End of setModel + +// --------------------------------------------------------------------------- +// Get the name of the widget instance. +// --------------------------------------------------------------------------- +// +const char* MulSliderWidget :: widgetName() const + { + return mWidget->widgetName(); + } + +// --------------------------------------------------------------------------- +// Sets/Releases the Focus from child widget of container. +// --------------------------------------------------------------------------- +// +void MulSliderWidget::setChildFocus(bool /*aFocus*/) + { + } + +//--------------------------------------------------------------------------- +// Creates the presentation for the widget from XML. Destroys any existing +// presentation. +//--------------------------------------------------------------------------- +// +void MulSliderWidget::setPresentation(const char* /*aFilePath*/) + { + } + + +//--------------------------------------------------------------------------- +// Gets the Widget Opacity +// +//--------------------------------------------------------------------------- +// +bool MulSliderWidget::GetOpacity() + { + return mOpacity; + } + +//--------------------------------------------------------------------------- +// Gets the Widget Opacity +// +//--------------------------------------------------------------------------- +// +bool MulSliderWidget::IsHidden() + { + return !mOpacity; + } + +// --------------------------------------------------------------------------- +// Default constructor. +// --------------------------------------------------------------------------- +// +MulSliderWidget::MulSliderWidget( + CAlfEnv& aEnv, IAlfContainerWidget& aContainer, + const char* aWidgetId, + AlfCustomInitDataBase* /*aCustomData*/) + { + // Default widget is shown + mOpacity = true; + mSliderModel = NULL; + mElement = NULL; + mHandleKeyEvent = true; + mWidget.reset(new(EMM) AlfWidget(aWidgetId,aContainer,aEnv)); + // Default Imperative Construction + // Create Control + CAlfWidgetControl* ctrl = constructDefaultControl(aEnv); + setControl(ctrl); + } + +void MulSliderWidget::CreateSliderElement(const char* aElementId) + { + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory( + control()->Env()); + + IAlfElement * baseelement = widgetFactory.createElement + ( aElementId, + baseElementName(), + *control(), + NULL, + NULL ); + + // Store the element pointer + mElement = static_cast( + baseelement->makeInterface( + IMulSliderBaseElementInternal::type())); + } + +// --------------------------------------------------------------------------- +// Construct and returns Slider Control. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl *MulSliderWidget::constructDefaultControl(CAlfEnv& aEnv) + { + return(new(EMM) MulSliderControl(aEnv) ); + } + +void MulSliderWidget::changeTemplate(int /*aTemplateId*/) + { + if( mSliderModel ) + { + if(mElement) + { + mSliderControl->Visual(0).RemoveAndDestroyAllD(); + mSliderControl->removeAndDestroyElement(*((IAlfElement*)mElement)); + // delete baseelement; + mElement = NULL; + } + + MulSliderModel* sliderModel = (MulSliderModel*)mSliderModel; + sliderTemplate i = sliderModel->GetTemplate(); + switch(i) + { + case ESliderTemplateNone :// no template id is set + return; + case ESliderTemplate3:// zoom slider + CreateSliderElement(KSliderVerticalElement); + break; + case ESliderTemplate7:// progressbar + CreateSliderElement(KSliderProgressbarElement); + break; + default:// rest aal tempaltes are horizonatal + CreateSliderElement(KSliderHorizontalElement); + } + mElement->createVisualization(i); + ShowWidget(!IsHidden()); + } + } + +void MulSliderWidget::ShowWidget(bool opacity,int aTransitionTime) + { + mOpacity = opacity; + if(mElement && mSliderModel) + { + MulSliderModel* sliderModel = static_cast(mSliderModel); + + if( sliderModel->GetTemplate() == ESliderTemplate3 && !mOpacity) + { + mElement->stopEvents(); + } + CAlfLayout *layout = mSliderControl->ContainerLayout(NULL); + TAlfTimedValue t1(0,aTransitionTime); + if(opacity) + { + t1.SetTarget(1,aTransitionTime); + } + + layout->SetOpacity(t1); + } + } + +// --------------------------------------------------------------------------- +// Get the root layout of slider +// --------------------------------------------------------------------------- +// +const CAlfLayout& MulSliderWidget ::ContainerLayout() + { + CAlfLayout* layout = mSliderControl->ContainerLayout(NULL); + return *layout; + } + +// --------------------------------------------------------------------------- +// AddEventHandler +// --------------------------------------------------------------------------- +// +void MulSliderWidget::AddEventHandler( IAlfWidgetEventHandler& aObserver) + { + control()->addEventHandler(&aObserver); + } + +// --------------------------------------------------------------------------- +// RemoveEventHandler +// --------------------------------------------------------------------------- +// +void MulSliderWidget::RemoveEventHandler( IAlfWidgetEventHandler& aObserver) + { + control()->removeEventHandler(aObserver); + } +// --------------------------------------------------------------------------- +// RemoveEventHandler +// --------------------------------------------------------------------------- +// +IMulSliderBaseElementInternal* MulSliderWidget::GetSliderElement() + { + return mElement; + } + + }//End of Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulsliderwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulsliderwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,244 @@ +/* +* 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; + } + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/mulsliderwidget/src/mulverticalslider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/mulsliderwidget/src/mulverticalslider.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1431 @@ +/* +* Copyright (c) 2007 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: Implementation for presentation element - vertical. +* +*/ + +//Toolkit Includes +#include +#include + +// Alfred Client includes +#include +#include +#include +#include +#include +#include +#include +#include + +//Widget Model Includes +#include +#include +#include + +//Avkon Includes +#include +#include +#include +#include +#include +//#include + +//slider widget includes +#include "mulslidervertical.h" +#include +#include "mulsliderwidget.h" +#include "mulslidercontrol.h" +#include "mulslidermodel.h" +#include "mulsliderdefinitions.h" +#include "mulsliderutils.h" + +//Timer function includes +#include "mulsliderlongtaptimer.h" +#include +namespace Alf + { +// Structure to store data for the slider element class +struct MulVerticalSliderDataImpl + { + bool mOperation;// Drag state + bool mSliderHit;// button down has happened on slider visual + float mTickInPixels;// Tick size in Pixel + int mRangeInPixels;// Range in Pixel + int mCurrTickInPixels;// Current Tick posion in pixels + CAlfVisual * mVisual;// Stores the current visual hit + TPoint mDragPoint;// Point at which drag started + TPoint mLongTapPos;// Point at which button down happened + TSize mTrackTopImageSizePrt; + TSize mTrackTopImageSizeLsc; + TSize mTrackMiddleImageSizePrt; + TSize mTrackMiddleImageSizeLsc; + TSize mTrackBottomImageSizePrt; + TSize mTrackBottomImageSizeLsc; + TSize mSliderHandleSizePrt; + TSize mSliderHandleSizeLsc; + TSize mImagePlusSizePrt; + TSize mImagePlusSizeLsc; + TSize mImageMinusSizePrt; + TSize mImageMinusSizeLsc; + int mDragStartStep;// Tick positon of Drag Start + int mCurrTick;// Stores current tick + int mTick;// Stores Tick Size + int mTrackStartPoint;// Slider Track Start Point in pixel + int mHandleGhostHieghtDelta; + bool mOrientationLandScape; + bool mHasBackground; // for background only created once + int mdirection;// 0 - nomovement,1 up movement 2 down + bool mLayoutMirrored;// RTL if True else LTR + int mImageTextureId; // to differtiate between textures + int mTrackTopTexturePrtId ;// to store the auto generated texture id's + int mTrackTopTextureLscId; + int mTrackBottomTexturePrtId; + int mTrackBottomTextureLscId; + int mTrackMiddleTextureLscId; + int mTrackMiddleTexturePrtId; + int mMarkerTextureLscId; + int mMarkerTexturePrtId; + int mZoomInTexturePrtId; + int mZoomInTextureLscId; + int mZoomOutTexturePrtId; + int mZoomOutTextureLscId; + bool misSetModel; + + + CAlfLayout* mMainLayout; + CAlfLayout* mBaseSliderLayout;// Slider Background + CAlfTexture* mTexture; + CAlfLayout* mSliderCentre;// Track layout + CAlfLayout* mSliderCentreGhost;// Extended touch are for track + CAlfImageVisual* mTrackTopImage; + CAlfImageVisual* mTrackMiddleImage; + CAlfImageVisual* mTrackEndImage; + CAlfImageVisual* mSliderHandle;// Slider Handle + CAlfLayout* mSliderHandleGhost;//Extended touch are for handle + CAlfVisual* mSliderPercentAudio;//Visula showing percentage + CAlfImageVisual* mImagePlus;// Zoom in + CAlfImageVisual* mImageMinus;// Zoom out + + + MulVerticalSliderDataImpl() + { + mOperation = false; + mSliderHit = false; + misSetModel = false; + mTickInPixels = 0; + mRangeInPixels = 0; + mCurrTickInPixels = 0; + mVisual = NULL; + mDragPoint.SetXY(0,0); + mLongTapPos.SetXY(0,0); + mDragStartStep = 0; + mCurrTick = 0; + mTick = 0; + mTrackStartPoint = 0; + mImageTextureId = 0; + mTrackTopTexturePrtId = 0; + mTrackTopTextureLscId = 0; + mTrackBottomTexturePrtId = 0; + mTrackBottomTextureLscId = 0; + mTrackMiddleTexturePrtId = 0; + mTrackMiddleTextureLscId = 0; + mMarkerTexturePrtId = 0; + mMarkerTextureLscId = 0; + mZoomInTexturePrtId = 0; + mZoomInTextureLscId = 0; + mZoomOutTexturePrtId = 0; + mZoomOutTextureLscId = 0; + mMainLayout = NULL; + mBaseSliderLayout = NULL; + mSliderCentre = NULL; + mTrackTopImage = NULL; + mTrackMiddleImage = NULL; + mTrackEndImage = NULL; + mSliderCentreGhost = NULL; + mSliderHandleGhost = NULL; + mSliderHandle = NULL; + mSliderPercentAudio = NULL; + mImagePlus = NULL; + mImageMinus = NULL; + mHandleGhostHieghtDelta = 0; + mOrientationLandScape = false; + mdirection = 0; + mLayoutMirrored = false; + mHasBackground = false; + mTrackTopImageSizePrt.SetSize(0,0); + mTrackTopImageSizeLsc.SetSize(0,0); + mTrackBottomImageSizePrt.SetSize(0,0); + mTrackBottomImageSizeLsc.SetSize(0,0); + mTrackMiddleImageSizePrt.SetSize(0,0); + mTrackMiddleImageSizeLsc.SetSize(0,0); + mSliderHandleSizePrt.SetSize(0,0); + mSliderHandleSizeLsc.SetSize(0,0); + mImagePlusSizePrt.SetSize(0,0); + mImagePlusSizeLsc.SetSize(0,0); + mImageMinusSizePrt.SetSize(0,0); + mImageMinusSizeLsc.SetSize(0,0); + } + + }; + +// bitmap file path +_LIT(KAvkonBitmapFile,"\\resource\\apps\\avkon2.mbm"); +_LIT(KSliderBitmapFile,"\\resource\\apps\\mulsliderwidget.mif"); + +const TInt KAlfTrackTopTextureId = 1; +const TInt KAlfTrackBottomTextureId = 2; +const TInt KAlfTrackMiddleTextureId = 3; +const TInt KAlfMarkerTextureId = 4; +const TInt KAlfZoomInTextureId = 5; +const TInt KAlfZoomOutTextureId = 6; + +// --------------------------------------------------------------------------- +// C++ default constructor. +// --------------------------------------------------------------------------- +// +MulSliderVertical::MulSliderVertical( + CAlfWidgetControl& aControl, + const char* aName, + AlfCustomInitDataBase* /*aCustomData*/) + : mData(NULL) + { + // Base class (AlfElement) construct + construct(aControl, aName); + mSliderModel = NULL; + mSliderWidget = NULL; + mData = new (EMM) MulVerticalSliderDataImpl; + mPosData.reset(new(EMM)MulSliderPos); + + // Timer for generating tap and hold repeat events + mLongTapTimer.reset(new (EMM) MulSliderLongTapTimer(this)); + initializeSliderData(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +MulSliderVertical::~MulSliderVertical() + { + // Visualization Data + if(mData) + { + CAlfTextureManager& txtmanager = control().Env().TextureManager(); + txtmanager.UnloadTexture(mData->mTrackTopTextureLscId); + txtmanager.UnloadTexture(mData->mTrackTopTexturePrtId); + txtmanager.UnloadTexture(mData->mTrackMiddleTextureLscId); + txtmanager.UnloadTexture(mData->mTrackMiddleTexturePrtId); + txtmanager.UnloadTexture(mData->mTrackBottomTextureLscId); + txtmanager.UnloadTexture(mData->mTrackBottomTexturePrtId); + txtmanager.UnloadTexture(mData->mMarkerTexturePrtId); + txtmanager.UnloadTexture(mData->mMarkerTextureLscId); + txtmanager.UnloadTexture(mData->mZoomInTexturePrtId); + txtmanager.UnloadTexture(mData->mZoomInTextureLscId); + txtmanager.UnloadTexture(mData->mZoomOutTexturePrtId); + txtmanager.UnloadTexture(mData->mZoomOutTextureLscId); + delete mData; + } + else + { + + } + + }//End of Destructor + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Getter for interfaces provided by the slider widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* MulSliderVertical::makeInterface( + const IfId& aType) + { + IAlfInterfaceBase* interface = 0; + UString param (aType.mImplementationId); + if (param == IAlfWidgetEventHandler::type().mImplementationId) + { + return static_cast(this); + } + else if (param == + IMulSliderBaseElementInternal::type().mImplementationId) + { + return static_cast(this); + } + else + { + interface = AlfElement::makeInterface(aType); + } + return interface; + } + +//-------------------------------------------------------------------------- +// APIs from the IMulSliderBaseElement +//-------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// Gets called when the parent layout is relayouted. +// resets all the anchor points and updates the visualization +// --------------------------------------------------------------------------- +// +void MulSliderVertical::baseLayoutSizeChanged() + { + mData->mMainLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); + if(mData->mMainLayout) + { + //mData->mOrientationLandScape = mSliderModel->IsLandscape(); + // This is a hack to resolve screen refresh issue + control().Env().RefreshCallBack(&(control().Env())); + // Layout the visualization with correct LCT values + layoutVisuals(mSliderModel->GetTemplate()); + // Convert all the user defined data to pixels + ConvertDataToPixels(); + // Set the thumb position to the current tick + SetThumbPosition(); + mData->mMainLayout->SetOpacity(mSliderWidget->GetOpacity()); + } + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// +void MulSliderVertical::setActiveStates( + unsigned int /*aStates*/) + { + //do nothing + } + +// --------------------------------------------------------------------------- +// initializes Model and Widget Pointer +// --------------------------------------------------------------------------- +// +void MulSliderVertical::initializeSliderData() + { + // initialize the Slider Widget Pointer; + IAlfWidgetFactory& widgetFactory = + AlfWidgetEnvExtension::widgetFactory(control().Env()); + mSliderWidget = static_cast(widgetFactory.findWidget( + control().widget()->widgetName())); + + // initialize the Slider Model Pointer; + mSliderModel =static_cast(mSliderWidget->model()); + } + +// --------------------------------------------------------------------------- +// set the positions and images for the visual hierarchy +// --------------------------------------------------------------------------- +// +void MulSliderVertical::layoutVisuals( sliderTemplate /*aTemplateId*/) + { + + bool relayout = mData->misSetModel; + + if(mData->mLayoutMirrored != AknLayoutUtils::LayoutMirrored()) + { + mData->mOrientationLandScape = !mSliderModel->IsLandscape(); + mData->mLayoutMirrored = AknLayoutUtils::LayoutMirrored(); + } + + if( mSliderModel->IsLandscape() != mData->mOrientationLandScape ) + { + relayout = true; + mData->mOrientationLandScape = mSliderModel->IsLandscape(); + } + if(relayout) + { + mData->misSetModel = false; + CAlfControl* ctrl = (CAlfControl*)&control(); + TAknLayoutRect layoutRect; + //get the lct rect for mBaseSliderLayout and set it + // aaslider_pane(3) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderPane,mData->mMainLayout,KVariety3); + mData->mBaseSliderLayout->SetRect( + TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + if(!mData->mHasBackground) + SetBackgroundBrush(); + // Set Position and Size for Extended touch layout for track + mData->mSliderCentreGhost->SetRect( + TRect( TPoint(0,0 ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))); + + + //get the lct rect for mSliderCentre and set it + //aaslider_bg_pane_cp001(6) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderBgPane, + mData->mBaseSliderLayout, + KVariety6); + + mData->mSliderCentre->SetRect( + TRect( TPoint( layoutRect.Rect().iTl.iX , + layoutRect.Rect().iTl.iY), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))); + + //get the lct rect for mTrackTopImage and set it + //aaslider_bg_pane_cp001_g1(0) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderTop, + mData->mSliderCentre, + KVariety0); + + mData->mTrackTopImage->SetRect( + TRect( TPoint(0,layoutRect.Rect().iTl.iY), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))); + + mSliderModel->IsLandscape() ? mData->mTrackTopImageSizeLsc = layoutRect.Rect().Size(): + mData->mTrackTopImageSizePrt = layoutRect.Rect().Size(); + + //get the lct rect for mTrackMiddleImage and set it + //aaslider_bg_pane_cp001_g3(0) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMiddle, + mData->mSliderCentre, + KVariety0); + mData->mTrackMiddleImage->SetRect( + TRect( TPoint( 0,layoutRect.Rect().iTl.iY), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))); + + mSliderModel->IsLandscape() ? mData->mTrackMiddleImageSizeLsc = layoutRect.Rect().Size(): + mData->mTrackMiddleImageSizePrt = layoutRect.Rect().Size(); + //get the lct rect for mTrackEndImage and set it + //aaslider_bg_pane_cp001_g2(0) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderEnd, + mData->mSliderCentre, + KVariety0); + mData->mTrackEndImage->SetRect( + TRect( TPoint(0,layoutRect.Rect().iTl.iY), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))); + mSliderModel->IsLandscape() ? mData->mTrackBottomImageSizeLsc = layoutRect.Rect().Size(): + mData->mTrackBottomImageSizePrt = layoutRect.Rect().Size(); + + if(mData->mTrackTopImage && mData->mTrackMiddleImage && mData->mTrackEndImage) + { + setTrackImage(); + } + + + //get the lct rect for mSliderHandle and set it + //aid_touch_size_slider_marker(5) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMarker, + mData->mBaseSliderLayout, + KVariety5); + mData->mSliderHandle->SetRect( + TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + mSliderModel->IsLandscape() ? mData->mSliderHandleSizeLsc = layoutRect.Rect().Size(): + mData->mSliderHandleSizePrt = layoutRect.Rect().Size(); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMarkerExtended, + mData->mBaseSliderLayout, + KVariety5); + mData->mHandleGhostHieghtDelta = + (layoutRect.Rect().Size().iHeight - mData->mSliderHandle->Size().iY.ValueNow() ); + + // Set Position and Size for Extended touch layout for handle + mData->mSliderHandleGhost->SetRect( + TRect( TPoint( mData->mBaseSliderLayout->Pos().iX.ValueNow(), + mData->mSliderHandle->Pos().iY.ValueNow()- + mData->mHandleGhostHieghtDelta/2), + TSize( mData->mBaseSliderLayout->Size().iX.ValueNow(), + layoutRect.Rect().Size().iHeight))); + + if(mData->mSliderHandle) + { + mData->mImageTextureId = KAlfMarkerTextureId; + // Create the texture from bitmap provider + mData->mSliderHandle->SetImage( skinTexture(mData->mSliderHandleSizePrt ,mData->mSliderHandleSizeLsc , mData->mMarkerTexturePrtId, mData->mMarkerTextureLscId ) ); + } + + //get the lct rect for mImagePlus and set it + // aid_touch_size_slider_max(1) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderPlus, + mData->mBaseSliderLayout, + KVariety1); + mData->mImagePlus->SetRect( + TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + mSliderModel->IsLandscape() ? mData->mImagePlusSizeLsc = layoutRect.Rect().Size(): + mData->mImagePlusSizePrt = layoutRect.Rect().Size(); + if(mData->mImagePlus) + { + mData->mImageTextureId = KAlfZoomInTextureId; + // Create the texture from bitmap provider + mData->mImagePlus->SetImage(skinTexture(mData->mImagePlusSizePrt ,mData->mImagePlusSizeLsc , mData->mZoomInTexturePrtId, mData->mZoomInTextureLscId )); + } + + //get the lct rect for mImageMinus and set it + // aid_touch_size_slider_min(2) + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMinus,mData->mBaseSliderLayout,KVariety2); + + mData->mImageMinus->SetRect( + TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ), + TSize( layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ))) ; + + mSliderModel->IsLandscape() ? mData->mImageMinusSizeLsc = layoutRect.Rect().Size(): + mData->mImageMinusSizePrt = layoutRect.Rect().Size(); + if(mData->mImageMinus) + { + mData->mImageTextureId = KAlfZoomOutTextureId; + // Create the texture from bitmap provider + mData->mImageMinus->SetImage(skinTexture(mData->mImageMinusSizePrt ,mData->mImageMinusSizeLsc , mData->mZoomOutTexturePrtId, mData->mZoomOutTextureLscId )); + + } + } + } +// --------------------------------------------------------------------------- +// Used for setting images for the track +// --------------------------------------------------------------------------- +// + +void MulSliderVertical::setTrackImage() + { + + CAlfControl* ctrl = (CAlfControl*)&control(); + //creating texture for topimage + mData->mImageTextureId = KAlfTrackTopTextureId; + mData->mTrackTopImage->SetImage( skinTexture(mData->mTrackTopImageSizePrt ,mData->mTrackTopImageSizeLsc , mData->mTrackTopTexturePrtId, mData->mTrackTopTextureLscId ) ) ; + + //creating texture for middleimage + mData->mImageTextureId = KAlfTrackMiddleTextureId; + mData->mTrackMiddleImage->SetImage(skinTexture(mData->mTrackMiddleImageSizePrt ,mData->mTrackMiddleImageSizeLsc , mData->mTrackMiddleTexturePrtId, mData->mTrackMiddleTextureLscId )); + + //creating texture for bottom image + mData->mImageTextureId = KAlfTrackBottomTextureId; + mData->mTrackEndImage->SetImage( skinTexture(mData->mTrackBottomImageSizePrt ,mData->mTrackBottomImageSizeLsc , mData->mTrackBottomTexturePrtId, mData->mTrackBottomTextureLscId ) ); + + }//End of setImage + +// --------------------------------------------------------------------------- +// ProvideBitmapL() +// --------------------------------------------------------------------------- +// +void MulSliderVertical::ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) + { + TAknLayoutRect layoutRect; + switch(mData->mImageTextureId) + { + case KAlfTrackTopTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_vertical_top, + EMbmAvkonQgn_graf_nslider_vertical_top_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderTop, + mData->mSliderCentre, + KVariety0); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mTrackTopTextureLscId = aId : + mData->mTrackTopTexturePrtId = aId ; + } + break; + case KAlfTrackBottomTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_vertical_bottom, + EMbmAvkonQgn_graf_nslider_vertical_bottom_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderEnd, + mData->mSliderCentre, + KVariety0); + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mTrackBottomTextureLscId = aId : + mData->mTrackBottomTexturePrtId = aId ; + } + break; + case KAlfTrackMiddleTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_vertical_middle, + EMbmAvkonQgn_graf_nslider_vertical_middle_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMiddle, + mData->mSliderCentre, + KVariety0); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mTrackMiddleTextureLscId = aId : + mData->mTrackMiddleTexturePrtId = aId ; + } + break; + + case KAlfMarkerTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KAvkonBitmapFile, + EMbmAvkonQgn_graf_nslider_vertical_marker, + EMbmAvkonQgn_graf_nslider_vertical_marker_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMarker, + mData->mBaseSliderLayout, + KVariety5); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mMarkerTextureLscId = aId : + mData->mMarkerTexturePrtId = aId ; + } + break; + case KAlfZoomInTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KSliderBitmapFile, + EMbmMulsliderwidgetQgn_indi_nslider_zoom_in, + EMbmMulsliderwidgetQgn_indi_nslider_zoom_in_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderPlus,mData->mBaseSliderLayout,KVariety1); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mZoomInTextureLscId = aId : + mData->mZoomInTexturePrtId = aId; + } + break; + case KAlfZoomOutTextureId: + { + AknIconUtils::CreateIconL( + aBitmap, + aMaskBitmap, + KSliderBitmapFile, + EMbmMulsliderwidgetQgn_indi_nslider_zoom_out, + EMbmMulsliderwidgetQgn_indi_nslider_zoom_out_mask ); + + layoutRect = MulSliderUtils::GetComponentRect( + EVSliderMinus,mData->mBaseSliderLayout,KVariety2); + + AknIconUtils::SetSize( aBitmap, + TSize(layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight), + EAspectRatioNotPreserved); + + mData->mImageTextureId = 0; + mSliderModel->IsLandscape() ? mData->mZoomOutTextureLscId = aId : + mData->mZoomOutTexturePrtId = aId ; + + } + break; + default: + break; + + } + + } + +// --------------------------------------------------------------------------- +// setBackgroundBrush() +// --------------------------------------------------------------------------- +// +void MulSliderVertical::SetBackgroundBrush() + { + + CAlfControl* ctrl = (CAlfControl*)&control(); + // Get Slider Pane Rect (aaslider_pane(2)) and apply on mBaseSliderLayout + TAknLayoutRect layoutRect = MulSliderUtils::GetComponentRect( + EVSliderPane,mData->mMainLayout,2); + + + TAknWindowLineLayout LayoutHandle = + AknLayoutScalable_UiAccel:: + aid_touch_size_slider_max(0).LayoutLine(); + + + int x = LayoutHandle.il; + TAknsItemID itemid; + + itemid.Set(EAknsMajorSkin, EAknsMinorQgnGrafPopupTrans); + CAlfFrameBrush* brush = CAlfFrameBrush::NewLC((*ctrl).Env(),itemid, 0, 0); + + if(brush!=NULL) + { + TRect dispRect(layoutRect.Rect().iTl.iX, + layoutRect.Rect().iTl.iY, + layoutRect.Rect().Size().iWidth, + layoutRect.Rect().Size().iHeight ); + TRect innerRect(layoutRect.Rect().iTl.iX + x, + layoutRect.Rect().iTl.iY + x, + layoutRect.Rect().Size().iWidth - x , + layoutRect.Rect().Size().iHeight - x); + + brush->SetFrameRectsL(innerRect,dispRect); + brush->SetOpacity(KMinopacity); + mData->mBaseSliderLayout->EnableBrushesL(); + mData->mBaseSliderLayout->Brushes()->AppendL(brush, EAlfHasOwnership); + CleanupStack::Pop(brush); + } + mData->mHasBackground = true; + } + +// ---------------------------------------------------------------------------- +// skinTexture() +// ---------------------------------------------------------------------------- +// +TAlfImage MulSliderVertical::skinTexture(TSize aPrtImageSize, TSize aLscImageSize, TInt aPrtSkinId, TInt aLscSkinId ) + { + const CAlfControl* ctrl = (CAlfControl*)(&control()); + + if ( aPrtImageSize != aLscImageSize ) + { + if ( aPrtSkinId == 0 || aLscSkinId == 0 ) + { + mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, + (MAlfBitmapProvider *)this, + (TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent))); + TAlfImage dummyImage(*mData->mTexture); + return dummyImage; + } + } + else if ( aPrtSkinId == 0 || aLscSkinId == 0 ) + { + TInt id = aPrtSkinId > aLscSkinId ? aPrtSkinId : aLscSkinId; + mData->mTexture = ((ctrl->Env()).TextureManager().TextureL(id)); + TAlfImage dummyImage(*mData->mTexture); + return dummyImage; + } + + TInt textureId = mSliderModel->IsLandscape() ? aLscSkinId : aPrtSkinId; + mData->mTexture = ((ctrl->Env()).TextureManager().TextureL( textureId )); + TAlfImage dummyImage(*mData->mTexture); + return dummyImage; + } + + +// --------------------------------------------------------------------------- +// MakeTransparent() +// --------------------------------------------------------------------------- +// +void MulSliderVertical::MakeTransparent(bool aVal) + { + CAlfBrushArray * brushArray = mData->mBaseSliderLayout->Brushes(); + if(aVal) + { + TAlfTimedValue opacity(KMinopacity); + brushArray->At(0).SetOpacity(opacity); + } + else + { + TAlfTimedValue opacity(KMaxopacity); + brushArray->At(0).SetOpacity(opacity); + } + } +// --------------------------------------------------------------------------- +// ConvertDataToPixels +// --------------------------------------------------------------------------- +// +void MulSliderVertical::ConvertDataToPixels() + { + float sliderCentreSize = mData->mSliderCentre->Size().iY.ValueNow(); + float sliderHandleSize = mData->mSliderHandle->Size().iY.ValueNow(); + float sliderCentrePos = mData->mSliderCentre->Pos().iY.ValueNow(); + + // Calculate the range in pixel values + mData->mRangeInPixels = sliderCentreSize - sliderHandleSize; + + if(mSliderModel->MaxRange() - mSliderModel->MinRange() != 0) + { + // Calculate Tick Size in Pixels + mData->mTickInPixels = + (sliderCentreSize - sliderHandleSize) / + (mSliderModel->MaxRange() - mSliderModel->MinRange()) ; + } + // Get the track start pixel value + mData->mTrackStartPoint = sliderCentrePos + sliderCentreSize - sliderHandleSize ; + // Store current tick + mData->mCurrTick = mSliderModel->PrimaryValue() ; + if(mSliderModel->MaxRange()== mSliderModel->MinRange()) + { + mData->mTrackStartPoint= sliderCentrePos; + } + mData->mTick = mSliderModel->Tick(); + } + +//---------------------------------------------------------------------------- +// FeedbackIntensity +//---------------------------------------------------------------------------- +// +TInt MulSliderVertical::feedbackIntensity() + { + /* We need to find the position of the thumb w.r.t the slider track. + * mData->mTickInPixels will give the no. of pixels each tick will + * + */ + + int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) * + mData->mTickInPixels; + TInt intensity = ( deltaY * 100 )/ mData->mRangeInPixels ; + return intensity ; + } + +// --------------------------------------------------------------------------- +// createVisualization +// --------------------------------------------------------------------------- +// +void MulSliderVertical::createVisualization(sliderTemplate /*aTemplateId*/) + { + mData->mHasBackground = false; + if(AknLayoutUtils::LayoutMirrored()) + mData->mLayoutMirrored = true; + else + mData->mLayoutMirrored = false; + // Create the visualization + CAlfControl* ctrl = (CAlfControl*)&control(); + mData->mOrientationLandScape = mSliderModel->IsLandscape(); + mData->misSetModel = true; + + // Visual Hierarchy creation + // create the mMainLayout + mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL); + // set the flag for Notifications + mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + //create the mBaseSliderLayout + mData->mBaseSliderLayout = + CAlfLayout::AddNewL(*ctrl,mData->mMainLayout); + // create the dummy layout for slider track + mData->mSliderCentreGhost = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + // create the dummy layout for slider handle + mData->mSliderHandleGhost = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + + // create the imagevisual for slider track + mData->mSliderCentre = + CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout); + // create the imagevisual for slider handle + mData->mSliderHandle = + CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + // create the imagevisual for plus icon + mData->mImagePlus= + CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + // create the imagevisual for minus icon + mData->mImageMinus = + CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout); + if(mData->mSliderCentre) + { + mData->mTrackTopImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + mData->mTrackMiddleImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + mData->mTrackEndImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre); + } + + // Get the widget opacity and apply on root visual + mSliderWidget->ShowWidget(mSliderWidget->GetOpacity(),0); + } + + +// --------------------------------------------------------------------------- +// eventHandlerType +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType MulSliderVertical::eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + + +// --------------------------------------------------------------------------- +// eventExecutionPhase +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulSliderVertical:: + eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + + +// --------------------------------------------------------------------------- +// offerEvent +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderVertical::offerEvent( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent ) + { + AlfEventStatus ret=EEventNotHandled; + if(!mSliderWidget->IsHidden()) + { + if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventMissedPointerUp) + { + ret=EEventHandled; + mData->mSliderHit = false; + handlePointerUpEvent(); + } + } + + // handle key events + else if(aEvent.IsKeyEvent() && mSliderWidget->IsKeyEnabled() ) + { + ret = HandleKeyEvents(aEvent); + } + + // Pointer drag events and single tap events + else if(aEvent.IsPointerEvent()) + { + if(mSliderWidget->GetOpacity()) + { + ret = HandlePointerEvents((TAlfEvent *)&aEvent); + } + } + + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// HandleKeyEvents +// --------------------------------------------------------------------------- +// + AlfEventStatus MulSliderVertical::HandleKeyEvents(const TAlfEvent& aEvent) + { + AlfEventStatus ret = EEventNotHandled; + + + if(aEvent.KeyEvent().iScanCode == EStdKeyUpArrow) + { + if(aEvent.Code() == EEventKey) + { + ret = EEventHandled; + int newPos = mSliderModel->PrimaryValue() + mData->mTick; + updateModelPrimaryValue(newPos); + } + } + else if(aEvent.KeyEvent().iScanCode == EStdKeyDownArrow) + { + if(aEvent.Code() == EEventKey) + { + ret = EEventHandled; + int newPos = mSliderModel->PrimaryValue() - mData->mTick; + updateModelPrimaryValue(newPos); + } + } + return ret; + } +// --------------------------------------------------------------------------- +// Sends drag Up or Down event, according to the hit position +// on track +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderVertical::trackVisualHit(CAlfVisual * /*aHitVisual*/) + { + //Find the thumb Anchor Layout. + // Zoom Plus icon rectangle + TAlfRealRect zoomPlus = mData->mBaseSliderLayout->DisplayRect(); + // Slider Handle position + TAlfTimedPoint thumbVisPos = mData->mSliderHandle->Pos(); + TAlfTimedPoint thumbVisSize = mData->mSliderHandle->Size(); + // Slider track display rect + TAlfRealRect rct = mData->mSliderCentre->DisplayRect() ; + int diff = rct.iTl.iY - zoomPlus.iTl.iY; + //Check if click was above/to left or below/to right of thumb + if (mData->mLongTapPos.iY - rct.iTl.iY < thumbVisPos.iY.ValueNow() + (thumbVisSize.iY.ValueNow()/2) - diff) + { + // Pointer down happened above Handle + int newPos = mSliderModel->PrimaryValue() + (((thumbVisPos.iY.ValueNow() +(thumbVisSize.iY.ValueNow()/2) - diff) -(mData->mLongTapPos.iY - rct.iTl.iY))/mData->mTickInPixels); + + if( rct.iTl.iY > mData->mLongTapPos.iY ) + { + mData->mLongTapPos.iY = rct.iTl.iY + (thumbVisSize.iY.ValueNow()/2); + } + // Move Handle + if(mData->mdirection !=2) + { + // checks if the thumb was moving up + updateModelPrimaryValue(newPos); + mData->mdirection = 1; + } + + if(!mData->mOperation) + { + mData->mVisual = mData->mSliderHandle; + initializeThumbDragData( + mData->mLongTapPos); + + } + } + else if (mData->mLongTapPos.iY - rct.iTl.iY > (thumbVisPos.iY.ValueNow() + + (thumbVisSize.iY.ValueNow()/2)- diff) ) + { + if( (rct.iTl.iY + rct.Size().iHeight < mData->mLongTapPos.iY)) + { + mData->mLongTapPos.iY = rct.iTl.iY+ rct.Size().iHeight - (thumbVisSize.iY.ValueNow()/2); + } + // Pointer down happened below Handle + int newPos = mSliderModel->PrimaryValue() - (((mData->mLongTapPos.iY - rct.iTl.iY) -(thumbVisPos.iY.ValueNow() + (thumbVisSize.iY.ValueNow()/2)-diff))/mData->mTickInPixels); + // Move Handle + if(mData->mdirection !=1) + { + // checks if the thumb was moving down + updateModelPrimaryValue(newPos); + mData->mdirection = 2; + } + + //mData->mLongTapStarted = false; + if(!mData->mOperation) + { + mData->mVisual = mData->mSliderHandle; + initializeThumbDragData( mData->mLongTapPos); + + } + } + else + { + + } + return EEventHandled; + } + +// --------------------------------------------------------------------------- +// handles the pointerDown event +// +// --------------------------------------------------------------------------- +// +AlfEventStatus MulSliderVertical::handlePointerDownEvent(TAlfEvent * aPntrEvent) + { + + CAlfVisual * focusvisual = aPntrEvent->Visual(); + AlfEventStatus result = EEventNotHandled; + if (focusvisual) + { + mData->mVisual = focusvisual; + if (IsSliderVisual(focusvisual)) + { + control().processEvent(TAlfEvent(ECustomEventIconClick)); + mData->mSliderHit = true; + MakeTransparent(false); + + // Register with the Roster to receive Long Tap Event + control().Display()->Roster().SetPointerEventObservers( + EAlfPointerEventReportDrag,control()); + + if(!mData->mOperation) + { + mData->mLongTapPos = aPntrEvent->PointerEvent().iParentPosition; + //mData->mLongTapStarted = true; + } + + //Page Movement + if (focusvisual == mData->mSliderCentre || + focusvisual == mData->mSliderCentreGhost) + { + result = trackVisualHit(focusvisual); + } + + // Drag + else if (focusvisual == mData->mSliderHandle + || focusvisual == mData->mSliderHandleGhost ) + { + if(focusvisual) + { + // Initialize the drag variables + initializeThumbDragData(aPntrEvent->PointerEvent().iParentPosition); + //Tactile Feedback For Thumb touch + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnTouchandHold(); + } + result = EEventHandled; + } + // Zoom Icon Plus Clicked + else if (focusvisual == mData->mImagePlus || focusvisual == mData->mImageMinus ) + { + // Update the newTick + int newPos =0; + if( mData->mVisual == mData->mImagePlus) + { + newPos = mSliderModel->MaxRange(); + } + else + { + newPos = mSliderModel->MinRange(); + //newPos = mSliderModel->PrimaryValue() - mData->mTick; + } + updateModelPrimaryValue(newPos); + //return ETrue; + result = EEventHandled; + } + + }//END OF if (isSliderVisual()) + } + return result; + }// End Of handlePointerDownEvent + + +// --------------------------------------------------------------------------- +// HandlePointerEvents +// --------------------------------------------------------------------------- +// + AlfEventStatus MulSliderVertical::HandlePointerEvents(TAlfEvent* aEvent) + { + AlfEventStatus ret = EEventNotHandled; + if (aEvent->PointerEvent().iType == TPointerEvent::EButton1Down) + { + mData->mdirection = 0; + return handlePointerDownEvent(aEvent); + } + // Drag Events + else if (aEvent->PointerEvent().iType == TPointerEvent::EDrag) + { + // Drag on Handle + TAlfRealRect rct = mData->mSliderCentre->DisplayRect() ; + TAlfTimedPoint thumbVisSize = mData->mSliderHandle->Size(); + // Drag on Handle + if(mData->mVisual && + mData->mSliderHandle && mData->mSliderHandleGhost) + { + // Store the new pointer position + mData->mLongTapPos= aEvent->PointerEvent().iParentPosition ; + } + + // Calculate the distance moved from the drag start point + int dist = mData->mDragPoint.iY - aEvent->PointerEvent().iParentPosition.iY; + int precision = KRoundupvalue; + if(dist<0) + { + precision = -KRoundupvalue; + } + // Calculate the new tick position + int newPos = (int)(((float)dist / mData->mTickInPixels ) + precision) + + mData->mDragStartStep; + // Update the model hence update visualization + updateModelPrimaryValue(newPos); + //Tactile Feedback For Thumb Drag + MulSliderControl& sldrcntrl = static_cast(control()); + int fdbintensity = feedbackIntensity(); + sldrcntrl.TactileEffectOnDrag(*aEvent , fdbintensity ); + ret = EEventHandled; + } + + else if(aEvent->PointerUp() ) + { + + // Long tap Timer not running + //mData->mLongTapStarted = false; + // Handle events for pointer up + if(mData->mSliderHit) + { + // checing if any of slider visual got a button down event + // Otherwise its a stray pointerup event , so dont handle it + mData->mSliderHit = false; + ret = EEventHandled; + handlePointerUpEvent(); + } + + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// updateModelPrimaryValue +// --------------------------------------------------------------------------- +// +void MulSliderVertical::updateModelPrimaryValue(int aNewPosValue) + { + // Validate the new tick value + if(aNewPosValue < mSliderModel->MinRange()) + { + aNewPosValue = mSliderModel->MinRange(); + } + else if(aNewPosValue > mSliderModel->MaxRange()) + { + aNewPosValue = mSliderModel->MaxRange(); + } + if(mSliderModel->PrimaryValue() != aNewPosValue && mData->mTick != 0) + { + // Update visualization and model only if data is changed + mSliderModel->SetPrimaryValue(aNewPosValue); + mPosData.reset(new(EMM)MulSliderPos); + mPosData->mPreviousValue = mData->mCurrTick ; + mPosData->mCurrentValue= aNewPosValue; + mData->mCurrTick = aNewPosValue; + // Send event to the scrollable widget + TAlfEvent customevent(ETypePrimaryValueChange, + (uint)mPosData.get()); + control().processEvent(customevent); + } + } + +// --------------------------------------------------------------------------- +// snapPrimaryValueToTicks +// --------------------------------------------------------------------------- +// +void MulSliderVertical::snapPrimaryValueToTicks() + { + // If the position is not a multiple of ticks then + //snap to the nearest tick multiple + int currHandlePos = mSliderModel->PrimaryValue() - mSliderModel->MinRange(); + int tick = mSliderModel->Tick(); + int newPos = currHandlePos + mSliderModel->MinRange(); + if(mSliderModel->PrimaryValue() < mSliderModel->MaxRange()) + { + + int diff = 0; + if(tick > 0) //model + { + diff = currHandlePos - ((currHandlePos /tick) * tick); + } + if(diff !=0) + { + newPos = currHandlePos + tick - diff + mSliderModel->MinRange(); + } + } + + + // Update model + updateModelPrimaryValue(newPos); + } + + +// --------------------------------------------------------------------------- +// handles the pointerUp event +// +// --------------------------------------------------------------------------- +// +void MulSliderVertical::handlePointerUpEvent() + { + // if thumb or track is clicked, change the graphics + // Send event if single click has hapened + + snapPrimaryValueToTicks(); + MakeTransparent(true); + if(mData->mOperation) + { + //Somehow missed the Up event? + stopDrag(); + //Tactile Feedback For Thumb Release + MulSliderControl& sldrcntrl = static_cast(control()); + sldrcntrl.TactileEffectOnRelease(); + } + + + // Un-register with the roster for long tap events + control().Display()->Roster().SetPointerEventObservers(0, + control()); + + // send the event for release/poiter up + control().processEvent(TAlfEvent(ECustomEventIconRelease)); + } + +// --------------------------------------------------------------------------- +// Stops event handling +// +// --------------------------------------------------------------------------- +// +void MulSliderVertical::stopEvents() +{ + if(mData->mSliderHit) + { + // checking if any of slider visual got a button down event + mData->mSliderHit = false; + handlePointerUpEvent(); + } +} + +// --------------------------------------------------------------------------- + +// UpdateVisualization +// --------------------------------------------------------------------------- +// + +void MulSliderVertical::updateVisualization() + { + ConvertDataToPixels(); + SetThumbPosition(); + } +// --------------------------------------------------------------------------- +// SetThumbPosition +// --------------------------------------------------------------------------- +// +void MulSliderVertical::SetThumbPosition() + { + // Current primary value in pixels + int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) * + mData->mTickInPixels; + // Handle + int handleX = mData->mSliderHandle->Pos().iX.ValueNow(); + int ghostHandleX = mData->mSliderHandleGhost->Pos().iX.ValueNow(); + // Handle new pos + TAlfRealPoint pnt(handleX,mData->mTrackStartPoint - deltaY); + // Ghost Handle ( Extended) new pos + TAlfRealPoint pnt1(ghostHandleX,mData->mTrackStartPoint - deltaY - + mData->mHandleGhostHieghtDelta/2); + // Set the position + mData->mSliderHandle->SetPos(pnt,0); + mData->mSliderHandleGhost->SetPos(pnt1,0); + // Update visualization variables + mData->mCurrTick = mSliderModel->PrimaryValue(); + //mData->mMainLayout->UpdateChildrenLayout(0); + + } +// --------------------------------------------------------------------------- +// SetTextLabels +// --------------------------------------------------------------------------- +// +void MulSliderVertical::SetTextLabels(const char* /*aStr*/) + { + } + +// --------------------------------------------------------------------------- +// accept +// --------------------------------------------------------------------------- +// +bool MulSliderVertical::accept( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) const + { + // Accept only key or pointer events. + if(aEvent.IsKeyEvent()||aEvent.IsPointerEvent()) + { + return true; + } + else + { + return false; + } + } + + +// --------------------------------------------------------------------------- +// initializeThumbDragData +// --------------------------------------------------------------------------- +// +bool MulSliderVertical::initializeThumbDragData(const TPoint& aPointerPos) + { + TRAPD(err,control().Display()->Roster().SetPointerDragThreshold(control(), + TAlfXYMetric(TAlfMetric(KXToleranceInPixel,EAlfUnitPixel), + TAlfMetric(KYToleranceInPixel,EAlfUnitPixel))) ); + if(mData->mVisual && err == KErrNone) + { + mData->mOperation = EMoveItem; + mData->mDragPoint = aPointerPos; + mData->mDragStartStep = mSliderModel->PrimaryValue(); + } + else + { + + } + return ETrue; + } + +// --------------------------------------------------------------------------- +// stopDrag +// Stop Dragging +// --------------------------------------------------------------------------- +// +bool MulSliderVertical::stopDrag() + { + + TRAPD(err, + control().Display()->Roster().SetPointerEventObservers( + 0, + control())); + if(err == KErrNone) + { + mData->mVisual = NULL; + mData->mOperation = ENop; + return ETrue; + } + return EFalse; + } + + +// --------------------------------------------------------------------------- +// IsSliderVisual +// --------------------------------------------------------------------------- +// +bool MulSliderVertical::IsSliderVisual(CAlfVisual *aVisual) + { + if(aVisual == mData->mSliderCentre|| + aVisual == mData->mSliderCentreGhost|| + aVisual == mData->mSliderHandle|| + aVisual == mData->mSliderHandleGhost|| + aVisual == mData->mImagePlus|| + aVisual == mData->mImageMinus) + { + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// updateTextVisualization +// --------------------------------------------------------------------------- +// +void MulSliderVertical::updateTextVisualization() + {/* + MulSliderModel* sliderModel = mSliderModel; + const char* perctext = sliderModel->GetPercentText(); + SetTextLabels(perctext);*/ + } + }//namespace Alf + +//End Of File diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/ListTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/ListTest.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,35 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"ListTest"},(0x0F426B8B),1,0,0 + +;Supports Series 60 v 3.0 +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy +"\epoc32\release\armv5\urel\ListTest.exe"-"!:\sys\bin\ListTest.exe" +"\epoc32\data\z\private\10003a3f\apps\ListTest_reg.rsc"-"!:\private\10003a3f\import\apps\ListTest_reg.rsc" +"\epoc32\data\z\resource\apps\ListTest_loc.Rsc"-"!:\resource\apps\ListTest_loc.Rsc" +"\epoc32\data\z\resource\apps\ListTest.Rsc"-"!:\resource\apps\ListTest.Rsc" + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/RDTest_02.key --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/RDTest_02.key Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn +uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO +vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB +AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo +REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss +/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J +s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut +sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/ +pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp +VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ +P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK +1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT +1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x +-----END RSA PRIVATE KEY----- diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/aakash.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/aakash.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: batch file for aakash sisx. +rem + +call makesis aakash.pkg +call signsis -s aakash.sis aakash.sisx RDTest_02.der RDTest_02.key + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/aakash.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/aakash.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,83 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"Aakash"},(0x0E52736A),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +;============================= +;MulCoverFlowWidget dll's +;============================= +"\epoc32\release\armv5\urel\mulcoverflowwidget.dll"-"!:\sys\bin\mulcoverflowwidget.dll" +"\epoc32\data\z\resource\plugins\mulcoverflowwidget.rsc"-"!:\resource\plugins\mulcoverflowwidget.rsc" + + +;MulSliderWidget dll's +;============================= +"\epoc32\release\armv5\urel\mulsliderwidget.dll"-"!:\sys\bin\mulsliderwidget.dll" +"\epoc32\data\z\resource\plugins\mulsliderwidget.rsc"-"!:\resource\plugins\mulsliderwidget.rsc" + +;MulSliderWidget Images +;============================= +"\epoc32\data\z\resource\slider\mui_cover_handle.svg" -"c:\resource\slider\mui_cover_handle.svg" +"\epoc32\data\z\resource\slider\mui_dl_progress_lsc.svg" -"c:\resource\slider\mui_dl_progress_lsc.svg" +"\epoc32\data\z\resource\slider\mui_handle.png" -"c:\resource\slider\mui_handle.png" +"\epoc32\data\z\resource\slider\mui_slider_lsc.svg" -"c:\resource\slider\mui_slider_lsc.svg" +"\epoc32\data\z\resource\slider\mui_slider_progress.svg" -"c:\resource\slider\mui_slider_progress.svg" +"\epoc32\data\z\resource\slider\mui_slider_prt.svg" -"c:\resource\slider\mui_slider_prt.svg" +"\epoc32\data\z\resource\slider\qgn_indi_slider_zoom_in.svg" -"c:\resource\slider\qgn_indi_slider_zoom_in.svg" +"\epoc32\data\z\resource\slider\qgn_indi_slider_zoom_out.svg" -"c:\resource\slider\qgn_indi_slider_zoom_out.svg" +"\epoc32\data\z\resource\slider\qgn_indi_volumeslider_audio_off.svg" -"c:\resource\slider\qgn_indi_volumeslider_audio_off.svg" +"\epoc32\data\z\resource\slider\qgn_indi_volumeslider_audio_on.svg" -"c:\resource\slider\qgn_indi_volumeslider_audio_on.svg" +"\epoc32\data\z\resource\slider\qgn_indi_volumeslider_minus.svg" -"c:\resource\slider\qgn_indi_volumeslider_minus.svg" +"\epoc32\data\z\resource\slider\qgn_indi_volumeslider_plus.svg" -"c:\resource\slider\qgn_indi_volumeslider_plus.svg" + + +;============================= +;DataModel dll's +;============================= +"\epoc32\release\armv5\urel\muldatamodelplugin.dll"-"!:\sys\bin\muldatamodelplugin.dll" +"\epoc32\data\z\resource\plugins\muldatamodelplugin.rsc"-"!:\resource\plugins\muldatamodelplugin.rsc" +"\epoc32\release\armv5\urel\muldatamodel.dll"-"!:\sys\bin\muldatamodel.dll" + + +;============================= +;Utility dlls +;============================= +"\epoc32\release\armv5\urel\mulmodelutility.dll"-"!:\sys\bin\mulmodelutility.dll" +"\epoc32\release\armv5\urel\mulutility.dll"-"!:\sys\bin\mulutility.dll" + +;============================= +;Gesturehelper +;============================= + +"\epoc32\release\armv5\urel\gesturehelper.dll"-"!:\sys\bin\gesturehelper.dll" +;============================= +;Mullogging +;============================= + +"\epoc32\release\armv5\urel\mullogging.dll"-"!:\sys\bin\mullogging.dll" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/aakash_udeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/aakash_udeb.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: batch file including logging utility. +rem + +call makesis aakash_udeb.pkg +call signsis -s aakash_udeb.sis aakash_udeb.sisx RDTest_02.der RDTest_02.key \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/aakash_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/aakash_udeb.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,132 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"Aakash"},(0x0E52736A),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +;============================= +;MulCoverFlowWidget dll's +;============================= +"\epoc32\release\armv5\udeb\mulcoverflowwidget.dll"-"!:\sys\bin\mulcoverflowwidget.dll" +"\epoc32\data\z\resource\plugins\mulcoverflowwidget.rsc"-"!:\resource\plugins\mulcoverflowwidget.rsc" +;============================= +;MulCoverFlowWidget XMLs +;============================= +"\epoc32\data\z\resource\coverflow\logical_template_1.xml" -"c:\resource\coverflow\logical_template_1.xml" +"\epoc32\data\z\resource\coverflow\logical_template_2.xml" -"c:\resource\coverflow\logical_template_2.xml" +"\epoc32\data\z\resource\coverflow\logical_template_3.xml" -"c:\resource\coverflow\logical_template_3.xml" +"\epoc32\data\z\resource\coverflow\logical_template_4.xml" -"c:\resource\coverflow\logical_template_4.xml" + +;============================= +;MullistWidget dll's +;============================= +"\epoc32\release\armv5\udeb\mullistwidget.dll"-"!:\sys\bin\mullistwidget.dll" +"\epoc32\data\z\resource\plugins\mullistwidget.rsc"-"!:\resource\plugins\mullistwidget.rsc" + +;============================= +;MullistWidget XMLs +;============================= +"\epoc32\data\z\resource\list\logical_template_1.xml" -"c:\resource\list\logical_template_1.xml" +"\epoc32\data\z\resource\list\logical_template_2.xml" -"c:\resource\list\logical_template_2.xml" +"\epoc32\data\z\resource\list\logical_template_3.xml" -"c:\resource\list\logical_template_3.xml" +"\epoc32\data\z\resource\list\logical_template_4.xml" -"c:\resource\list\logical_template_4.xml" +"\epoc32\data\z\resource\list\logical_template_5.xml" -"c:\resource\list\logical_template_5.xml" +"\epoc32\data\z\resource\list\logical_template_6.xml" -"c:\resource\list\logical_template_6.xml" +"\epoc32\data\z\resource\list\logical_template_7.xml" -"c:\resource\list\logical_template_7.xml" +"\epoc32\data\z\resource\list\logical_template_8.xml" -"c:\resource\list\logical_template_8.xml" +"\epoc32\data\z\resource\list\logical_template_10.xml" -"c:\resource\list\logical_template_10.xml" +"\epoc32\data\z\resource\list\logical_template_11.xml" -"c:\resource\list\logical_template_11.xml" +"\epoc32\data\z\resource\list\logical_template_12.xml" -"c:\resource\list\logical_template_12.xml" +"\epoc32\data\z\resource\list\logical_template_13.xml" -"c:\resource\list\logical_template_13.xml" + +;============================= +;MulGridWidget dll's +;============================= +"\epoc32\release\armv5\udeb\mulgridwidget.dll"-"!:\sys\bin\mulgridwidget.dll" +"\epoc32\data\z\resource\plugins\mulgridwidget.rsc"-"!:\resource\plugins\mulgridwidget.rsc" +;============================= +;MulGridWidget XMLs +;============================= +"\epoc32\data\z\resource\grid\logical_template_1.xml" -"c:\resource\grid\logical_template_1.xml" +"\epoc32\data\z\resource\grid\logical_template_2.xml" -"c:\resource\grid\logical_template_2.xml" +"\epoc32\data\z\resource\grid\logical_template_3.xml" -"c:\resource\grid\logical_template_3.xml" +"\epoc32\data\z\resource\grid\logical_template_4.xml" -"c:\resource\grid\logical_template_4.xml" + +;============================= +;MulSliderWidget dll's +;============================= +"\epoc32\release\armv5\udeb\mulsliderwidget.dll"-"!:\sys\bin\mulsliderwidget.dll" +"\epoc32\data\z\resource\plugins\mulsliderwidget.rsc"-"!:\resource\plugins\mulsliderwidget.rsc" +;============================= +;MulSliderWidget XMLs +;============================= +"\epoc32\data\z\resource\slider\logical_template_1.xml" -"c:\resource\slider\logical_template_1.xml" +"\epoc32\data\z\resource\slider\logical_template_2.xml" -"c:\resource\slider\logical_template_2.xml" +"\epoc32\data\z\resource\slider\logical_template_3.xml" -"c:\resource\slider\logical_template_3.xml" +"\epoc32\data\z\resource\slider\logical_template_4.xml" -"c:\resource\slider\logical_template_4.xml" +"\epoc32\data\z\resource\slider\logical_template_5.xml" -"c:\resource\slider\logical_template_5.xml" +"\epoc32\data\z\resource\slider\logical_template_6.xml" -"c:\resource\slider\logical_template_6.xml" +"\epoc32\data\z\resource\slider\logical_template_7.xml" -"c:\resource\slider\logical_template_7.xml" +"\epoc32\data\z\resource\slider\logical_template_8.xml" -"c:\resource\slider\logical_template_8.xml" + +;============================= +;MulSliderWidget Images +;============================= +"\epoc32\data\z\resource\slider\mui_cover_handle.svg" -"c:\resource\slider\mui_cover_handle.svg" +"\epoc32\data\z\resource\slider\mui_handle.png" -"c:\resource\slider\mui_handle.png" +"\epoc32\data\z\resource\slider\mui_slider_progress.svg" -"c:\resource\slider\mui_slider_progress.svg" +"\epoc32\data\z\resource\slider\mui_slider_lsc.svg" -"c:\resource\slider\mui_slider_lsc.svg" +"\epoc32\data\z\resource\slider\mui_dl_progress_lsc.svg" -"c:\resource\slider\mui_dl_progress_lsc.svg" +"\epoc32\data\z\resource\slider\mui_slider_prt.svg" -"c:\resource\slider\mui_slider_prt.svg" + +;============================= +;DataModel dll's +;============================= +"\epoc32\release\armv5\udeb\muldatamodelplugin.dll"-"!:\sys\bin\muldatamodelplugin.dll" +"\epoc32\data\z\resource\plugins\muldatamodelplugin.rsc"-"!:\resource\plugins\muldatamodelplugin.rsc" +"\epoc32\release\armv5\udeb\muldatamodel.dll"-"!:\sys\bin\muldatamodel.dll" + + +;============================= +;Utility dlls +;============================= +"\epoc32\release\armv5\udeb\mulmodelutility.dll"-"!:\sys\bin\mulmodelutility.dll" +"\epoc32\release\armv5\udeb\mulsingleitemmodel.dll"-"!:\sys\bin\mulsingleitemmodel.dll" +"\epoc32\release\armv5\udeb\mulutility.dll"-"!:\sys\bin\mulutility.dll" + +;============================= +;Gesturehelper +;============================= + +"\epoc32\release\armv5\udeb\gesturehelper.dll"-"!:\sys\bin\gesturehelper.dll" + +;============================= +;Mullogging +;============================= + +"\epoc32\release\armv5\udeb\mullogging.dll"-"!:\sys\bin\mullogging.dll" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/coverflow_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/coverflow_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,112 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"CoverFlowTest"},(0x0AE3C7F),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + + +"\epoc32\release\armv5\urel\testcoverflowwidget.exe"-"!:\sys\bin\testcoverflowwidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\TESTCOVERFLOWWIDGET_reg.rsc"-"!:\private\10003a3f\import\apps\TESTCOVERFLOWWIDGET_reg.rsc" +"\epoc32\data\z\resource\apps\TESTCOVERFLOWWIDGET_loc.RSc"-"!:\resource\apps\TESTCOVERFLOWWIDGET_loc.RSc" +"\epoc32\data\z\resource\apps\testcoverflowwidget.RSc"-"!:\resource\apps\testcoverflowwidget.RSc" + + +"\epoc32\winscw\c\dataimage\coverflow\i01.png" -"c:\dataimage\coverflow\i01.png" +"\epoc32\winscw\c\dataimage\coverflow\i02.png" -"c:\dataimage\coverflow\i02.png" +"\epoc32\winscw\c\dataimage\coverflow\i03.png" -"c:\dataimage\coverflow\i03.png" +"\epoc32\winscw\c\dataimage\coverflow\i04.png" -"c:\dataimage\coverflow\i04.png" +"\epoc32\winscw\c\dataimage\coverflow\i05.png" -"c:\dataimage\coverflow\i05.png" +"\epoc32\winscw\c\dataimage\coverflow\i06.png" -"c:\dataimage\coverflow\i06.png" +"\epoc32\winscw\c\dataimage\coverflow\i07.png" -"c:\dataimage\coverflow\i07.png" +"\epoc32\winscw\c\dataimage\coverflow\i08.png" -"c:\dataimage\coverflow\i08.png" +"\epoc32\winscw\c\dataimage\coverflow\i09.png" -"c:\dataimage\coverflow\i09.png" +"\epoc32\winscw\c\dataimage\coverflow\i10.png" -"c:\dataimage\coverflow\i10.png" +"\epoc32\winscw\c\dataimage\coverflow\i11.png" -"c:\dataimage\coverflow\i11.png" +"\epoc32\winscw\c\dataimage\coverflow\i12.png" -"c:\dataimage\coverflow\i12.png" + + +"\epoc32\winscw\c\dataimage\coverflow\bmp.bmp" -"c:\dataimage\coverflow\bmp.bmp" +"\epoc32\winscw\c\dataimage\coverflow\gif.gif" -"c:\dataimage\coverflow\gif.gif" +"\epoc32\winscw\c\dataimage\coverflow\ci01.jpg" -"c:\dataimage\coverflow\ci01.jpg" +"\epoc32\winscw\c\dataimage\coverflow\jpeg.jpg" -"c:\dataimage\coverflow\jpeg.jpg" +"\epoc32\winscw\c\dataimage\coverflow\svg.svg" -"c:\dataimage\coverflow\svg.svg" +"\epoc32\winscw\c\dataimage\coverflow\schedule.png" -"c:\dataimage\coverflow\schedule.png" +"\epoc32\winscw\c\dataimage\coverflow\icon.png" -"c:\dataimage\coverflow\icon.png" +"\epoc32\winscw\c\dataimage\coverflow\default.png" -"c:\dataimage\coverflow\default.png" + +"\epoc32\winscw\c\dataimage\coverflow\1.jpg" -"c:\dataimage\coverflow\1.jpg" +"\epoc32\winscw\c\dataimage\coverflow\2.jpg" -"c:\dataimage\coverflow\2.jpg" +"\epoc32\winscw\c\dataimage\coverflow\3.jpg" -"c:\dataimage\coverflow\3.jpg" +"\epoc32\winscw\c\dataimage\coverflow\4.jpg" -"c:\dataimage\coverflow\4.jpg" +"\epoc32\winscw\c\dataimage\coverflow\5.jpg" -"c:\dataimage\coverflow\5.jpg" +"\epoc32\winscw\c\dataimage\coverflow\6.jpg" -"c:\dataimage\coverflow\6.jpg" +"\epoc32\winscw\c\dataimage\coverflow\7.jpg" -"c:\dataimage\coverflow\7.jpg" +"\epoc32\winscw\c\dataimage\coverflow\8.jpg" -"c:\dataimage\coverflow\8.jpg" +"\epoc32\winscw\c\dataimage\coverflow\9.jpg" -"c:\dataimage\coverflow\9.jpg" +"\epoc32\winscw\c\dataimage\coverflow\10.jpg" -"c:\dataimage\coverflow\10.jpg" +"\epoc32\winscw\c\dataimage\coverflow\11.jpg" -"c:\dataimage\coverflow\11.jpg" +"\epoc32\winscw\c\dataimage\coverflow\12.jpg" -"c:\dataimage\coverflow\12.jpg" +"\epoc32\winscw\c\dataimage\coverflow\13.jpg" -"c:\dataimage\coverflow\13.jpg" +"\epoc32\winscw\c\dataimage\coverflow\14.jpg" -"c:\dataimage\coverflow\14.jpg" +"\epoc32\winscw\c\dataimage\coverflow\15.jpg" -"c:\dataimage\coverflow\15.jpg" +"\epoc32\winscw\c\dataimage\coverflow\16.jpg" -"c:\dataimage\coverflow\16.jpg" +"\epoc32\winscw\c\dataimage\coverflow\17.jpg" -"c:\dataimage\coverflow\17.jpg" +"\epoc32\winscw\c\dataimage\coverflow\18.jpg" -"c:\dataimage\coverflow\18.jpg" +"\epoc32\winscw\c\dataimage\coverflow\19.jpg" -"c:\dataimage\coverflow\19.jpg" +"\epoc32\winscw\c\dataimage\coverflow\20.jpg" -"c:\dataimage\coverflow\20.jpg" +"\epoc32\winscw\c\dataimage\coverflow\21.jpg" -"c:\dataimage\coverflow\21.jpg" +"\epoc32\winscw\c\dataimage\coverflow\22.jpg" -"c:\dataimage\coverflow\22.jpg" +"\epoc32\winscw\c\dataimage\coverflow\23.jpg" -"c:\dataimage\coverflow\23.jpg" +"\epoc32\winscw\c\dataimage\coverflow\24.jpg" -"c:\dataimage\coverflow\24.jpg" +"\epoc32\winscw\c\dataimage\coverflow\25.jpg" -"c:\dataimage\coverflow\25.jpg" +"\epoc32\winscw\c\dataimage\coverflow\26.jpg" -"c:\dataimage\coverflow\26.jpg" +"\epoc32\winscw\c\dataimage\coverflow\27.jpg" -"c:\dataimage\coverflow\27.jpg" +"\epoc32\winscw\c\dataimage\coverflow\28.jpg" -"c:\dataimage\coverflow\28.jpg" +"\epoc32\winscw\c\dataimage\coverflow\29.jpg" -"c:\dataimage\coverflow\29.jpg" +"\epoc32\winscw\c\dataimage\coverflow\30.jpg" -"c:\dataimage\coverflow\30.jpg" +"\epoc32\winscw\c\dataimage\coverflow\31.jpg" -"c:\dataimage\coverflow\31.jpg" +"\epoc32\winscw\c\dataimage\coverflow\32.jpg" -"c:\dataimage\coverflow\32.jpg" +"\epoc32\winscw\c\dataimage\coverflow\33.jpg" -"c:\dataimage\coverflow\33.jpg" +"\epoc32\winscw\c\dataimage\coverflow\34.jpg" -"c:\dataimage\coverflow\34.jpg" +"\epoc32\winscw\c\dataimage\coverflow\35.jpg" -"c:\dataimage\coverflow\35.jpg" +"\epoc32\winscw\c\dataimage\coverflow\36.jpg" -"c:\dataimage\coverflow\36.jpg" +"\epoc32\winscw\c\dataimage\coverflow\37.jpg" -"c:\dataimage\coverflow\37.jpg" +"\epoc32\winscw\c\dataimage\coverflow\38.jpg" -"c:\dataimage\coverflow\38.jpg" +"\epoc32\winscw\c\dataimage\coverflow\39.jpg" -"c:\dataimage\coverflow\39.jpg" +"\epoc32\winscw\c\dataimage\coverflow\40.jpg" -"c:\dataimage\coverflow\40.jpg" +"\epoc32\winscw\c\dataimage\coverflow\41.jpg" -"c:\dataimage\coverflow\41.jpg" +"\epoc32\winscw\c\dataimage\coverflow\42.jpg" -"c:\dataimage\coverflow\42.jpg" +"\epoc32\winscw\c\dataimage\coverflow\43.jpg" -"c:\dataimage\coverflow\43.jpg" +"\epoc32\winscw\c\dataimage\coverflow\44.jpg" -"c:\dataimage\coverflow\44.jpg" +"\epoc32\winscw\c\dataimage\coverflow\45.jpg" -"c:\dataimage\coverflow\45.jpg" +"\epoc32\winscw\c\dataimage\coverflow\46.jpg" -"c:\dataimage\coverflow\46.jpg" +"\epoc32\winscw\c\dataimage\coverflow\47.jpg" -"c:\dataimage\coverflow\47.jpg" +"\epoc32\winscw\c\dataimage\coverflow\48.jpg" -"c:\dataimage\coverflow\48.jpg" +"\epoc32\winscw\c\dataimage\coverflow\49.jpg" -"c:\dataimage\coverflow\49.jpg" +"\epoc32\winscw\c\dataimage\coverflow\50.jpg" -"c:\dataimage\coverflow\50.jpg" +"\epoc32\winscw\c\dataimage\coverflow\video_play_icon.svg" -"c:\dataimage\coverflow\video_play_icon.svg" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/coverflow_test_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/coverflow_test_udeb.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,109 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"CoverFlowTest"},(0x0AE3C7F),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + + +"\epoc32\release\armv5\udeb\testcoverflowwidget.exe"-"!:\sys\bin\testcoverflowwidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\TESTCOVERFLOWWIDGET_reg.rsc"-"!:\private\10003a3f\import\apps\TESTCOVERFLOWWIDGET_reg.rsc" +"\epoc32\data\z\resource\apps\TESTCOVERFLOWWIDGET_loc.RSc"-"!:\resource\apps\TESTCOVERFLOWWIDGET_loc.RSc" +"\epoc32\data\z\resource\apps\testcoverflowwidget.RSc"-"!:\resource\apps\testcoverflowwidget.RSc" + + +"\epoc32\winscw\c\dataimage\coverflow\i01.png" -"c:\dataimage\coverflow\i01.png" +"\epoc32\winscw\c\dataimage\coverflow\i02.png" -"c:\dataimage\coverflow\i02.png" +"\epoc32\winscw\c\dataimage\coverflow\i03.png" -"c:\dataimage\coverflow\i03.png" +"\epoc32\winscw\c\dataimage\coverflow\i04.png" -"c:\dataimage\coverflow\i04.png" +"\epoc32\winscw\c\dataimage\coverflow\i05.png" -"c:\dataimage\coverflow\i05.png" +"\epoc32\winscw\c\dataimage\coverflow\i06.png" -"c:\dataimage\coverflow\i06.png" +"\epoc32\winscw\c\dataimage\coverflow\i07.png" -"c:\dataimage\coverflow\i07.png" +"\epoc32\winscw\c\dataimage\coverflow\i08.png" -"c:\dataimage\coverflow\i08.png" +"\epoc32\winscw\c\dataimage\coverflow\i09.png" -"c:\dataimage\coverflow\i09.png" +"\epoc32\winscw\c\dataimage\coverflow\i10.png" -"c:\dataimage\coverflow\i10.png" +"\epoc32\winscw\c\dataimage\coverflow\i11.png" -"c:\dataimage\coverflow\i11.png" +"\epoc32\winscw\c\dataimage\coverflow\i12.png" -"c:\dataimage\coverflow\i12.png" + + +"\epoc32\winscw\c\dataimage\coverflow\bmp.bmp" -"c:\dataimage\coverflow\bmp.bmp" +"\epoc32\winscw\c\dataimage\coverflow\gif.gif" -"c:\dataimage\coverflow\gif.gif" +"\epoc32\winscw\c\dataimage\coverflow\ci01.jpg" -"c:\dataimage\coverflow\ci01.jpg" +"\epoc32\winscw\c\dataimage\coverflow\jpeg.jpg" -"c:\dataimage\coverflow\jpeg.jpg" +"\epoc32\winscw\c\dataimage\coverflow\svg.svg" -"c:\dataimage\coverflow\svg.svg" +"\epoc32\winscw\c\dataimage\coverflow\schedule.png" -"c:\dataimage\coverflow\schedule.png" +"\epoc32\winscw\c\dataimage\coverflow\icon.png" -"c:\dataimage\coverflow\icon.png" +"\epoc32\winscw\c\dataimage\coverflow\1.jpg" -"c:\dataimage\coverflow\1.jpg" +"\epoc32\winscw\c\dataimage\coverflow\2.jpg" -"c:\dataimage\coverflow\2.jpg" +"\epoc32\winscw\c\dataimage\coverflow\3.jpg" -"c:\dataimage\coverflow\3.jpg" +"\epoc32\winscw\c\dataimage\coverflow\4.jpg" -"c:\dataimage\coverflow\4.jpg" +"\epoc32\winscw\c\dataimage\coverflow\5.jpg" -"c:\dataimage\coverflow\5.jpg" +"\epoc32\winscw\c\dataimage\coverflow\6.jpg" -"c:\dataimage\coverflow\6.jpg" +"\epoc32\winscw\c\dataimage\coverflow\7.jpg" -"c:\dataimage\coverflow\7.jpg" +"\epoc32\winscw\c\dataimage\coverflow\8.jpg" -"c:\dataimage\coverflow\8.jpg" +"\epoc32\winscw\c\dataimage\coverflow\9.jpg" -"c:\dataimage\coverflow\9.jpg" +"\epoc32\winscw\c\dataimage\coverflow\10.jpg" -"c:\dataimage\coverflow\10.jpg" +"\epoc32\winscw\c\dataimage\coverflow\11.jpg" -"c:\dataimage\coverflow\11.jpg" +"\epoc32\winscw\c\dataimage\coverflow\12.jpg" -"c:\dataimage\coverflow\12.jpg" +"\epoc32\winscw\c\dataimage\coverflow\13.jpg" -"c:\dataimage\coverflow\13.jpg" +"\epoc32\winscw\c\dataimage\coverflow\14.jpg" -"c:\dataimage\coverflow\14.jpg" +"\epoc32\winscw\c\dataimage\coverflow\15.jpg" -"c:\dataimage\coverflow\15.jpg" +"\epoc32\winscw\c\dataimage\coverflow\16.jpg" -"c:\dataimage\coverflow\16.jpg" +"\epoc32\winscw\c\dataimage\coverflow\17.jpg" -"c:\dataimage\coverflow\17.jpg" +"\epoc32\winscw\c\dataimage\coverflow\18.jpg" -"c:\dataimage\coverflow\18.jpg" +"\epoc32\winscw\c\dataimage\coverflow\19.jpg" -"c:\dataimage\coverflow\19.jpg" +"\epoc32\winscw\c\dataimage\coverflow\20.jpg" -"c:\dataimage\coverflow\20.jpg" +"\epoc32\winscw\c\dataimage\coverflow\21.jpg" -"c:\dataimage\coverflow\21.jpg" +"\epoc32\winscw\c\dataimage\coverflow\22.jpg" -"c:\dataimage\coverflow\22.jpg" +"\epoc32\winscw\c\dataimage\coverflow\23.jpg" -"c:\dataimage\coverflow\23.jpg" +"\epoc32\winscw\c\dataimage\coverflow\24.jpg" -"c:\dataimage\coverflow\24.jpg" +"\epoc32\winscw\c\dataimage\coverflow\25.jpg" -"c:\dataimage\coverflow\25.jpg" +"\epoc32\winscw\c\dataimage\coverflow\26.jpg" -"c:\dataimage\coverflow\26.jpg" +"\epoc32\winscw\c\dataimage\coverflow\27.jpg" -"c:\dataimage\coverflow\27.jpg" +"\epoc32\winscw\c\dataimage\coverflow\28.jpg" -"c:\dataimage\coverflow\28.jpg" +"\epoc32\winscw\c\dataimage\coverflow\29.jpg" -"c:\dataimage\coverflow\29.jpg" +"\epoc32\winscw\c\dataimage\coverflow\30.jpg" -"c:\dataimage\coverflow\30.jpg" +"\epoc32\winscw\c\dataimage\coverflow\31.jpg" -"c:\dataimage\coverflow\31.jpg" +"\epoc32\winscw\c\dataimage\coverflow\32.jpg" -"c:\dataimage\coverflow\32.jpg" +"\epoc32\winscw\c\dataimage\coverflow\33.jpg" -"c:\dataimage\coverflow\33.jpg" +"\epoc32\winscw\c\dataimage\coverflow\34.jpg" -"c:\dataimage\coverflow\34.jpg" +"\epoc32\winscw\c\dataimage\coverflow\35.jpg" -"c:\dataimage\coverflow\35.jpg" +"\epoc32\winscw\c\dataimage\coverflow\36.jpg" -"c:\dataimage\coverflow\36.jpg" +"\epoc32\winscw\c\dataimage\coverflow\37.jpg" -"c:\dataimage\coverflow\37.jpg" +"\epoc32\winscw\c\dataimage\coverflow\38.jpg" -"c:\dataimage\coverflow\38.jpg" +"\epoc32\winscw\c\dataimage\coverflow\39.jpg" -"c:\dataimage\coverflow\39.jpg" +"\epoc32\winscw\c\dataimage\coverflow\40.jpg" -"c:\dataimage\coverflow\40.jpg" +"\epoc32\winscw\c\dataimage\coverflow\41.jpg" -"c:\dataimage\coverflow\41.jpg" +"\epoc32\winscw\c\dataimage\coverflow\42.jpg" -"c:\dataimage\coverflow\42.jpg" +"\epoc32\winscw\c\dataimage\coverflow\43.jpg" -"c:\dataimage\coverflow\43.jpg" +"\epoc32\winscw\c\dataimage\coverflow\44.jpg" -"c:\dataimage\coverflow\44.jpg" +"\epoc32\winscw\c\dataimage\coverflow\45.jpg" -"c:\dataimage\coverflow\45.jpg" +"\epoc32\winscw\c\dataimage\coverflow\46.jpg" -"c:\dataimage\coverflow\46.jpg" +"\epoc32\winscw\c\dataimage\coverflow\47.jpg" -"c:\dataimage\coverflow\47.jpg" +"\epoc32\winscw\c\dataimage\coverflow\48.jpg" -"c:\dataimage\coverflow\48.jpg" +"\epoc32\winscw\c\dataimage\coverflow\49.jpg" -"c:\dataimage\coverflow\49.jpg" +"\epoc32\winscw\c\dataimage\coverflow\50.jpg" -"c:\dataimage\coverflow\50.jpg" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/coverflow_testapp .bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/coverflow_testapp .bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Coverflow sisx bat file +rem + +@echo off +echo DoTo: update the location for certificate and private key files + +set certificate_file=..\internal\certificates\rd.cer +set private_key_file=..\internal\certificates\rd-key.pem + +makesis coverflow_test.pkg +signsis coverflow_test.sis coverflow_test.sisx %certificate_file% %private_key_file% + +makesis grid_test.pkg +signsis grid_test.sis grid_test.sisx %certificate_file% %private_key_file% + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/gesturetest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/gesturetest.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,37 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"GestureTest"},(0x2000FA8C),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +"\epoc32\release\armv5\urel\gesturetest_0xefbdc5b3.exe"-"!:\sys\bin\gesturetest_0xefbdc5b3.exe" +"\epoc32\data\z\resource\apps\gesturetest_0xefbdc5b3.rsc"-"!:\resource\apps\gesturetest_0xefbdc5b3.rsc" +"\epoc32\data\z\private\10003a3f\apps\gesturetest_0xefbdc5b3_reg.rsc"-"!:\private\10003a3f\import\apps\gesturetest_0xefbdc5b3_reg.rsc" +"\epoc32\winscw\c\data\images\gesture_sample_pic.jpg" -"c:\Data\Images\gesture_sample_pic.jpg" + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/grid_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/grid_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,84 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"GridTest"},(0x048C0995),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +;============================= +;TestMulGridWidget +;============================= +"\epoc32\release\armv5\urel\testgridwidget.exe"-"!:\sys\bin\testgridwidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\TestGridWidget_reg.rsc"-"!:\private\10003a3f\import\apps\TestGridWidget_reg.rsc" +"\epoc32\data\z\resource\apps\TestGridWidget_loc.RSc"-"!:\resource\apps\TestGridWidget_loc.RSc" +"\epoc32\data\z\resource\apps\testgridwidget.RSc"-"!:\resource\apps\testgridwidget.RSc" + + +;============================= +;Images for grid widget +;============================= + +"\epoc32\WINSCW\C\dataimage\grid\i01.png" -"c:\dataimage\grid\i01.png" +"\epoc32\WINSCW\C\dataimage\grid\i02.png" -"c:\dataimage\grid\i02.png" +"\epoc32\WINSCW\C\dataimage\grid\i03.png" -"c:\dataimage\grid\i03.png" +"\epoc32\WINSCW\C\dataimage\grid\i04.png" -"c:\dataimage\grid\i04.png" +"\epoc32\WINSCW\C\dataimage\grid\i05.png" -"c:\dataimage\grid\i05.png" +"\epoc32\WINSCW\C\dataimage\grid\i06.png" -"c:\dataimage\grid\i06.png" +"\epoc32\WINSCW\C\dataimage\grid\i07.png" -"c:\dataimage\grid\i07.png" +"\epoc32\WINSCW\C\dataimage\grid\i08.png" -"c:\dataimage\grid\i08.png" +"\epoc32\WINSCW\C\dataimage\grid\i09.png" -"c:\dataimage\grid\i09.png" +"\epoc32\WINSCW\C\dataimage\grid\i10.png" -"c:\dataimage\grid\i10.png" +"\epoc32\WINSCW\C\dataimage\grid\i11.png" -"c:\dataimage\grid\i11.png" +"\epoc32\WINSCW\C\dataimage\grid\i12.png" -"c:\dataimage\grid\i12.png" +"\epoc32\WINSCW\C\dataimage\grid\i13.png" -"c:\dataimage\grid\i13.png" +"\epoc32\WINSCW\C\dataimage\grid\i14.png" -"c:\dataimage\grid\i14.png" +"\epoc32\WINSCW\C\dataimage\grid\i15.png" -"c:\dataimage\grid\i15.png" +"\epoc32\WINSCW\C\dataimage\grid\i16.png" -"c:\dataimage\grid\i16.png" +"\epoc32\WINSCW\C\dataimage\grid\i17.png" -"c:\dataimage\grid\i17.png" +"\epoc32\WINSCW\C\dataimage\grid\i18.png" -"c:\dataimage\grid\i18.png" +"\epoc32\WINSCW\C\dataimage\grid\i19.png" -"c:\dataimage\grid\i19.png" +"\epoc32\WINSCW\C\dataimage\grid\i20.png" -"c:\dataimage\grid\i20.png" +"\epoc32\WINSCW\C\dataimage\grid\i21.png" -"c:\dataimage\grid\i21.png" +"\epoc32\WINSCW\C\dataimage\grid\i22.png" -"c:\dataimage\grid\i22.png" +"\epoc32\WINSCW\C\dataimage\grid\i23.png" -"c:\dataimage\grid\i23.png" +"\epoc32\WINSCW\C\dataimage\grid\i24.png" -"c:\dataimage\grid\i24.png" +"\epoc32\WINSCW\C\dataimage\grid\i25.png" -"c:\dataimage\grid\i25.png" +"\epoc32\WINSCW\C\dataimage\grid\i26.png" -"c:\dataimage\grid\i26.png" +"\epoc32\WINSCW\C\dataimage\grid\i27.png" -"c:\dataimage\grid\i27.png" +"\epoc32\WINSCW\C\dataimage\grid\i28.png" -"c:\dataimage\grid\i28.png" +"\epoc32\WINSCW\C\dataimage\grid\i29.png" -"c:\dataimage\grid\i29.png" +"\epoc32\WINSCW\C\dataimage\grid\i30.png" -"c:\dataimage\grid\i30.png" + +"\epoc32\WINSCW\C\dataimage\grid\bmp.bmp" -"c:\dataimage\grid\bmp.bmp" +"\epoc32\WINSCW\C\dataimage\grid\gif.gif" -"c:\dataimage\grid\gif.gif" +"\epoc32\WINSCW\C\dataimage\grid\ci01.jpg" -"c:\dataimage\grid\ci01.jpg" +"\epoc32\WINSCW\C\dataimage\grid\jpeg.jpg" -"c:\dataimage\grid\jpeg.jpg" +"\epoc32\WINSCW\C\dataimage\grid\svg.svg" -"c:\dataimage\grid\svg.svg" +"\epoc32\WINSCW\C\dataimage\grid\play.png" -"c:\dataimage\grid\play.png" +"\epoc32\WINSCW\C\dataimage\grid\stop.png" -"c:\dataimage\grid\stop.png" +"\epoc32\WINSCW\C\dataimage\grid\empty.png" -"c:\dataimage\grid\empty.png" +"\epoc32\WINSCW\C\dataimage\grid\matrix_stripes.png" -"c:\dataimage\grid\matrix_stripes.png" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/metapane_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/metapane_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,55 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"MetapaneTest"},(0x0954A52),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +;============================= +;TestMulMetapaneWidget +;============================= +"\epoc32\release\armv5\urel\testmetapanewidget.exe"-"!:\sys\bin\testmetapanewidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\testmetapanewidget_reg.rsc"-"!:\private\10003a3f\import\apps\testmetapanewidget_reg.rsc" +"\epoc32\data\z\resource\apps\testmetapanewidget_loc.rsc"-"!:\resource\apps\testmetapanewidget_loc.rsc" +"\epoc32\data\z\resource\apps\testmetapanewidget.rsc"-"!:\resource\apps\testmetapanewidget.rsc" + +;============================= +;Images for metapane widget +;============================= +"\epoc32\WINSCW\C\dataimage\metapane\i01.png" -"c:\dataimage\metapane\i01.png" +"\epoc32\WINSCW\C\dataimage\metapane\i02.png" -"c:\dataimage\metapane\i02.png" +"\epoc32\WINSCW\C\dataimage\metapane\i03.png" -"c:\dataimage\metapane\i03.png" +"\epoc32\WINSCW\C\dataimage\metapane\i04.png" -"c:\dataimage\metapane\i04.png" +"\epoc32\WINSCW\C\dataimage\metapane\i05.png" -"c:\dataimage\metapane\i05.png" +"\epoc32\WINSCW\C\dataimage\metapane\i06.png" -"c:\dataimage\metapane\i06.png" +"\epoc32\WINSCW\C\dataimage\metapane\i07.png" -"c:\dataimage\metapane\i07.png" +"\epoc32\WINSCW\C\dataimage\metapane\i08.png" -"c:\dataimage\metapane\i08.png" +"\epoc32\WINSCW\C\dataimage\metapane\i09.png" -"c:\dataimage\metapane\i09.png" +"\epoc32\WINSCW\C\dataimage\metapane\i10.png" -"c:\dataimage\metapane\i10.png" +"\epoc32\WINSCW\C\dataimage\metapane\i11.png" -"c:\dataimage\metapane\i11.png" +"\epoc32\WINSCW\C\dataimage\metapane\play.png" -"c:\dataimage\metapane\play.png" +"\epoc32\WINSCW\C\dataimage\metapane\stop.png" -"c:\dataimage\metapane\stop.png" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/mullistapp_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/mullistapp_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,122 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"ListTestApp"},(0x0558728E),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +"\epoc32\release\armv5\urel\testlistwidget.exe"-"!:\sys\bin\testlistwidget.exe" +"\epoc32\data\z\resource\apps\testlistwidget.rsc"-"!:\resource\apps\testlistwidget.rsc" +"\epoc32\data\z\private\10003a3f\import\apps\testlistwidget_reg.rsc"-"!:\private\10003a3f\import\apps\testlistwidget_reg.rsc" +"\epoc32\data\z\resource\apps\testlistwidget_loc.rsc"-"!:\resource\apps\testlistwidget_loc.rsc" + +"\epoc32\winscw\c\dataimage\list\i01.png" -"c:\dataimage\list\i01.png" +"\epoc32\winscw\c\dataimage\list\i02.png" -"c:\dataimage\list\i02.png" +"\epoc32\winscw\c\dataimage\list\i03.png" -"c:\dataimage\list\i03.png" +"\epoc32\winscw\c\dataimage\list\i04.png" -"c:\dataimage\list\i04.png" +"\epoc32\winscw\c\dataimage\list\i05.png" -"c:\dataimage\list\i05.png" +"\epoc32\winscw\c\dataimage\list\i06.png" -"c:\dataimage\list\i06.png" +"\epoc32\winscw\c\dataimage\list\i07.png" -"c:\dataimage\list\i07.png" +"\epoc32\winscw\c\dataimage\list\i08.png" -"c:\dataimage\list\i08.png" +"\epoc32\winscw\c\dataimage\list\i09.png" -"c:\dataimage\list\i09.png" +"\epoc32\winscw\c\dataimage\list\i010.png" -"c:\dataimage\list\i010.png" +"\epoc32\winscw\c\dataimage\list\i011.png" -"c:\dataimage\list\i011.png" +"\epoc32\winscw\c\dataimage\list\i012.png" -"c:\dataimage\list\i012.png" +"\epoc32\winscw\c\dataimage\list\i013.png" -"c:\dataimage\list\i013.png" +"\epoc32\winscw\c\dataimage\list\i014.png" -"c:\dataimage\list\i014.png" +"\epoc32\winscw\c\dataimage\list\i015.png" -"c:\dataimage\list\i015.png" +"\epoc32\winscw\c\dataimage\list\i016.png" -"c:\dataimage\list\i016.png" +"\epoc32\winscw\c\dataimage\list\i017.png" -"c:\dataimage\list\i017.png" +"\epoc32\winscw\c\dataimage\list\i018.png" -"c:\dataimage\list\i018.png" +"\epoc32\winscw\c\dataimage\list\i019.png" -"c:\dataimage\list\i019.png" +"\epoc32\winscw\c\dataimage\list\i010.png" -"c:\dataimage\list\i020.png" +"\epoc32\winscw\c\dataimage\list\i021.png" -"c:\dataimage\list\i021.png" +"\epoc32\winscw\c\dataimage\list\i022.png" -"c:\dataimage\list\i022.png" +"\epoc32\winscw\c\dataimage\list\i023.png" -"c:\dataimage\list\i023.png" +"\epoc32\winscw\c\dataimage\list\i024.png" -"c:\dataimage\list\i024.png" +"\epoc32\winscw\c\dataimage\list\i025.png" -"c:\dataimage\list\i025.png" +"\epoc32\winscw\c\dataimage\list\i026.png" -"c:\dataimage\list\i026.png" +"\epoc32\winscw\c\dataimage\list\i027.png" -"c:\dataimage\list\i027.png" +"\epoc32\winscw\c\dataimage\list\i028.png" -"c:\dataimage\list\i028.png" +"\epoc32\winscw\c\dataimage\list\i029.png" -"c:\dataimage\list\i029.png" +"\epoc32\winscw\c\dataimage\list\i030.png" -"c:\dataimage\list\i030.png" +"\epoc32\winscw\c\dataimage\list\i031.png" -"c:\dataimage\list\i031.png" +"\epoc32\winscw\c\dataimage\list\i032.png" -"c:\dataimage\list\i032.png" +"\epoc32\winscw\c\dataimage\list\i033.png" -"c:\dataimage\list\i033.png" +"\epoc32\winscw\c\dataimage\list\i034.png" -"c:\dataimage\list\i034.png" +"\epoc32\winscw\c\dataimage\list\i035.png" -"c:\dataimage\list\i035.png" +"\epoc32\winscw\c\dataimage\list\i036.png" -"c:\dataimage\list\i036.png" +"\epoc32\winscw\c\dataimage\list\i036.png" -"c:\dataimage\list\matrix_stripes.png" + +"\epoc32\WINSCW\C\dataimage\list\focus.png" -"c:\dataimage\list\focus.png" +"\epoc32\WINSCW\C\dataimage\list\bmp.bmp" -"c:\dataimage\list\bmp.bmp" +"\epoc32\WINSCW\C\dataimage\list\gif.gif" -"c:\dataimage\list\gif.gif" +"\epoc32\WINSCW\C\dataimage\list\ci01.jpg" -"c:\dataimage\list\ci01.jpg" +"\epoc32\WINSCW\C\dataimage\list\jpeg.jpg" -"c:\dataimage\list\jpeg.jpg" +"\epoc32\WINSCW\C\dataimage\list\play.png" -"c:\dataimage\list\play.png" +"\epoc32\WINSCW\C\dataimage\list\stop.png" -"c:\dataimage\list\stop.png" +"\epoc32\WINSCW\C\dataimage\list\svg.svg" -"c:\dataimage\list\svg.svg" + + +"\epoc32\WINSCW\C\dataimage\list\i01.svg" -"c:\dataimage\list\i01.svg" +"\epoc32\WINSCW\C\dataimage\list\i02.svg" -"c:\dataimage\list\i02.svg" +"\epoc32\WINSCW\C\dataimage\list\i03.svg" -"c:\dataimage\list\i03.svg" +"\epoc32\WINSCW\C\dataimage\list\i04.svg" -"c:\dataimage\list\i04.svg" +"\epoc32\WINSCW\C\dataimage\list\i05.svg" -"c:\dataimage\list\i05.svg" +"\epoc32\winscw\c\dataimage\list\i06.svg" -"c:\dataimage\list\i06.svg" +"\epoc32\winscw\c\dataimage\list\i07.svg" -"c:\dataimage\list\i07.svg" +"\epoc32\winscw\c\dataimage\list\i08.svg" -"c:\dataimage\list\i08.svg" +"\epoc32\winscw\c\dataimage\list\i09.svg" -"c:\dataimage\list\i09.svg" +"\epoc32\winscw\c\dataimage\list\i010.svg" -"c:\dataimage\list\i010.svg" +"\epoc32\winscw\c\dataimage\list\i011.svg" -"c:\dataimage\list\i011.svg" +"\epoc32\winscw\c\dataimage\list\i012.svg" -"c:\dataimage\list\i012.svg" +"\epoc32\winscw\c\dataimage\list\i013.svg" -"c:\dataimage\list\i013.svg" +"\epoc32\winscw\c\dataimage\list\i014.svg" -"c:\dataimage\list\i014.svg" +"\epoc32\winscw\c\dataimage\list\i015.svg" -"c:\dataimage\list\i015.svg" +"\epoc32\winscw\c\dataimage\list\i016.svg" -"c:\dataimage\list\i016.svg" +"\epoc32\winscw\c\dataimage\list\i017.svg" -"c:\dataimage\list\i017.svg" +"\epoc32\winscw\c\dataimage\list\i018.svg" -"c:\dataimage\list\i018.svg" +"\epoc32\winscw\c\dataimage\list\i019.svg" -"c:\dataimage\list\i019.svg" +"\epoc32\winscw\c\dataimage\list\i010.svg" -"c:\dataimage\list\i020.svg" +"\epoc32\winscw\c\dataimage\list\i021.svg" -"c:\dataimage\list\i021.svg" +"\epoc32\winscw\c\dataimage\list\i022.svg" -"c:\dataimage\list\i022.svg" +"\epoc32\winscw\c\dataimage\list\i023.svg" -"c:\dataimage\list\i023.svg" +"\epoc32\winscw\c\dataimage\list\i024.svg" -"c:\dataimage\list\i024.svg" +"\epoc32\winscw\c\dataimage\list\i025.svg" -"c:\dataimage\list\i025.svg" +"\epoc32\winscw\c\dataimage\list\i026.svg" -"c:\dataimage\list\i026.svg" +"\epoc32\winscw\c\dataimage\list\i027.svg" -"c:\dataimage\list\i027.svg" +"\epoc32\winscw\c\dataimage\list\i028.svg" -"c:\dataimage\list\i028.svg" +"\epoc32\winscw\c\dataimage\list\i029.svg" -"c:\dataimage\list\i029.svg" +"\epoc32\winscw\c\dataimage\list\i030.svg" -"c:\dataimage\list\i030.svg" +"\epoc32\winscw\c\dataimage\list\i031.svg" -"c:\dataimage\list\i031.svg" +"\epoc32\winscw\c\dataimage\list\i032.svg" -"c:\dataimage\list\i032.svg" +"\epoc32\winscw\c\dataimage\list\i033.svg" -"c:\dataimage\list\i033.svg" +"\epoc32\winscw\c\dataimage\list\i034.svg" -"c:\dataimage\list\i034.svg" +"\epoc32\winscw\c\dataimage\list\i035.svg" -"c:\dataimage\list\i035.svg" +"\epoc32\winscw\c\dataimage\list\i036.svg" -"c:\dataimage\list\i036.svg" +"\epoc32\WINSCW\C\dataimage\list\play.svg" -"c:\dataimage\list\play.svg" +"\epoc32\WINSCW\C\dataimage\list\stop.svg" -"c:\dataimage\list\stop.svg" diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/slider_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/slider_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,39 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"SliderTest"},(0x0559728E),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +"\epoc32\winscw\c\dataimage\slider\volume.jpg" -"c:\dataimage\slider\volume.jpg" +"\epoc32\winscw\c\dataimage\slider\mute.jpg" -"c:\dataimage\slider\mute.jpg" + +"\epoc32\release\armv5\urel\testsliderwidget.exe"-"!:\sys\bin\testsliderwidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\testsliderwidget_reg.rsc"-"!:\private\10003a3f\import\apps\testsliderwidget_reg.rsc" +;"\epoc32\data\z\resource\apps\testsliderwidget_loc.rsc"-"!:\resource\apps\testsliderwidget_loc.rsc" +"\epoc32\data\z\resource\apps\testsliderwidget.rsc"-"!:\resource\apps\testsliderwidget.rsc" + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/softkeytest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/softkeytest.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,37 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"SoftKeyTest"},(0x077F3FA3),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + +"\epoc32\release\armv5\urel\testsoftkeywidget.exe"-"!:\sys\bin\testsoftkeywidget.exe" +"\epoc32\data\z\resource\apps\testsoftkeywidget.rsc"-"!:\resource\apps\testsoftkeywidget.rsc" +"\epoc32\data\z\private\10003a3f\import\apps\TestSoftkeyWidget_reg.rsc"-"!:\private\10003a3f\import\apps\TestSoftkeyWidget_reg.rsc" +"\epoc32\data\z\resource\apps\TestSoftkeyWidget_loc.rsc"-"!:\resource\apps\TestSoftkeyWidget_loc.rsc" + + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/test .bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/test .bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,34 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: bat file to create all Widget's test app. +rem + + +call makesis coverflow_test.pkg +call signsis -s coverflow_test.sis coverflow_test.sisx RDTest_02.der RDTest_02.key + +call makesis gesturetest.pkg +call signsis -s gesturetest.sis gesturetest.sisx RDTest_02.der RDTest_02.key + +call makesis grid_test.pkg +call signsis -s grid_test.sis grid_test.sisx RDTest_02.der RDTest_02.key + +call makesis mullistapp_test.pkg +call signsis -s mullistapp_test.sis mullistapp_test.sisx RDTest_02.der RDTest_02.key + +call makesis ListTest.pkg +call signsis -s ListTest.sis ListTest.sisx RDTest_02.der RDTest_02.key +call makesis slider_test.pkg +call signsis -s slider_test.sis slider_test.sisx RDTest_02.der RDTest_02.key + diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/test_udeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/test_udeb.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,40 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: bat file to create all Widget's test app with logging utility. +rem + + +call makesis coverflow_test_udeb.pkg +call signsis -s coverflow_test_udeb.sis coverflow_test_udeb.sisx RDTest_02.der RDTest_02.key + +call makesis gesturetest.pkg +call signsis -s gesturetest.sis gesturetest.sisx RDTest_02.der RDTest_02.key + +call makesis grid_test.pkg +call signsis -s grid_test.sis grid_test.sisx RDTest_02.der RDTest_02.key + +call makesis mullistapp_test.pkg +call signsis -s mullistapp_test.sis mullistapp_test.sisx RDTest_02.der RDTest_02.key + +call makesis slider_test.pkg +call signsis -s slider_test.sis slider_test.sisx RDTest_02.der RDTest_02.key + +call makesis softkeytest.pkg +call signsis -s softkeytest.sis softkeytest.sisx RDTest_02.der RDTest_02.key + +call makesis toolbar_test.pkg +call signsis -s toolbar_test.sis toolbar_test.sisx RDTest_02.der RDTest_02.key + +call makesis metapane_test.pkg +call signsis -s metapane_test.sis metapane_test.sisx RDTest_02.der RDTest_02.key diff -r 4ea6f81c838a -r 0e9bb658ef58 mulwidgets/sis/toolbar_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulwidgets/sis/toolbar_test.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,50 @@ +; +; 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: ;Language - standard language definitions +; +&EN + +; standard SIS file header +#{"ToolbarTest"},(0x0E1B3BEA),1,0,0 + +;Supports Series 60 v 3.0 +[0x1028315F], 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Files to copy + + +"\epoc32\release\armv5\urel\TestToolBarWidget.exe" -"!:\sys\bin\TestToolBarWidget.exe" +"\epoc32\data\z\private\10003a3f\import\apps\TestToolBarWidget_reg.rsc" -"!:\private\10003a3f\import\apps\TestToolBarWidget_reg.rsc" +"\epoc32\data\z\resource\apps\TestToolBarWidget_loc.rsc" -"!:\resource\apps\TestToolBarWidget_loc.rsc" +"\epoc32\data\z\resource\apps\TestToolBarWidget.rsc" -"!:\resource\apps\TestToolBarWidget.rsc" + + + + +"\epoc32\winscw\c\dataimage\toolbar\i01.png" -"c:\dataimage\toolbar\i01.png" +"\epoc32\winscw\c\dataimage\toolbar\i02.png" -"c:\dataimage\toolbar\i02.png" +"\epoc32\winscw\c\dataimage\toolbar\i03.png" -"c:\dataimage\toolbar\i03.png" +"\epoc32\winscw\c\dataimage\toolbar\i04.png" -"c:\dataimage\toolbar\i04.png" +"\epoc32\WINSCW\C\dataimage\toolbar\bmp.bmp" -"c:\dataimage\toolbar\bmp.bmp" +"\epoc32\WINSCW\C\dataimage\toolbar\gif.gif" -"c:\dataimage\toolbar\gif.gif" +"\epoc32\WINSCW\C\dataimage\toolbar\ci01.jpg" -"c:\dataimage\toolbar\ci01.jpg" +"\epoc32\WINSCW\C\dataimage\toolbar\jpeg.jpg" -"c:\dataimage\toolbar\jpeg.jpg" +"\epoc32\WINSCW\C\dataimage\toolbar\svg.svg" -"c:\dataimage\toolbar\svg.svg" + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/group/Doxyfile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/group/Doxyfile.txt Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1307 @@ +# Doxyfile 1.5.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "UI Accelerator DeclarativeUi osncore" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = panic=@exception \ + leave=@exception \ + "internalTechnology=@par Internal technology" \ + "internalComponent=@par Internal component" \ + "internalAll=@par Internal all" \ + "publishedPartner=@par Published-partner" \ + "publishedAll=@par Published-all" \ + "prototype=@par Prototype" \ + "interim=@par Interim" \ + "released=@par Released" \ + "removed=@par Removed" \ + "test=@par Test" \ + "realtime=@par Realtime" \ + "status=@par Status:\n"\ + "attributes=@par Attributes: \n"\ + "interfaces=@par Interfaces: \n"\ + "lib=@par Library: \n"\ + "events=@par Events: \n"\ + "beginAPI=@name Exported API\n @{" \ + endAPI=@} + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + + +INPUT = ../osncore/osncore/inc \ +INPUT = ../../inc/osn_string_api/inc/osn \ +INPUT = ../../inc/osn_global_api/inc/osn \ +INPUT = ../../inc/osn_container_api/inc/osn + + + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.c \ + *.cc \ + *.cpp \ + *.h \ + *.inl \ + *.hh \ + *.hrh \ + *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = TAlf \ + SAlf \ + CAlf \ + RAlf \ + MAlf \ + IAlf \ + Alf + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = doxygen + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = "NONSHARABLE_CLASS(name)=class name" \ + "OSN_NONSHARABLE_CLASS(name)=class name" \ + "_LIT(name,string)=const static TLitC name={sizeof(L##string)/2-1,L##string}" + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen will always +# show the root nodes and its direct children regardless of this setting. + +DOT_GRAPH_MAX_NODES = 50 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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: Master bld.inf +* +*/ + + +#include + +PRJ_PLATFORMS +WINSCW ARMV5 + +#include "../osncore/group/bld.inf" + +PRJ_EXPORTS +../../rom/osncore.iby CORE_MW_LAYER_IBY_EXPORT_PATH(osncore.iby) diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/bwins/osncoreu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/bwins/osncoreu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,49 @@ +EXPORTS + ??4UString@osncore@@QAEAAV01@ABV01@@Z @ 1 NONAME ; class osncore::UString & osncore::UString::operator=(class osncore::UString const &) + ??8UString@osncore@@QBE_NABV01@@Z @ 2 NONAME ; bool osncore::UString::operator==(class osncore::UString const &) const + ??0AlfPtrVectorImpl@osncore@@QAE@IAAVIDeleter@1@@Z @ 3 NONAME ; osncore::AlfPtrVectorImpl::AlfPtrVectorImpl(unsigned int, class osncore::IDeleter &) + ?remove@AlfPtrVectorImpl@osncore@@QAE_NI_N@Z @ 4 NONAME ; bool osncore::AlfPtrVectorImpl::remove(unsigned int, bool) + ?append@UString@osncore@@QAEXPBD@Z @ 5 NONAME ; void osncore::UString::append(char const *) + ??AUString@osncore@@QAEKJ@Z @ 6 NONAME ; unsigned long osncore::UString::operator[](long) + ?getByteLength@UString@osncore@@QBEJXZ @ 7 NONAME ; long osncore::UString::getByteLength(void) const + ??0UString@osncore@@QAE@PBDH@Z @ 8 NONAME ; osncore::UString::UString(char const *, int) + ?toInt@osncore@@YAHABVUString@1@@Z @ 9 NONAME ; int osncore::toInt(class osncore::UString const &) + ??_V@YAXPAXW4newarg@@@Z @ 10 NONAME ; void operator delete[](void *, enum newarg) + ?insert@UString@osncore@@QAEXJPBDJ@Z @ 11 NONAME ; void osncore::UString::insert(long, char const *, long) + ??0UString@osncore@@QAE@PBD@Z @ 12 NONAME ; osncore::UString::UString(char const *) + ?normalizeNFD@osncore@@YA?AV?$auto_ptr@VUString@osncore@@@std@@ABVUString@1@@Z @ 13 NONAME ; class std::auto_ptr osncore::normalizeNFD(class osncore::UString const &) + ?erase@UString@osncore@@QAEXJJ@Z @ 14 NONAME ; void osncore::UString::erase(long, long) + ??8UString@osncore@@QBE_NPBD@Z @ 15 NONAME ; bool osncore::UString::operator==(char const *) const + ?what@InvalidUtf8@UString@osncore@@UBEPBDXZ @ 16 NONAME ; char const * osncore::UString::InvalidUtf8::what(void) const + ??0UString@osncore@@QAE@K@Z @ 17 NONAME ; osncore::UString::UString(unsigned long) + ??_U@YAPAXIW4newarg@@@Z @ 18 NONAME ; void * operator new[](unsigned int, enum newarg) + ?replace@UString@osncore@@QAEXJPBDJ@Z @ 19 NONAME ; void osncore::UString::replace(long, char const *, long) + ?compare@UString@osncore@@QBEHABV12@@Z @ 20 NONAME ; int osncore::UString::compare(class osncore::UString const &) const + ??1?$UtfProxy@G@osncore@@QAE@XZ @ 21 NONAME ; osncore::UtfProxy::~UtfProxy(void) + ?clear@AlfPtrVectorImpl@osncore@@QAEX_N@Z @ 22 NONAME ; void osncore::AlfPtrVectorImpl::clear(bool) + ?normalizeNFKD@osncore@@YA?AV?$auto_ptr@VUString@osncore@@@std@@ABVUString@1@@Z @ 23 NONAME ; class std::auto_ptr osncore::normalizeNFKD(class osncore::UString const &) + ??0UString@osncore@@QAE@ABV01@@Z @ 24 NONAME ; osncore::UString::UString(class osncore::UString const &) + ??4UString@osncore@@QAEAAV01@PBD@Z @ 25 NONAME ; class osncore::UString & osncore::UString::operator=(char const *) + ?append@UString@osncore@@QAEXABV12@@Z @ 26 NONAME ; void osncore::UString::append(class osncore::UString const &) + ?getUtf8@UString@osncore@@QBEPBDXZ @ 27 NONAME ; char const * osncore::UString::getUtf8(void) const + ??3@YAXPAXW4newarg@@@Z @ 28 NONAME ; void operator delete(void *, enum newarg) + ?resize@AlfPtrVectorImpl@osncore@@QAE_NI_N@Z @ 29 NONAME ; bool osncore::AlfPtrVectorImpl::resize(unsigned int, bool) + ?replace@UString@osncore@@QAEXJPBD@Z @ 30 NONAME ; void osncore::UString::replace(long, char const *) + ?findRef@AlfPtrVectorImpl@osncore@@QAEHPAX@Z @ 31 NONAME ; int osncore::AlfPtrVectorImpl::findRef(void *) + ?insert@UString@osncore@@QAEXJPBD@Z @ 32 NONAME ; void osncore::UString::insert(long, char const *) + ??1UString@osncore@@UAE@XZ @ 33 NONAME ; osncore::UString::~UString(void) + ?toUtf16@osncore@@YA?AV?$auto_ptr@V?$UtfProxy@G@osncore@@@std@@ABVUString@1@@Z @ 34 NONAME ; class std::auto_ptr > osncore::toUtf16(class osncore::UString const &) + ??2@YAPAXIW4newarg@@@Z @ 35 NONAME ; void * operator new(unsigned int, enum newarg) + ?getCharLength@UString@osncore@@QBEJXZ @ 36 NONAME ; long osncore::UString::getCharLength(void) const + ?insert@AlfPtrVectorImpl@osncore@@QAE_NIPAX_N@Z @ 37 NONAME ; bool osncore::AlfPtrVectorImpl::insert(unsigned int, void *, bool) + ?isEmpty@UString@osncore@@QBE_NXZ @ 38 NONAME ; bool osncore::UString::isEmpty(void) const + ?normalizeNFC@osncore@@YA?AV?$auto_ptr@VUString@osncore@@@std@@ABVUString@1@@Z @ 39 NONAME ; class std::auto_ptr osncore::normalizeNFC(class osncore::UString const &) + ?isNull@UString@osncore@@QBE_NXZ @ 40 NONAME ; bool osncore::UString::isNull(void) const + ??0UString@osncore@@QAE@XZ @ 41 NONAME ; osncore::UString::UString(void) + ?compareC@UString@osncore@@QBEHPBD@Z @ 42 NONAME ; int osncore::UString::compareC(char const *) const + ?normalizeNFKC@osncore@@YA?AV?$auto_ptr@VUString@osncore@@@std@@ABVUString@1@@Z @ 43 NONAME ; class std::auto_ptr osncore::normalizeNFKC(class osncore::UString const &) + ??1AlfPtrVectorImpl@osncore@@QAE@XZ @ 44 NONAME ; osncore::AlfPtrVectorImpl::~AlfPtrVectorImpl(void) + ??0AlfPtrVectorImpl@osncore@@QAE@AAVIDeleter@1@@Z @ 45 NONAME ; osncore::AlfPtrVectorImpl::AlfPtrVectorImpl(class osncore::IDeleter &) + ?compareC@UString@osncore@@QBEHABV12@@Z @ 46 NONAME ; int osncore::UString::compareC(class osncore::UString const &) const + ?compare@UString@osncore@@QBEHPBD@Z @ 47 NONAME ; int osncore::UString::compare(char const *) const + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/eabi/osncoreu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/eabi/osncoreu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,64 @@ +EXPORTS + _ZN7osncore12normalizeNFCERKNS_7UStringE @ 1 NONAME + _ZN7osncore12normalizeNFDERKNS_7UStringE @ 2 NONAME + _ZN7osncore13normalizeNFKCERKNS_7UStringE @ 3 NONAME + _ZN7osncore13normalizeNFKDERKNS_7UStringE @ 4 NONAME + _ZN7osncore16AlfPtrVectorImpl5clearEb @ 5 NONAME + _ZN7osncore16AlfPtrVectorImpl6insertEjPvb @ 6 NONAME + _ZN7osncore16AlfPtrVectorImpl6removeEjb @ 7 NONAME + _ZN7osncore16AlfPtrVectorImpl6resizeEjb @ 8 NONAME + _ZN7osncore16AlfPtrVectorImpl7findRefEPv @ 9 NONAME + _ZN7osncore16AlfPtrVectorImplC1ERNS_8IDeleterE @ 10 NONAME + _ZN7osncore16AlfPtrVectorImplC1EjRNS_8IDeleterE @ 11 NONAME + _ZN7osncore16AlfPtrVectorImplC2ERNS_8IDeleterE @ 12 NONAME + _ZN7osncore16AlfPtrVectorImplC2EjRNS_8IDeleterE @ 13 NONAME + _ZN7osncore16AlfPtrVectorImplD1Ev @ 14 NONAME + _ZN7osncore16AlfPtrVectorImplD2Ev @ 15 NONAME + _ZN7osncore5toIntERKNS_7UStringE @ 16 NONAME + _ZN7osncore7UString5eraseEll @ 17 NONAME + _ZN7osncore7UString6appendEPKc @ 18 NONAME + _ZN7osncore7UString6appendERKS0_ @ 19 NONAME + _ZN7osncore7UString6insertElPKc @ 20 NONAME + _ZN7osncore7UString6insertElPKcl @ 21 NONAME + _ZN7osncore7UString7replaceElPKc @ 22 NONAME + _ZN7osncore7UString7replaceElPKcl @ 23 NONAME + _ZN7osncore7UStringC1EPKc @ 24 NONAME + _ZN7osncore7UStringC1EPKci @ 25 NONAME + _ZN7osncore7UStringC1ERKS0_ @ 26 NONAME + _ZN7osncore7UStringC1Em @ 27 NONAME + _ZN7osncore7UStringC1Ev @ 28 NONAME + _ZN7osncore7UStringC2EPKc @ 29 NONAME + _ZN7osncore7UStringC2EPKci @ 30 NONAME + _ZN7osncore7UStringC2ERKS0_ @ 31 NONAME + _ZN7osncore7UStringC2Em @ 32 NONAME + _ZN7osncore7UStringC2Ev @ 33 NONAME + _ZN7osncore7UStringD0Ev @ 34 NONAME + _ZN7osncore7UStringD1Ev @ 35 NONAME + _ZN7osncore7UStringD2Ev @ 36 NONAME + _ZN7osncore7UStringaSEPKc @ 37 NONAME + _ZN7osncore7UStringaSERKS0_ @ 38 NONAME + _ZN7osncore7UStringixEl @ 39 NONAME + _ZN7osncore7toUtf16ERKNS_7UStringE @ 40 NONAME + _ZN7osncore8UtfProxyItED1Ev @ 41 NONAME + _ZN7osncore8UtfProxyItED2Ev @ 42 NONAME + _ZNK7osncore7UString11InvalidUtf84whatEv @ 43 NONAME + _ZNK7osncore7UString13getByteLengthEv @ 44 NONAME + _ZNK7osncore7UString13getCharLengthEv @ 45 NONAME + _ZNK7osncore7UString6isNullEv @ 46 NONAME + _ZNK7osncore7UString7compareEPKc @ 47 NONAME + _ZNK7osncore7UString7compareERKS0_ @ 48 NONAME + _ZNK7osncore7UString7getUtf8Ev @ 49 NONAME + _ZNK7osncore7UString7isEmptyEv @ 50 NONAME + _ZNK7osncore7UString8compareCEPKc @ 51 NONAME + _ZNK7osncore7UString8compareCERKS0_ @ 52 NONAME + _ZNK7osncore7UStringeqEPKc @ 53 NONAME + _ZNK7osncore7UStringeqERKS0_ @ 54 NONAME + _ZTIN7osncore7UString11InvalidUtf8E @ 55 NONAME ; ## + _ZTIN7osncore7UStringE @ 56 NONAME ; ## + _ZTVN7osncore7UString11InvalidUtf8E @ 57 NONAME ; ## + _ZTVN7osncore7UStringE @ 58 NONAME ; ## + _ZdaPv6newarg @ 59 NONAME + _ZdlPv6newarg @ 60 NONAME + _Znaj6newarg @ 61 NONAME + _Znwj6newarg @ 62 NONAME + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 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: Master bld.inf +* +*/ + +#include +#include + +PRJ_PLATFORMS + +WINSCW ARMV5 + +PRJ_EXPORTS + +PRJ_MMPFILES +osncore.mmp + +PRJ_TESTMMPFILES + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/group/osncore.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/group/osncore.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 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: Project definition file +* +*/ + + +#include +#include + +TARGET osncore.dll +TARGETTYPE dll + +VENDORID VID_DEFAULT + + + +CAPABILITY CAP_GENERAL_DLL + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + + +SOURCEPATH ../src +SOURCE ustring.cpp +SOURCE ustringimpl.cpp +SOURCE ustringutil.cpp +SOURCE osnnew.cpp +SOURCE alfptrvectorimpl.cpp + +MW_LAYER_SYSTEMINCLUDE + + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_GLIB_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + + +USERINCLUDE ../inc + +LIBRARY libstdcpp.lib +LIBRARY libc.lib +LIBRARY libglib.lib +LIBRARY euser.lib +#define ALF_LINK_STDCPP_DLL +//following include must be after definition + +LIBRARY libpthread.lib +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/inc/alfstringdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/inc/alfstringdata.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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: OSN string data header. +* +*/ + +#ifndef ALFSTRINGDATA_H +#define ALFSTRINGDATA_H + +#include + +#include "stringmacros.h" + + +namespace osncore + { + +class AlfChar; + +class CAlfString; + +struct SAlfStringData + { + // Uses shared null data. + SAlfStringData(); + + // No copy. + // SAlfStringData(AlfChar *u, uint l, uint m); + // void initialize(AlfChar *u, uint l, uint m); + + // Copy bytes. + // SAlfStringData(const AlfChar *u, uint l); + // void initialize(const AlfChar *u, uint l); + + + void initialize(const char *u, int l); + + + ~SAlfStringData(); +/* +#ifdef QSTRING_DEBUG_ALLOCATIONS + void* operator new(size_t s); + void operator delete(void*p); +#endif +*/ + inline void ref() { refCount++; } + inline void deref() { /*if (--refCount == 0 && _isHeapAllocated) delete this;*/ refCount--; } + + char* ascii(); + + char *makeAscii(); + + + + bool increaseAsciiSize(uint size); + + // AlfChar *unicode(); + // AlfChar *makeUnicode(); + + + // bool isUnicodeInternal() const { return (char *)_unicode == _internalBuffer; } + bool isAsciiInternal() const { return _ascii == _internalBuffer; } + + int refCount; + int _length; + // mutable AlfChar *_unicode; + mutable char *_ascii; + int _maxUnicode:30; + int _isUnicodeValid:1; + int _isHeapAllocated:1; // Fragile, but the only way we can be sure the instance was created with 'new'. + int _maxAscii:31; + int _isAsciiValid:1; + + char _internalBuffer[QS_INTERNAL_BUFFER_SIZE]; // Pad out to a (((size + 1) & ~15) + 14) size + +private: + SAlfStringData(const SAlfStringData &); + SAlfStringData &operator=(const SAlfStringData &); + + }; + + }// osncore +#endif \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/inc/stringmacros.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/inc/stringmacros.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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: string Macro include. +* +*/ + +#include +#include +#include + + +#define QS_INTERNAL_BUFFER_SIZE 20 +#define QS_INTERNAL_BUFFER_CHARS QS_INTERNAL_BUFFER_SIZE-1 + + +#define malloc_good_size(size) size + +//#define ALLOC_QCHAR_GOOD_SIZE(X) (malloc_good_size(X*sizeof(AlfChar))/sizeof(AlfChar)) +#define ALLOC_CHAR_GOOD_SIZE(X) (malloc_good_size(X)) + +//#ifndef __OOM__ +#define ALLOC_CHAR( N ) (char*) malloc(N) +#define REALLOC_CHAR( P, N ) (char *) realloc(P,N) +//#define ALLOC_QCHAR( N ) (AlfChar*) malloc(sizeof(AlfChar)*( N )) +//#define REALLOC_QCHAR( P, N ) (AlfChar *) realloc(P,sizeof(AlfChar)*( N )) +#define DELETE_CHAR( P ) free(P) +#define DELETE_QCHAR( P ) free( P ) + + +#define QS_INTERNAL_BUFFER_UCHARS QS_INTERNAL_BUFFER_SIZE/2 + + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/inc/ustringimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/inc/ustringimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2007 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: String class implementation +* +*/ + +#ifndef USTRING_IMPL_H +#define USTRING_IMPL_H + +#include +#include + +#define MAX_STR_LEN 24 + +namespace osncore +{ + +class SString; + +/** + * Glib string wrapper. + * @see ustring.h for description of ustring + * @lib osncore.lib + * @since S60 5.0 + */ +class UStringImpl + { +public: + /** + * Default constructor. + */ + UStringImpl(); + /** + * Construct a string as a copy of given null terminated string. + * + * @since S60 5.0 + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aStr Utf-8 encoded string + */ + explicit UStringImpl(const Utf8* aStr); + /** + * Construct a string as a copy of given string + * with byte length of the source buffer. + * Because a length is provided, source doesn't need to be null terminated. + * + * @since S60 5.0 + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aStr Utf-8 encoded string + * @param aByteCount Byte count of Utf-8 encoded string + */ + explicit UStringImpl(const Utf8* aStr, int aLen); + /** + * Construct a string from unicode code point. If Unicode is invalid, + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @since S60 5.0 + * @param aCodePoint Unicode code point + */ + explicit UStringImpl(Unicode aCodePoint); + + /** + * UStringImpl copy constructor + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @since S60 5.0 + * @param aUString Copy source + */ + UStringImpl(const UStringImpl& aUStringImpl); + + // Destructor + ~UStringImpl(); + + // Utilities + /** + * Checks whether string is empty. + * + * @since S60 5.0 + * @return True if string doesn't have content. + */ + bool empty()const; + /** + * Checks whether string is null. + * + * @since S60 5.0 + * @return True if string is null. + */ + bool null()const; + /** + * Returns the length of the string in characters. + * + * @since S60 5.0 + * @return Length + */ + long length()const; + /** + * Returns the length of the string in bytes + * + * @since S60 5.0 + * @return Bytes + */ + long bytes()const; + + /** + * Returns utf8 type string + * + * @since S60 5.0 + * @return utf8 type string + */ + const Utf8* utf8()const; + + /** + * Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive. + * + * @since S60 5.0 + * @param aUStringImpl UStringImpl object to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + int compare(const UStringImpl& aUStringImpl)const; + /** + * Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive. + * + * @since S60 5.0 + * @param aStr String to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + int compare(const Utf8* aStr)const; + /** + * Compares two strings for ordering using the linguistically correct rules for the current locale. + * When sorting a large number of strings, it will be significantly faster + * to obtain collation keys with g_utf8_collate_key()from libglib and compare the keys + * with strcmp() when sorting instead of sorting the original strings. + * + * @since S60 5.0 + * @param aUStringImpl UStringImpl object to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + int compareC(const UStringImpl& aUStringImpl)const; + /** + * Compares two strings for ordering using the linguistically correct rules for the current locale. + * When sorting a large number of strings, it will be significantly faster + * to obtain collation keys with g_utf8_collate_key() from libglib and compare the keys + * with strcmp() when sorting instead of sorting the original strings. + * If aStr is invalid utf8, UString::InvalidUtf8 exception is thrown. + * + * + * @since S60 5.0 + * @param aStr String to compare + * @return < 0 if this compares before aRhs, 0 if they compare equal, > 0 if this compares after aRhs. + */ + int compareC(const Utf8* aStr)const; + + /** + * Adds a string onto the end of string, expanding it if necessary. + * + * @since S60 5.0 + * @param aUStringImpl String object to append + */ + void append(const UStringImpl& aUStringImpl); + /** + * Adds a string onto the end of string, expanding it if necessary. + * + * @since S60 5.0 + * @param aStr String to append + */ + void append(const Utf8* aStr); + + /** + * Inserts aStr into string, expanding it if necessary. + * If aPos is -1, bytes are inserted at the end of the string. + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aPos The character position to insert the copy of the string + * @param aStr The string to insert + */ + void insert(long aPos, const Utf8* aStr); + /** + * Inserts aStr into string, expanding it if necessary. Because length is + * provided, aStr may contain embedded nulls and need not be null terminated. + * If aPos is -1, bytes are inserted at the end of the string. + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aPos The character position to insert the copy of the string + * @param aStr The string to insert + * @param aCharCount Character count. + */ + void insert(long aPos, const Utf8* aStr, long aLength); + /** + * Replace a substring with a given string, expanding it if necessary + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aPos The charater position to replace the string + * @param aStr The string to insert + */ + void replace(long aPos, const Utf8* aStr); + /** + * Replace a substring with a given string, expanding it if necessary. Because length is + * provided, aStr may contain embedded nulls and need not be null terminated. + * If aLength is < 0, length is assumed to be aStr's length. + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aPos The character position to replace the string + * @param aStr The string to insert + * @param aCharCount Character count. + */ + void replace(long aPos, const Utf8* aStr, long aLength); + /** + * Erase a substring + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if given position is invalid + * @param aPos The character position to start erasing from + * @param aCharCount number of characters to erase. + */ + void erase(long aPosOffset, long aLength); + + /** + * Returns unicode at given position in string + * + * @since S60 5.0 + * @exception std:out_of_range is thrown if requested index is invalid + * @param aPos The requested position + */ + Unicode operator[](long aIndex); + +private: + /** + * Initialises internal string + * @since S60 5.0 + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aStr The string used for initialising + */ + void initialize(const Utf8* aStr); + /** + * Allocates memory from heap if needed for internal string, throws if allocation fail + * @since S60 5.0 + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aLength length of bytes to allocate + */ + void checkBuffer(unsigned int aLength); + /** + * Implements the insertion functionality + * @since S60 5.0 + * @exception std:bad_alloc is thrown if string cannot be allocated from heap + * @param aIndex The character position to insert the copy of the string + * @param aInsertChars The string to insert + * @param aInsertLength The amount of characters to insert + */ + void insertImpl(unsigned int aIndex, const char* aInsertChars, unsigned int aInsertLength); + /** + * Implements the append functionality + * @since S60 5.0 + * @param aStr The string to append + * @param aLength The amount of characters to append + */ + void appendImpl(const char* aStr, unsigned int aLength); + /** + * Implements the erase functionality + * @since S60 5.0 + * @exception std:out_of_range is thrown if given index is invalid + * @param aIndex The character position to start erasing from + * @param aLength The amount of characters to erase + */ + void eraseImpl(unsigned int aIndex, unsigned int aLength); +private: + /** + * Internal buffer, allocated from heap. + * Long strings are allocated from heap + */ + gchar* str; + /** + * Internal buffer, allocated from stack. + * Short strings are allocated from stack for performance reason, + */ + gchar internalStr[MAX_STR_LEN]; + /** + * length of string + */ + gsize len; + /** + * length of allocated bytes + */ + gsize allocated_len; + /** + * Identifies if string is allocated from heap or not + */ + bool isInHeap; + }; +} + +#endif \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/alfptrvectorimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/alfptrvectorimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,227 @@ +/* +* 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: osn vector pointer implementation. +* +*/ + +#if defined(__GNUC__) +#include +#include +#else +#include +#endif + +#include +#include + +namespace osncore + { + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT AlfPtrVectorImpl::AlfPtrVectorImpl(IDeleter& aDeleter) + : mdata(0), msize(0), mcount(0), mDeleter(aDeleter) + { + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT AlfPtrVectorImpl::AlfPtrVectorImpl(uint aSize, IDeleter& aDeleter): + mdata(0), + msize(aSize), + mcount(0), mDeleter(aDeleter) + { + mdata = (void **)malloc(aSize * sizeof(void *)); + if(!mdata) + { + throw std::bad_alloc(); + } + memset(mdata, 0, aSize * sizeof(void *)); + } + + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT AlfPtrVectorImpl::~AlfPtrVectorImpl() +{ + free(mdata); +} + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void AlfPtrVectorImpl::clear(bool aDelItems) + { + mcount = 0; + + if (aDelItems) + { + for (uint i = 0; i < msize; ++i) + { + void *item = mdata[i]; + if (item) + { + mDeleter.deleteItem(item); + } + } + } + free(mdata); + mdata = 0; + msize = 0; + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfPtrVectorImpl::remove(uint aCount, bool aDelItems) +{ + if (aCount >= msize) { + return false; + } + + void *item = mdata[aCount]; + + --mcount; + + //Move all the items below the deleted items up by 1 index + for(uint i =aCount; i< msize && msize > aCount;++i) + { + mdata[i]= mdata[i+1]; + } + + //Reset the items to null - from index = count to the size after the shuffling. + for(uint i=mcount;i oldSize) + { + memset(&mdata[oldSize], 0, (aSize - oldSize) * sizeof(void *)); + } + return true; +} + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfPtrVectorImpl::insert(uint aCount, void *aItem, bool /*aDelItems*/) +{ + uint iNum=0; + //If there are no items and the position to add > 0 or <0 then return false. Do not do anything + //if the Index is greater than the current count then Do not do anything + //if aCount== count There will be scope to add at the most one item + if((aCount > mcount) || (mcount==0 && aCount >iNum)||(mcount==0 && aCount < iNum)) + { + return false; + } + + + if(mcount>=msize) + { + // 1. Let's increase the count + int oldSize = msize; + msize++; + + // 2. Re-allocate memeory area + void** tmp = (void **)realloc(mdata, msize * sizeof(void *)); + if(!tmp) + { + msize--; + throw std::bad_alloc(); + } + mdata = tmp; + memset(&mdata[oldSize], 0, (msize- oldSize) * sizeof(void *)); + } + + //Now move elements from nth element to the last element by 1 position + //Move all + if(aCount < mcount) + { + for(int i =mcount;i > aCount; --i) + { + mdata[i]= mdata[i-1]; + } + } + //Now assign the new element at this position and increment the count + + mdata[aCount] = aItem; + if (aItem) + { + ++mcount; + } + + return true; +} + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT int AlfPtrVectorImpl::findRef(void *aItem) +{ + for (unsigned i = 0; i < mcount; i++) { + if (mdata[i] == aItem) { + return i; + } + } + + return -1; +} + + + +} //osncore diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/alfstring.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/alfstring.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,299 @@ +/* +* 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: Osn String Implementation. +* +*/ + +#if defined(__GNUC__) +#include +#include +#else +#include +#include +#include +#endif + +#include +#include +#include "osn/alfstring.h" +#include "stringmacros.h" +//#include "char.h" +#include "alfstringdata.h" +//#include "CHARCONV.H" +#include +#include +#define CHECK_FOR_HANDLE_LEAKS 0 + +using namespace std; +namespace osncore + { + + + + +#define IS_ASCII_QCHAR(c) ((c).unicode() > 0 && (c).unicode() <= 0xff) + + + + +EXPORT_C CAlfString::CAlfString() + :internalData(new(S60)SAlfStringData()) + { + } + + + +EXPORT_C CAlfString::~CAlfString() + { + + if(internalData.get()) + { + internalData->deref(); + if(internalData->refCount != 0) + { + internalData.release(); // don't kill it, we have ref + } + } + } + + + + +EXPORT_C CAlfString::CAlfString(const char *chs) + :internalData(new(S60)SAlfStringData()) + { + internalData->initialize(chs, strlen(chs)); + + } + + + +EXPORT_C CAlfString::CAlfString(const CAlfString &qs) + :internalData(qs.internalData.get()) + { + internalData->ref(); + } + +EXPORT_C CAlfString &CAlfString::operator=(const CAlfString &qs) + { + if (this == &qs) + return *this; + qs.internalData->ref(); // increase source ref count + internalData->deref(); + if(internalData->refCount != 0) + { + internalData.release(); + } + + internalData.reset(qs.internalData.get()); + return *this; + } + +EXPORT_C const char* CAlfString::latin1() const +{ + return internalData->ascii(); +} + + + +EXPORT_C CAlfString::CAlfString(const char *chs, int len) + : internalData(new(S60)SAlfStringData()) + { + + internalData->initialize(chs, len); + + } + +EXPORT_C int CAlfString::compare(const CAlfString& s) const +{ + //if (internalData->_isAsciiValid && s.internalData->_isAsciiValid) + return strcmp(latin1(), s.latin1()); + //return ucstrcmp(*this,s); + // return -1; +} + + +EXPORT_C CAlfString& CAlfString::append(const CAlfString &s) + { + return insert(internalData->_length, s); + } + + +EXPORT_C CAlfString &CAlfString::insert(uint index, const char *insertChars, uint insertLength) +{ + if (insertLength == 0) + return *this; + + //detach(); + + // if (internalData->_isAsciiValid){ + uint originalLength = internalData->_length; + char *targetChars; + + // Ensure that we have enough space. + if( !setLength (originalLength + insertLength) ) + { + throw std::bad_alloc(); + //return *this; + } + + targetChars = (char *)internalData->ascii(); + + // Move tail to make space for inserted characters. + memmove (targetChars+index+insertLength, targetChars+index, originalLength-index); + + // Insert characters. + memcpy (targetChars+index, insertChars, insertLength); + + internalData->_isUnicodeValid = 0; + //} + /* + else if (dataHandle[0]->_isUnicodeValid){ + uint originalLength = dataHandle[0]->_length; + QChar *targetChars; + + // Ensure that we have enough space. + if( !setLength (originalLength + insertLength) ) return *this; + targetChars = (QChar *)unicode(); + + // Move tail to make space for inserted characters. + memmove (targetChars+(index+insertLength), targetChars+index, (originalLength-index)*sizeof(QChar)); + + // Insert characters. + uint i = insertLength; + QChar *target = targetChars+index; + + while (i--) + *target++ = *insertChars++; + } + else + FATAL("invalid character cache",0); + */ + + return *this; +} + + + +EXPORT_C CAlfString& CAlfString::insert(uint index, const CAlfString &s) +{ + if (s.internalData->_length == 0) + return *this; + +#ifdef QSTRING_DEBUG_UNICODE + //forceUnicode(); +#endif + + // if (internalData->_isAsciiValid) //&& s.isAllLatin1() + // { + insert(index, s.latin1(), s.internalData->_length); + // } + /* + else + { + uint insertLength = qs.dataHandle[0]->_length; + uint originalLength = dataHandle[0]->_length; + AlfChar *targetChars; + + // Ensure that we have enough space. + if( !setLength (originalLength + insertLength) ) return *this; + targetChars = forceUnicode(); + + // Move tail to make space for inserted characters. + memmove (targetChars+(index+insertLength), targetChars+index, (originalLength-index)*sizeof(QChar)); + + // Insert characters. + if (qs.dataHandle[0]->_isAsciiValid){ + uint i = insertLength; + AlfChar *target = targetChars+index; + char *a = (char *)qs.ascii(); + + while (i--) + *target++ = *a++; + } + else { + AlfChar *insertChars = (AlfChar *)qs.unicode(); + memcpy (targetChars+index, insertChars, insertLength*sizeof(QChar)); + } + + internalData->_isAsciiValid = 0; + } + */ + + return *this; +} + + +// Increase buffer size if necessary. Newly allocated +// bytes will contain garbage. +bool CAlfString::setLength(uint newLen) +{ + + if (newLen == 0) { + //setUnicode(0, 0); + return true; + } + + // Missing optimization: Could avoid copying characters we are going to remove + // by making a special version of detach(). +// detach(); + +// ASSERT(dataHandle != shared_null_handle); + +/* +#ifdef QSTRING_DEBUG_UNICODE + forceUnicode(); +#endif +*/ + + // if (internalData->_isAsciiValid){ + if (newLen+1 > internalData->_maxAscii) { + if( internalData->increaseAsciiSize(newLen+1) == false ) return false; + } + // Ensure null termination, although newly allocated + // bytes contain garbage. + internalData->_ascii[newLen] = 0; + // } + /*else if (internalData->_isUnicodeValid){ + if (newLen > internalData->_maxUnicode) { + if( internalData->increaseUnicodeSize(newLen) == false ) return false; + } + }*/ +/* + else + FATAL("invalid character cache",0); +*/ + + internalData->_length = newLen; + return true; +} + + + +EXPORT_C bool CAlfString::operator==(const CAlfString &s1)const + { + // if (internalData->_isAsciiValid && s1.internalData->_isAsciiValid) + // { + return strcmp(latin1(), s1.latin1()) == 0; + // } + // return false; + /* + return s1.dataHandle[0]->_length == s2.dataHandle[0]->_length + && memcmp(s1.unicode(), s2.unicode(), s1.dataHandle[0]->_length * sizeof(QChar)) == 0; + */ + } + + + +} diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/alfstringdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/alfstringdata.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,226 @@ +/* +* 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: OSN string data implementation. +* +*/ + + +#include +#include + +#if defined(__GNUC__) +#include +#else +#include +#endif + +#include + +#include "alfstringdata.h" +//#include "osn/char.h" +#include + +using namespace std; + +namespace osncore + { + + + +// ------------------------------------------------------------------------- +// stringData +// ------------------------------------------------------------------------- +SAlfStringData::SAlfStringData() : refCount(1), /*_unicode(0),*/ _ascii(0), _maxAscii(QS_INTERNAL_BUFFER_CHARS), _isAsciiValid(1) +{ +//#ifdef QSTRING_DEBUG_ALLOCATIONS + // stringDataInstances++; +//#endif + refCount = 1; + _length=0; +// _unicode = 0; + _isUnicodeValid=0; + _isAsciiValid = 1; + _isHeapAllocated=0; + _ascii = _internalBuffer; + _internalBuffer[0] = 0; +} + +SAlfStringData::~SAlfStringData() +{ + // ASSERT(refCount == 0); + /* if (_unicode && !isUnicodeInternal()) + { + DELETE_QCHAR(_unicode); + } + */ + if (_ascii && !isAsciiInternal()) + { + DELETE_CHAR(_ascii); + } + +} + + +// Copy data +void SAlfStringData::initialize(const char *a, int l) +{ + refCount = 1; + _length = l; + // _unicode = 0; + _isUnicodeValid = 0; + _maxUnicode = 0; + _isAsciiValid = 1; + _isHeapAllocated = 0; + + if (l > QS_INTERNAL_BUFFER_CHARS) + { + _maxAscii = ALLOC_CHAR_GOOD_SIZE(l+1); + _ascii = ALLOC_CHAR(_maxAscii); + //Make sure we have memory before doing data copy. + if(_ascii) + { + if (a) + { + memcpy(_ascii, a, l); + } + _ascii[l] = 0; + } + else{ + _length = 0; + refCount = 0; + _length = 0; + // _unicode = 0; + _isUnicodeValid = 0; + _maxUnicode = 0; + _isAsciiValid = 1; + _isHeapAllocated = 0; + throw bad_alloc(); + } + } + else { + _maxAscii = QS_INTERNAL_BUFFER_CHARS; + _ascii = _internalBuffer; + if (a) + memcpy(_internalBuffer, a, l); + _internalBuffer[l] = 0; + } + + +} + + +bool SAlfStringData::increaseAsciiSize(uint size) +{ + //ASSERT(this != QString::shared_null); + + uint newSize = (uint)ALLOC_CHAR_GOOD_SIZE((size * 3 + 1) / 2); + + /* + if (!_isAsciiValid) + return false; + */ + // ASSERT(_isAsciiValid); + + if (isAsciiInternal()) { + char *newAscii = ALLOC_CHAR(newSize); + if( !newAscii ) return false; + + if (_length) + memcpy(newAscii, _ascii, _length); + _ascii = newAscii; + } else { + char* ap = _ascii; + _ascii = REALLOC_CHAR( _ascii, newSize ); + + if( !_ascii ) + { + // memory manager won't delete the original pointer if realloc failed + _ascii = ap; + return false; + } + } + + _maxAscii = newSize; + _isAsciiValid = 1; + _isUnicodeValid = 0; + return true; +} + + + + + +char* SAlfStringData::ascii() +{ +// return _isAsciiValid ? _ascii :0; +return _ascii; +} + + +/* +AlfChar *SAlfStringData::makeUnicode() +{ + //ASSERT(this != QString::shared_null); + + if (_isAsciiValid){ + char copyBuf[QS_INTERNAL_BUFFER_CHARS]; + // char *str; + + if (_unicode && !isUnicodeInternal()) + DELETE_QCHAR(_unicode); + + if (_length <= QS_INTERNAL_BUFFER_UCHARS){ + if (isAsciiInternal()) { + uint i = _length; + char *tp = ©Buf[0], *fp = _ascii; + while (i--) + *tp++ = *fp++; + // str = ©Buf[0]; + _isAsciiValid = 0; + } + else + { + // str = _ascii; + + } + _unicode = (AlfChar *)_internalBuffer; + _maxUnicode = QS_INTERNAL_BUFFER_UCHARS; + } + else { + uint newSize = ALLOC_QCHAR_GOOD_SIZE(_length); + _unicode = ALLOC_QCHAR(newSize); + if( !_unicode ) + { + _maxUnicode = 0; + return 0; + } + _maxUnicode = newSize; + // str = _ascii; + } + // uint i = _length; + // AlfChar *cp = _unicode; + // while ( i-- ) + // *cp++ = *str++; + + _isUnicodeValid = 1; + } + // else if (!_isUnicodeValid) + // FATAL("invalid character cache",0); + + return _unicode; +} + +*/ +} // osncore + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/alfstringpool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/alfstringpool.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2007 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: Implementation of the common string pool for widget and the factory model class. +* +*/ + +#include + + +#include "osn/alfstringpool.h" +#include "osn/alfstring.h" + + +const int KPoolAllocSize = 32; + +namespace osncore + { +class CAlfStringPoolImpl + { +public: + CAlfStringPoolImpl():iPool(0),iItemCount(0),iAllocCount(0) + { + + } + ~CAlfStringPoolImpl() + { + delete [] iPool; + } + CAlfString* iPool; + int iItemCount; + int iAllocCount; + }; + + +//----------------------------------------------------------------------- +// Only Method to access Strings from the String pool +//----------------------------------------------------------------------- +static CAlfString AppendToPool( + const CAlfString& aString, + CAlfStringPoolImpl*& aImpl) + { + bool found(false); + CAlfString ret(aString); + + //Look if this string is present then just return the corresponding RAlfString else create new one and add it to the list + for(int i=0;iiItemCount && !found;i++) + { + if( aImpl->iPool[i] == aString) //element found + { + found = true; + ret = aImpl->iPool[i]; + } + } + if(!found) + { + if(aImpl->iItemCount < aImpl->iAllocCount ) + { + aImpl->iPool[aImpl->iItemCount++] = aString; + } + else // // reserve more space for an array + { + CAlfString* tmp = (CAlfString*) realloc(aImpl->iPool, (sizeof (CAlfString) * KPoolAllocSize) ); + if(tmp) + { + aImpl->iAllocCount += KPoolAllocSize; + aImpl->iPool = tmp; + + aImpl->iPool[aImpl->iItemCount++] = aString; + } + else + { + User::LeaveIfNull(tmp); + } + } + } + return ret; + } + + + +EXPORT_C CAlfString CAlfStringPool::CreateStringL( const char* aString) + { + if(aString) + { + CAlfString tmp(aString); + return AppendToPool(tmp,iImpl); + } + return CAlfString(); + } + +EXPORT_C CAlfString CAlfStringPool::CreateStringL( const CAlfString& aString) + { + return AppendToPool(aString,iImpl); + } + +EXPORT_C CAlfStringPool::CAlfStringPool():iImpl(0) + { + iImpl = new(ELeave) CAlfStringPoolImpl; + iImpl->iPool = new(ELeave)CAlfString[KPoolAllocSize]; + iImpl->iAllocCount = KPoolAllocSize; + + } + +//----------------------------------------------------------------------- +// Default Destructor +//----------------------------------------------------------------------- +EXPORT_C CAlfStringPool::~CAlfStringPool() + { + + delete iImpl; + iImpl = NULL; + } + + + } diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/osnnew.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/osnnew.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007 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: core functionality +* +*/ + +#include +#include +#include + +// --------------------------------------------------------------------------- +// Overloaded operator new. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void* operator new(size_t s,newarg) throw (std::bad_alloc) + { + void* any = malloc(s); + if(!any) + { + throw std::bad_alloc(); + } + + return any; + } + +// --------------------------------------------------------------------------- +// Overloaded operator delete. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void operator delete(void* ptr,newarg) throw() + { + free(ptr); + } + +// --------------------------------------------------------------------------- +// Overloaded operator new[]. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void* operator new[] (size_t s,newarg)throw (std::bad_alloc) + { + void* any = malloc(s); + if(!any) + { + throw std::bad_alloc(); + } + + return any; + } + +// --------------------------------------------------------------------------- +// Overloaded operator delete[]. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void operator delete[](void* ptr,newarg) throw() + { + free(ptr); + } diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/ustring.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/ustring.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2007-2008 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: utf8 encoded byte container +* +*/ + + +#include +#include +#include "ustringimpl.h" + + +namespace osncore +{ +static const char* const KInvalidUtf8 = "InvalidUtf8"; +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT const char* UString::InvalidUtf8::what()const throw() + { + return KInvalidUtf8; + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::UString():mImpl(new(EMM)UStringImpl()) + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::UString(const Utf8* aStr) + :mImpl(new(EMM)UStringImpl(aStr)) + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::UString(const Utf8* aStr, int aLen) + :mImpl(new(EMM)UStringImpl(aStr, aLen)) + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::UString(const UString& aUString) + :mImpl(new(EMM)UStringImpl(*aUString.mImpl.get())) + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::UString(Unicode aCodePoint) + :mImpl(new(EMM)UStringImpl(aCodePoint)) + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString& UString::operator=(const UString& aRhs) + { + if (this != &aRhs) + { + UStringImpl* tmp = new (EMM)UStringImpl(*aRhs.mImpl.get()); + mImpl.reset(tmp); + } + + return *this; + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString& UString::operator=(const Utf8* aRhs) + { + if (aRhs) + { + UStringImpl* tmp = new (EMM)UStringImpl(aRhs); + mImpl.reset(tmp); + } + + return *this; + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT UString::~UString() + { + + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool UString::isEmpty()const + { + return mImpl->empty(); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT long UString::getCharLength()const + { + return mImpl->length(); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT long UString::getByteLength()const + { + return mImpl->bytes(); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT const Utf8* UString::getUtf8()const + { + return mImpl->utf8(); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT int UString::compareC(const UString& aUString)const + { + return mImpl->compareC(*aUString.mImpl.get()); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT int UString::compareC(const Utf8* aStr)const + { + return mImpl->compareC(aStr); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT int UString::compare(const UString& aUString)const + { + return mImpl->compare(*aUString.mImpl.get()); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT int UString::compare(const Utf8* aStr)const + { + return mImpl->compare(aStr); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool UString::operator==(const UString& aRhs)const + { + return !mImpl->compare(*aRhs.mImpl.get()); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool UString::operator==(const Utf8* aRhs)const + { + return !mImpl->compare(aRhs); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::append(const UString& aUString) + { + mImpl->append(*aUString.mImpl.get()); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::append(const Utf8* aStr) + { + mImpl->append(aStr); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::insert( + long aPos, + const Utf8* aStr) + { + mImpl->insert(aPos, aStr); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::insert( + long aPos, + const Utf8* aStr, + long aLength) + { + mImpl->insert(aPos, aStr,aLength); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::replace( + long aPos, + const Utf8* aStr) + { + mImpl->replace(aPos, aStr); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::replace( + long aPos, + const Utf8* aStr, + long aLength) + { + mImpl->replace(aPos, aStr, aLength); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT void UString::erase( + long aPos, + long aLength) + { + mImpl->erase(aPos, aLength); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT Unicode UString::operator[](long aIndex) + { + return mImpl->operator[](aIndex); + } + +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// +OSN_EXPORT bool UString::isNull()const + { + return mImpl->null(); + } +} diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/ustringimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/ustringimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,673 @@ +/* +* Copyright (c) 2007-2008 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: String class implementation +* +*/ + + +#include "ustringimpl.h" + +#include +#include +#if defined(__GNUC__) +#include +#else +#include +#endif +#include +using namespace std; + + +namespace osncore +{ + +const int KMaxUtf8Length = 6; + + +// ------------------------------------------------------------------------- +// Returns the byte count for aStr with aCharCount length +// ------------------------------------------------------------------------- +// +static long bytesFromCharacters(const Utf8* aStr, long aCharCount) + { + int byteCount = 0; + + if (aStr) + { + const char* srcEndOffset = g_utf8_offset_to_pointer(aStr,aCharCount); + byteCount = srcEndOffset - aStr; + } + + return byteCount; + } + +// ------------------------------------------------------------------------- +// Initializes the string from stack or heap depending on its length +// ------------------------------------------------------------------------- +// +void UStringImpl::initialize(const Utf8* aStr) + { + if (len < MAX_STR_LEN) + { + str = internalStr; + memcpy(internalStr, aStr, len); + } + else + { + str = (gchar*)calloc(len+1, sizeof (gchar)); + if(!str) + { + throw bad_alloc(); + } + memcpy(str,aStr,len); + isInHeap = true; + } + + str[len] = 0; + allocated_len = len+1; + } + +// ------------------------------------------------------------------------- +// Allocates memory from heap if needed, throws if allocation fails +// ------------------------------------------------------------------------- +// +void UStringImpl::checkBuffer(unsigned int aLength) + { + if (aLength < allocated_len) + { + return; + } + if (aLength >= MAX_STR_LEN) + { + if (!isInHeap) //str is in stack, move it to heap + { + gchar* temp = (gchar*)calloc(aLength + 1, sizeof(gchar)); + if (!temp) + { + throw bad_alloc(); + } + if(str) + { + memcpy(temp, str, len); + } + str = temp; + isInHeap = true; + } + else + { + gchar* tmp(0); + tmp = (gchar*)realloc(str,aLength+1); + if(!tmp) + { + throw bad_alloc(); + } + str = tmp; + } + } + else + { + // if ustring is constructed with null or "" set internal buffer to + // point to str + if (!str) + str = internalStr; + } + allocated_len = aLength+1; + + + // reset allocated space + memset(str+len, 0, allocated_len-len); + } +// ------------------------------------------------------------------------- +// Implements the actual insertion functionality +// ------------------------------------------------------------------------- +// +void UStringImpl::insertImpl(unsigned int aIndex, const char* aInsertChars, unsigned int aInsertLength) + { + // Ensure that we have enough space. + checkBuffer(len + aInsertLength); + // Move tail to make space for inserted characters. + memmove(str+aIndex+aInsertLength, str+aIndex, len-aIndex); + // Insert characters. + memcpy(str+aIndex, aInsertChars, aInsertLength); + // Update len + len += aInsertLength; + } +// ------------------------------------------------------------------------- +// Implements the actual append functionality +// ------------------------------------------------------------------------- +// +void UStringImpl::appendImpl(const char* aStr, unsigned int aLength) + { + insertImpl(len, aStr, aLength); + } +// ------------------------------------------------------------------------- +// Implements the actual erase functionality +// ------------------------------------------------------------------------- +// +void UStringImpl::eraseImpl(unsigned int aIndex, unsigned int aLength) + { + if(aIndex > len) + { + throw out_of_range("out_of_range"); + } + + if(aIndex+aLength >= len) + { + // erase from given index to end of the string + if(aIndex 0) + { + len = usedBytes; + initialize(&string[0]); + } + } + +// ------------------------------------------------------------------------- +// Copy constructor +// ------------------------------------------------------------------------- +// +UStringImpl::UStringImpl(const UStringImpl& aUStringImpl) + :str(0),len(aUStringImpl.len),allocated_len(0), isInHeap(0) + { +#ifdef _DEBUG + g_setenv("G_SLICE","always-malloc",1); +#endif + if(aUStringImpl.str) + { + initialize(aUStringImpl.str); + } + } + + +// ------------------------------------------------------------------------- +// Destructor +// ------------------------------------------------------------------------- +// +UStringImpl::~UStringImpl() + { + if (str && isInHeap) + { + delete str; + } + } +// ------------------------------------------------------------------------- +// Returns true if the string is empty +// ------------------------------------------------------------------------- +// +bool UStringImpl::empty()const + { + return (len > 0) ? false : true; + } + +// ------------------------------------------------------------------------- +// Returns true if the string is a null string +// ------------------------------------------------------------------------- +// +bool UStringImpl::null()const + { + return (str) ? false : true; + } + +// ------------------------------------------------------------------------- +// Returns the length of the string in characters +// ------------------------------------------------------------------------- +// +long UStringImpl::length()const + { + long ret(0); + if(str && (len > 0)) + { + ret = g_utf8_strlen(str, len); + } + return ret; + } + +// ------------------------------------------------------------------------- +// Returns the length of the string in bytes +// ------------------------------------------------------------------------- +// +long UStringImpl::bytes()const + { + return (long)len; + } + + +// ------------------------------------------------------------------------- +// Returns the utf8 type string +// ------------------------------------------------------------------------- +// +const Utf8* UStringImpl::utf8()const + { + return str; + } + +// ------------------------------------------------------------------------- +// Compares the string to another UString with strcmp +// ------------------------------------------------------------------------- +// +int UStringImpl::compare(const UStringImpl& aUStringImpl)const + { + int ret(1); + if(!str && !aUStringImpl.str) + { + ret = 0; + } + else if(str && aUStringImpl.str) + { + ret = strcmp(str, aUStringImpl.str); + } + else if(!str) + { + ret = -1; + } + + return ret; + } +// ------------------------------------------------------------------------- +// Compares the string to Utf8 string with strcmp +// ------------------------------------------------------------------------- +// +int UStringImpl::compare(const Utf8* aStr)const + { + int ret(1); + if(str && aStr) + { + ret = strcmp(str, aStr); + } + else if(!str && !strlen(aStr)) + { + ret = 0; + } + else if(!str) + { + ret = -1; + } + + return ret; + } + +// ------------------------------------------------------------------------- +// Compares the string to another UString using the linguistically +// correct rules for the current locale +// ------------------------------------------------------------------------- +// +int UStringImpl::compareC(const UStringImpl& aUStringImpl)const + { + int ret(1); + if(!str && !aUStringImpl.str) + { + ret = 0; + } + else if(str && aUStringImpl.str) + { + ret = g_utf8_collate(str, aUStringImpl.str); + } + else if(!str) + { + ret = -1; + } + + return ret; + } +// ------------------------------------------------------------------------- +// Compares the string to Utf8 string using the linguistically +// correct rules for the current locale +// ------------------------------------------------------------------------- +// +int UStringImpl::compareC(const Utf8* aStr)const + { + int ret(1); + if(str && aStr) + { + ret = g_utf8_collate(str, aStr); + } + else if(!str && !strlen(aStr)) + { + ret = 0; + } + else if(!str) + { + ret = -1; + } + + return ret; + } + +// ------------------------------------------------------------------------- +// Appends another UString to this string +// ------------------------------------------------------------------------- +// +void UStringImpl::append(const UStringImpl& aUStringImpl) + { + if(str && aUStringImpl.str) + { + appendImpl(aUStringImpl.str, aUStringImpl.len); + } + } +// ------------------------------------------------------------------------- +// Appends a Utf8 string to this string +// ------------------------------------------------------------------------- +// +void UStringImpl::append(const Utf8* aStr) + { + if(aStr && (strlen(aStr) !=0)) + { + appendImpl(aStr, strlen(aStr)); + } + } + +// ------------------------------------------------------------------------- +// Inserts Utf8 string to this string +// ------------------------------------------------------------------------- +// +void UStringImpl::insert( + long aPos, + const Utf8* aStr) + { + + if(aStr) + { + if (!str) + checkBuffer(0); + long dstCharCount = g_utf8_strlen(str, -1); + if(aPos < -1 || aPos > dstCharCount) + { + throw out_of_range("out_of_range"); + } + // find out byte position for given character position + long startBytePos(-1); + if(aPos >= 0) + { + if(str) + { + const char* startOffset = g_utf8_offset_to_pointer(str, aPos); + startBytePos = startOffset - str; + } + } + if(aPos == -1) + { + appendImpl(aStr, strlen(aStr)); + } + else + { + insertImpl(startBytePos, aStr, strlen(aStr)); + } + } + } + +// ------------------------------------------------------------------------- +// Inserts Utf8 string to this string with length of the Utf8 specified +// ------------------------------------------------------------------------- +// +void UStringImpl::insert( + long aPos, + const Utf8* aStr, + long aCharCount) + { + if (aCharCount < 1) + { + throw out_of_range("out_of_range"); + } + + if (aStr) + { + long srcByteLen = bytesFromCharacters(aStr, aCharCount); + if(!str) + checkBuffer(0); + + // calculate how many bytes are needed for given characters + long srcCharCount = g_utf8_strlen(aStr, srcByteLen); + long dstCharCount = g_utf8_strlen(str, -1); + long startBytePos(-1); // appends end of the string + + if(aPos < -1 || aPos > dstCharCount-1 || aCharCount > srcCharCount) + { + throw out_of_range("out_of_range"); + } + + if(aPos != -1) + { + const char* startOffset = g_utf8_offset_to_pointer(str, aPos); + startBytePos = startOffset - str; + } + const char* endOffset = g_utf8_offset_to_pointer(aStr, aCharCount); + long insertByteLength = endOffset - aStr; + + if(aPos == -1) + { + appendImpl(aStr, insertByteLength); + } + else + { + insertImpl(startBytePos, aStr, srcByteLen); + } + } + } + +// ------------------------------------------------------------------------- +// Replaces Utf8 string to this string +// ------------------------------------------------------------------------- +// +void UStringImpl::replace( + long aPos, + const Utf8* aStr) + { + if (aStr) + { + if (!str) + checkBuffer(0); + + long srcByteLen = strlen(aStr); + long srcCharCount = g_utf8_strlen(aStr,-1); + long dstCharCount = g_utf8_strlen(str, -1); + if(aPos > dstCharCount || aPos < 0) + { + throw out_of_range("out_of_range"); + } + + // calculate start byte position + if(str) + { + const char* startOffset = g_utf8_offset_to_pointer(str, aPos); + long startBytePos = startOffset - str; + + // calculate erasable character count in bytes + if(startOffset) + { + const char* endOffset = g_utf8_offset_to_pointer(startOffset, srcCharCount); + long eraseByteLength = endOffset - startOffset; + // erase existing characters + eraseImpl(startBytePos, eraseByteLength); + } + insertImpl(startBytePos, aStr, srcByteLen); + } + } + } + + +// ------------------------------------------------------------------------- +// Replaces a Utf8 string to this string with length of the Utf8 specified +// ------------------------------------------------------------------------- +// +void UStringImpl::replace( + long aPosOffset, + const Utf8* aStr, + long aCharCount) + { + if (aCharCount < 1) + { + throw out_of_range("out_of_range"); + } + + if (aStr) + { + long srcByteLen = bytesFromCharacters(aStr, aCharCount); + if(!str) + checkBuffer(0); + + long srcCharCount = g_utf8_strlen(aStr, srcByteLen); + long dstCharCount = g_utf8_strlen(str, -1); + if(aPosOffset > dstCharCount || aPosOffset < 0 || aCharCount > srcCharCount) + { + throw out_of_range("out_of_range"); + } + // calculate start byte position + if(str) + { + const char* startOffset = g_utf8_offset_to_pointer(str, aPosOffset); + long startBytePos = startOffset - str; + + // calculate erasable character count in bytes + if(startOffset) + { + const char* endOffset = g_utf8_offset_to_pointer(startOffset, srcCharCount); + long eraseByteLength = endOffset - startOffset; + // erase existing characters + eraseImpl(startBytePos, eraseByteLength); + } + insertImpl(startBytePos, aStr, srcByteLen); + } + } + } + +// ------------------------------------------------------------------------- +// Erases aCharCount characters from the string at position specified by +// aPosOffset +// ------------------------------------------------------------------------- +// +void UStringImpl::erase( + long aPosOffset, + long aCharCount) + { + + if(str) + { + long srcCharCount = g_utf8_strlen(str, -1); + + if (aPosOffset < 0 || aCharCount < 1 || aCharCount > srcCharCount) + { + throw out_of_range("out_of_range"); + } + + // calc startpos + const char* startOffset = g_utf8_offset_to_pointer(str, aPosOffset); + long startBytePos = startOffset - str; + + // calc bytes to erase + const char* endOffset = g_utf8_offset_to_pointer(startOffset, aCharCount); + long eraseByteLength = endOffset - startOffset; + + eraseImpl(startBytePos, eraseByteLength); + } + } + +// ------------------------------------------------------------------------- +// Returns unicode at aIndex position in the string +// ------------------------------------------------------------------------- +// +Unicode UStringImpl::operator[](long aIndex) + { + Unicode ret(0xF8FF); + + if(str) + { + long charCount = g_utf8_strlen(str, -1); + if(aIndex < 0 || aIndex > charCount-1) + { + throw out_of_range("out_of_range"); + } + // calc startpos + const char* uniChar = g_utf8_offset_to_pointer(str, aIndex); + + ret = g_utf8_get_char(uniChar); + } + return ret; + } + +} + + diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/osncore/src/ustringutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/osncore/src/ustringutil.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007 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: utility for ustring +* +*/ + + +#include +#include + +#include +#include +#include +#include + +namespace osncore +{ + +const int KBase = 10; + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +template +OSN_EXPORT UtfProxy::~UtfProxy() + { + if(iUtf) + { + free(iUtf); + } + } + +// --------------------------------------------------------------------------- +// Conversion to Utf16 from Utf8 using g_utf8_to_utf16 +// --------------------------------------------------------------------------- +// +OSN_EXPORT auto_ptr toUtf16(const UString& aSourceUtf8) + { + Utf16* ret = g_utf8_to_utf16(aSourceUtf8.getUtf8(),-1,0,0,0); + + auto_ptr tmp; + try + { + tmp.reset(new (EMM)Utf16Proxy(ret)); + } + catch(std::bad_alloc& e) + { + free(ret); + } + return tmp; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT int toInt(const UString& aSource) + { + int ret(0); + const Utf8* string = aSource.getUtf8(); + if (!string) + { + throw UString::InvalidUtf8(); + } + + ret = strtol(string, (char **)NULL, KBase); + if( errno == EINVAL || errno == ERANGE) + { + errno = 0; + throw UString::InvalidUtf8(); + } + return ret; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +static auto_ptr normalize(const UString& aSource, GNormalizeMode aMode) + { + const Utf8* string = aSource.getUtf8(); + if (!string) + { + throw UString::InvalidUtf8(); + } + + Utf8* ret = g_utf8_normalize(string, -1, aMode); + + if(!ret) + { + throw UString::InvalidUtf8(); + } + auto_ptr tmp; + try + { + tmp.reset(new (EMM)UString(ret)); + // g_free(ret); + free(ret); + } + catch(std::bad_alloc& e) + { + // g_free(ret); + free(ret); + } + return tmp; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT auto_ptr normalizeNFD(const UString& aSource) + { + return normalize(aSource,G_NORMALIZE_DEFAULT); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT auto_ptr normalizeNFC(const UString& aSource) + { + return normalize(aSource,G_NORMALIZE_DEFAULT_COMPOSE); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT auto_ptr normalizeNFKD(const UString& aSource) + { + return normalize(aSource,G_NORMALIZE_ALL); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT auto_ptr normalizeNFKC(const UString& aSource) + { + return normalize(aSource,G_NORMALIZE_ALL_COMPOSE); + } + +} diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/sis/createsisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/sis/createsisx.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: osncore iby file. +rem + + +@echo off +echo DoTo: update the location for certificate and private key files + +set certificate_file=..\internal\certificates\rd.cer +set private_key_file=..\internal\certificates\rd-key.pem + +makesis osncore.pkg +signsis osncore.sis osncore.sisx %certificate_file% %private_key_file% diff -r 4ea6f81c838a -r 0e9bb658ef58 osncore/sis/osncore.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/osncore/sis/osncore.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,44 @@ +; +; 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: pkg file for osncore. +; + +; ============================================================================ +; Name : osncore.pkg +; Part of : Decalrative UI +; Description : Package file +; Version : %version: 2 % << Don't touch! Updated by Synergy at check-out. +; +; Copyright © 2007 Nokia. All rights reserved. +; This material, including documentation and any related computer +; programs, is protected by copyright controlled by Nokia. All +; rights are reserved. Copying, including reproducing, storing, +; adapting or translating, any or all of this material requires the +; prior written consent of Nokia. This material also contains +; confidential information which may not be disclosed to others +; without the prior written consent of Nokia. +; ============================================================================ +; Template version: 4.1 + +; standard SIS file header +#{"Os neutral library"},(0x1020725D),1,0,0 + +;Localized Vendor Name +%{"Nokia-EN"} + +;Unique Vendor name +:"Nokia" + +;Files to copy +"\epoc32\release\armv5\urel\osncore.dll"-"!:\sys\bin\osncore.dll" \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/bwins/alfresourcepoolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/bwins/alfresourcepoolu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,13 @@ +EXPORTS + ?createFileImageResource@ResourcePool@Alf@@QAEXPBDABVUString@osncore@@W4TAlfTextureFlags@@@Z @ 1 NONAME ; void Alf::ResourcePool::createFileImageResource(char const *, class osncore::UString const &, enum TAlfTextureFlags) + ??1ResourcePool@Alf@@QAE@XZ @ 2 NONAME ; Alf::ResourcePool::~ResourcePool(void) + ?getImageResource@ResourcePool@Alf@@QAE?AVTAlfImage@@PBDABUTAlfXYMetric@@@Z @ 3 NONAME ; class TAlfImage Alf::ResourcePool::getImageResource(char const *, struct TAlfXYMetric const &) + ?getImageResource@ResourcePool@Alf@@QAE?AVTAlfImage@@PBD@Z @ 4 NONAME ; class TAlfImage Alf::ResourcePool::getImageResource(char const *) + ?setInitialSize@ResourcePool@Alf@@QAEXPBDABUTAlfXYMetric@@@Z @ 5 NONAME ; void Alf::ResourcePool::setInitialSize(char const *, struct TAlfXYMetric const &) + ?setAspectRatio@ResourcePool@Alf@@QAEXPBDW4AspectRatio@12@@Z @ 6 NONAME ; void Alf::ResourcePool::setAspectRatio(char const *, enum Alf::ResourcePool::AspectRatio) + ?createThemeImageResource@ResourcePool@Alf@@QAEXPBDABVUString@osncore@@@Z @ 7 NONAME ; void Alf::ResourcePool::createThemeImageResource(char const *, class osncore::UString const &) + ??0ResourcePool@Alf@@QAE@AAVCAlfTextureManager@@PAV01@@Z @ 8 NONAME ; Alf::ResourcePool::ResourcePool(class CAlfTextureManager &, class Alf::ResourcePool *) + ?deleteImageResource@ResourcePool@Alf@@QAEXPBD@Z @ 9 NONAME ; void Alf::ResourcePool::deleteImageResource(char const *) + ?hasImageResource@ResourcePool@Alf@@QBE_NPBD@Z @ 10 NONAME ; bool Alf::ResourcePool::hasImageResource(char const *) const + ?createLogicalImageResource@ResourcePool@Alf@@QAEXPBD@Z @ 11 NONAME ; void Alf::ResourcePool::createLogicalImageResource(char const *) + diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/eabi/alfresourcepoolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/eabi/alfresourcepoolu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,17 @@ +EXPORTS + _ZN3Alf12ResourcePool14setAspectRatioEPKcNS0_11AspectRatioE @ 1 NONAME + _ZN3Alf12ResourcePool14setInitialSizeEPKcRK12TAlfXYMetric @ 2 NONAME + _ZN3Alf12ResourcePool16getImageResourceEPKc @ 3 NONAME + _ZN3Alf12ResourcePool16getImageResourceEPKcRK12TAlfXYMetric @ 4 NONAME + _ZN3Alf12ResourcePool19deleteImageResourceEPKc @ 5 NONAME + _ZN3Alf12ResourcePool23createFileImageResourceEPKcRKN7osncore7UStringE16TAlfTextureFlags @ 6 NONAME + _ZN3Alf12ResourcePool24createThemeImageResourceEPKcRKN7osncore7UStringE @ 7 NONAME + _ZN3Alf12ResourcePool26createLogicalImageResourceEPKc @ 8 NONAME + _ZN3Alf12ResourcePoolC1ER18CAlfTextureManagerPS0_ @ 9 NONAME + _ZN3Alf12ResourcePoolC2ER18CAlfTextureManagerPS0_ @ 10 NONAME + _ZN3Alf12ResourcePoolD1Ev @ 11 NONAME + _ZN3Alf12ResourcePoolD2Ev @ 12 NONAME + _ZNK3Alf12ResourcePool16hasImageResourceEPKc @ 13 NONAME + _ZTIN3Alf16ResourcePoolImpl13ImageResourceE @ 14 NONAME ; ## + _ZTVN3Alf16ResourcePoolImpl13ImageResourceE @ 15 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/group/alfresourcepool.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/group/alfresourcepool.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008 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: Project definition file for project alfresourcepool +* +*/ + + +#include +#include + +TARGET alfresourcepool.dll +TARGETTYPE dll +UID 0x1000008d 0x200110F7 + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + + +SOURCEPATH ../src +SOURCE alfresourcepool.cpp +SOURCE alfresourcepoolimpl.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +#include +MW_LAYER_SYSTEMINCLUDE + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE +LIBRARY libstdcpp.lib +LIBRARY euser.lib +LIBRARY alfclient.lib +LIBRARY osncore.lib +LIBRARY charconv.lib + +LIBRARY libc.lib +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + +LIBRARY libpthread.lib diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008 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: Build information file for project resource pool dll +* +*/ + + +#ifdef __S60_50__ +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include +#endif + + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_EXPORTS +#ifdef __S60_50__ +../../rom/alfresourcepool.iby CORE_MW_LAYER_IBY_EXPORT_PATH(alfresourcepool.iby) +#endif + +PRJ_MMPFILES +alfresourcepool.mmp \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/inc/alfresourcepoolimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/inc/alfresourcepoolimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2008 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: Implementation of the resource pool +* +*/ + + +#ifndef ALF_RESOURCEPOOL_IMPL_H +#define ALF_RESOURCEPOOL_IMPL_H + +#include +#include +#include +#include +#include +#include + +#include "alf/alfresourcepool.h" + +class CAlfTextureManager; + + + +namespace Alf +{ +//Forward declaration + + +using namespace osncore; + +/** + * ?one_line_short_description + * ?more_complete_description + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ?library + * @since S60 ?S60_version *** for example, S60 v3.0 + */ +class ResourcePoolImpl + { +private: + + enum ImageResourceType + { + imageResourceTypeSkin, + imageResourceTypeFileSVG, + imageResourceTypeFileOther + }; + + struct ResourceInstanceData + { + ResourceInstanceData(): mTextureId(0), mImageLoaderUtil(0), mAutoSizeTexture(false) {} + ~ResourceInstanceData() { delete mImageLoaderUtil; } + + int mTextureId; + CAlfAutoSizeImageLoaderUtil* mImageLoaderUtil; + bool mAutoSizeTexture; + }; + + struct ImageResource + { + ImageResource(); + virtual ~ImageResource(); + + Utf8* mTag; + ImageResourceType mType; + AlfPtrVector mLoadedTextures; + TAlfXYMetric mInitialSizeHint; + ResourcePool::AspectRatio mAspectRatio; + int mReferenceCount; + TAlfTextureFlags mFlag; + }; + + struct SkinImageResource : public ImageResource + { + int mSkinIdMajor; + int mSkinIdMinor; + UString mFallBackFileName; + int mFallBackIndex; + int mFallBackMaskIndex; + }; + + struct FileImageResource : public ImageResource + { + UString mFileName; + }; +public: + + ResourcePoolImpl( + CAlfTextureManager& aTextureManager , + ResourcePool* aParentPool ); + ~ResourcePoolImpl(); + + void createLogicalImageResource( const Utf8* aTag ); + + void createThemeImageResource( + const Utf8* aTag, + const UString& aThemeDefinition ); + + void createFileImageResource( + const Utf8* aTag, + const UString& aFileName ,TAlfTextureFlags aFlag); + + void deleteImageResource( const Utf8* aTag ); + + bool hasImageResource( const Utf8* aTag ) const; + + void setInitialSize( + const Utf8* aTag, + const TAlfXYMetric& aInitialSizeHint ); + + void setAspectRatio( + const Utf8* aTag, + ResourcePool::AspectRatio aAspectRatio ); + + TAlfImage getImageResource( const Utf8* aTag ); + + TAlfImage getImageResource( + const Utf8* aTag, + const TAlfXYMetric& aSizeHint ); + +private: + ImageResource* findResource( const Utf8* aTag ) const; + int findResourceIndex( const Utf8* aTag ) const; + void DetermineSkinInstanceL( const Utf8* aTag, TAknsItemID& aSkinItemID ) const; + TSize determineSizeInPixels( const TAlfXYMetric& aSize ); + void determineSkinId( const UString& aNumberString, int& aSkinItem ); + TAlfImage CreateSkinImageResourceL(SkinImageResource& aSkinImageResource, const TAlfXYMetric& aSizeHint); + TAlfImage CreateFileImageResourceL(FileImageResource& aFileImageResource, const TAlfXYMetric& aSizeHint ,TAlfTextureFlags aFlag); + TAlfImage CreateSVGImageResourceL(FileImageResource& aSVGImageResource, const TAlfXYMetric& aSizeHint); + + static bool areSizesCloseEnough( const TSize& aSize1, const TSize& aSize2 ); +private: + + CAlfTextureManager& mTextureManager; + ResourcePool* mParentPool; + + AlfPtrVector mResources; // use hash table instead? + }; + +} // namespace Alf + +#endif // ALF_RESOURCEPOOL_IMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/sis/alfresourcepool.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/sis/alfresourcepool.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,29 @@ +; +; 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: alfresourcepool iby file. +; + +#{"Alf resource pool"},(0x200110F7),1,0,0 + +;Supports Series 60 v 3.0 +(0x101F7961), 0, 0, 0, {"Series60ProductID"} + +;Localized Vendor Name +%{"Nokia-EN"} + +;Unique Vendor name +:"Nokia" + +;Files to copy +"\epoc32\release\armv5\urel\alfresourcepool.dll"-"!:\sys\bin\alfresourcepool.dll" diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/sis/createsisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/sis/createsisx.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: resource pool sisx bat. +rem + + +@echo off +echo DoTo: update the location for certificate and private key files + +set certificate_file=..\..\hitchcock\internal\certificates\rd.cer +set private_key_file=..\..\hitchcock\internal\certificates\rd-key.pem + +makesis alfresourcepool.pkg +signsis alfresourcepool.sis alfresourcepool.sisx %certificate_file% %private_key_file% diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/src/alfresourcepool.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/src/alfresourcepool.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2008 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: API for handling alf graphic resources +* +*/ + + +#include "alf/alfresourcepool.h" +#include "alfresourcepoolimpl.h" + +#include + +namespace Alf +{ + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +OSN_EXPORT ResourcePool::ResourcePool( + CAlfTextureManager& aTextureManager, + ResourcePool* aParentPool ) + : mResourcePoolImpl( + new (EMM) ResourcePoolImpl( aTextureManager, aParentPool ) ) + { + } + + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +OSN_EXPORT ResourcePool::~ResourcePool() + { + } + + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::createLogicalImageResource( const Utf8* aTag ) + { + mResourcePoolImpl->createLogicalImageResource( aTag ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::createThemeImageResource( + const Utf8* aTag, + const UString& aThemeDefinition ) + { + mResourcePoolImpl->createThemeImageResource( + aTag, + aThemeDefinition ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::createFileImageResource( + const Utf8* aTag, + const UString& aFileName , + TAlfTextureFlags aFlag) + { + mResourcePoolImpl->createFileImageResource( aTag, aFileName, aFlag); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::deleteImageResource( const Utf8* aTag ) + { + mResourcePoolImpl->deleteImageResource( aTag ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool ResourcePool::hasImageResource( const Utf8* aTag ) const + { + return mResourcePoolImpl->hasImageResource( aTag ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::setInitialSize( + const Utf8* aTag, + const TAlfXYMetric& aInitialSizeHint ) + { + mResourcePoolImpl->setInitialSize( aTag, aInitialSizeHint); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void ResourcePool::setAspectRatio( + const Utf8* aTag, + AspectRatio aAspectRatio ) + { + mResourcePoolImpl->setAspectRatio( aTag, aAspectRatio); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfImage ResourcePool::getImageResource( + const Utf8* aTag ) + { + return mResourcePoolImpl->getImageResource( aTag ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfImage ResourcePool::getImageResource( + const Utf8* aTag, + const TAlfXYMetric& aSizeHint ) + { + return mResourcePoolImpl->getImageResource( aTag, aSizeHint ); + } + + +} // namespace Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 resourcepool/src/alfresourcepoolimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resourcepool/src/alfresourcepoolimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,788 @@ +/* +* Copyright (c) 2008 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: Implementation of the resource pool +* +*/ + + +// From this component +#include "alfresourcepoolimpl.h" + +// From the same subsystem +#include +#include +#include +#include +#include + +// Outside the same subsystem +#include +#include + +// standard C++/STL +#include +#include +#include + +namespace Alf +{ + +#define KResourcePoolHexadecimalPrefix "0x" + +const unsigned int INITIAL_IMAGE_WIDTH = 0; // no magic +const unsigned int INITIAL_IMAGE_HEIGHT = 0; // no magic + +const TAlfTextureFlags IMAGE_RESOURCE_DEFAULT_TEXTURE_FLAGS = TAlfTextureFlags(EAlfTextureFlagAutoSize); +const TAlfTextureFlags IMAGE_RESOURCE_SKINNED_TEXTURE_FLAGS = TAlfTextureFlags(EAlfTextureFlagAutoSize | EAlfTextureFlagSkinContent); + +// Function is Not used. +/********************************** +Utf8* alloc8BitBuffer( const Utf8* aSource ) + { + int length( 0 ); + while ( aSource && aSource[length] != '\0' ) + { + length++; + } + length++; // for the NULL characher + + Utf8* result = new (EMM) Utf8[ length ]; + + for ( int c = 0; c < ( length - 1 ); c++ ) + { + result[c] = aSource[c]; + } + + result[length - 1] = '\0'; // add the NULL character at the end + return result; + } +********************************************/ + +Utf8* allocLowerCase( const Utf8* aTag ) + { + const unsigned int length = aTag ? strlen(aTag) : 0; + Utf8* result = new (EMM) Utf8[ length+1 ]; + for ( int s = 0 ; s < length ; s++ ) + { + result[s] = tolower( aTag[s]); + } + result[length] = '\0'; // add the NULL character at the end + return result; + } + +TInt RoundFloatToInt(TReal32 aVal) + { + return (aVal < 0 ? (TInt)(aVal - 0.5f) : (TInt)(aVal + 0.5f)); + } + +// ======== MEMBER FUNCTIONS ======== + +ResourcePoolImpl::ImageResource::ImageResource() +: mTag(0), mAspectRatio( ResourcePool::aspectRatioPreserved ), mReferenceCount(1) + { + mInitialSizeHint.iX.iMagnitude = INITIAL_IMAGE_WIDTH; + mInitialSizeHint.iX.iUnit = EAlfUnitPixel; + mInitialSizeHint.iY.iMagnitude = INITIAL_IMAGE_HEIGHT; + mInitialSizeHint.iY.iUnit = EAlfUnitPixel; + } + +ResourcePoolImpl::ImageResource::~ImageResource() + { + delete mTag; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +ResourcePoolImpl::ResourcePoolImpl( + CAlfTextureManager& aTextureManager, + ResourcePool* aParentPool ) + : mTextureManager( aTextureManager ), + mParentPool( aParentPool ) + { + //This may throw an exception leading to object creation failure. + + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +ResourcePoolImpl::~ResourcePoolImpl() + { + + + // delete the texture instances + for ( int resourceIndex = 0 ; resourceIndex < mResources.count() ; resourceIndex++ ) + { + ImageResource* resource = mResources[resourceIndex]; + for ( int textureIndex = 0 ; textureIndex < resource->mLoadedTextures.count() ; textureIndex++ ) + { + const CAlfTexture* texture = mTextureManager.Texture( resource->mLoadedTextures[textureIndex]->mTextureId); + if ( texture->Id() == resource->mLoadedTextures[textureIndex]->mTextureId ) + { + // make sure we do not delete blank texure + delete texture; + + if (resource->mLoadedTextures[textureIndex]->mAutoSizeTexture) + { + mTextureManager.RemoveAutoSizeObserver(resource->mLoadedTextures[textureIndex]->mImageLoaderUtil); + } + } + } + } + // items in mResources will be automatically deleted in the destructor of + // the AlfPtrVector + } + + +void ResourcePoolImpl::createLogicalImageResource( const Utf8* aTag ) + { + } + +void ResourcePoolImpl::createThemeImageResource( + const Utf8* aTag, + const UString& aThemeDefinition ) + { + + + } + +void ResourcePoolImpl::createFileImageResource( + const Utf8* aTag, + const UString& aFileName , TAlfTextureFlags aFlag) + { + if ( !aTag ) + { + throw invalid_argument("NULL ptr"); + } + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + + ImageResource* existingResource = findResource( lowerCaseTag.get() ); + if ( existingResource ) + { + existingResource->mReferenceCount++; + return; + } + + // : check that the file exists. + + auto_ptr newFileResource( new (EMM) FileImageResource ); + newFileResource->mTag = lowerCaseTag.get(); + lowerCaseTag.release(); + newFileResource->mType = imageResourceTypeFileOther; + newFileResource->mFileName = aFileName; + newFileResource->mFlag = aFlag; + // check the .svg prefix + const long length = aFileName.getCharLength(); + if ( length > 4 ) + { + auto_ptr lowerCaseTag( allocLowerCase( aFileName.getUtf8() ) ); + if ( lowerCaseTag.get()[length-4] == '.' && + lowerCaseTag.get()[length-3] == 's' && + lowerCaseTag.get()[length-2] == 'v' && + lowerCaseTag.get()[length-1] == 'g' ) + { + newFileResource->mType = imageResourceTypeFileSVG; + } + } + + mResources.resize(mResources.count()+1); + mResources.insert(mResources.count(),newFileResource.get()); + newFileResource.release(); + } + + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void ResourcePoolImpl::deleteImageResource( const Utf8* aTag ) + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + + ImageResource* existingResource = findResource( lowerCaseTag.get() ); + if ( !existingResource ) + { + return; + } + + existingResource->mReferenceCount--; + if ( existingResource->mReferenceCount > 0 ) + { + // not time to delete yet. + return; + } + + const int resouceIndex = findResourceIndex( lowerCaseTag.get() ); + + // delete CAlfTexture instances created by this resource + if ( resouceIndex != -1 ) + { + ImageResource* resource = mResources[resouceIndex]; + for ( int textureIndex = 0 ; textureIndex < resource->mLoadedTextures.count() ; textureIndex++ ) + { + const CAlfTexture* texture = mTextureManager.Texture( resource->mLoadedTextures[textureIndex]->mTextureId); + if ( texture->Id() == resource->mLoadedTextures[textureIndex]->mTextureId ) + { + // make sure we do not delete blank texure + delete texture; + + if (resource->mLoadedTextures[textureIndex]->mAutoSizeTexture) + { + mTextureManager.RemoveAutoSizeObserver(resource->mLoadedTextures[textureIndex]->mImageLoaderUtil); + } + } + } + + mResources.remove( resouceIndex ); + } + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +bool ResourcePoolImpl::hasImageResource( const Utf8* aTag ) const + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + int resouceIndex = findResourceIndex( lowerCaseTag.get() ); + if ( resouceIndex != -1 ) + { + return true; + } + + return false; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void ResourcePoolImpl::setInitialSize( + const Utf8* aTag, + const TAlfXYMetric& aInitialSizeHint ) + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + ImageResource* imageResource = findResource( lowerCaseTag.get() ); + if ( imageResource ) + { + imageResource->mInitialSizeHint = aInitialSizeHint; + } + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void ResourcePoolImpl::setAspectRatio( + const Utf8* aTag, + ResourcePool::AspectRatio aAspectRatio ) + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + ImageResource* imageResource = findResource( lowerCaseTag.get() ); + if ( imageResource ) + { + imageResource->mAspectRatio = aAspectRatio; + } + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TAlfImage ResourcePoolImpl::getImageResource( const Utf8* aTag ) + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + ImageResource* imageResource = findResource( lowerCaseTag.get() ); + if ( imageResource ) + { + return getImageResource( + lowerCaseTag.get() , + imageResource->mInitialSizeHint ); + } + return TAlfImage(); // return empty + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TAlfImage ResourcePoolImpl::getImageResource( + const Utf8* aTag, + const TAlfXYMetric& aSizeHint ) + { + auto_ptr lowerCaseTag( allocLowerCase( aTag ) ); + + ImageResource* imageResource = findResource( lowerCaseTag.get() ); + if ( imageResource ) + { + // check if the texture ID with the given size hint is already generated + if ( imageResource->mLoadedTextures.count() ) + { + const TSize requestedSize( determineSizeInPixels(aSizeHint) ); + const CAlfTexture* texture = NULL; + for ( TInt idIndex = 0 ; idIndex < imageResource->mLoadedTextures.count() ; idIndex++ ) + { + texture = mTextureManager.Texture(imageResource->mLoadedTextures[idIndex]->mTextureId); + if ( texture->Id() != imageResource->mLoadedTextures[idIndex]->mTextureId ) + { + // if the texture manager returns blank, return empty. + return TAlfImage(); // return empty + } + TSize textureSize( const_cast(texture)->MaxTextureSize() ); + if ( textureSize.iWidth == 0 || textureSize.iHeight == 0 ) + { + // texture loaded directly with the size, use that. + textureSize = texture->Size(); + } + + const bool autosize = imageResource->mLoadedTextures[idIndex]->mAutoSizeTexture; + if ( requestedSize == TSize(0,0) && autosize ) + { + // if zero size is requested, we think autosizing image is requested + // and if we find one autosizing texture we return it. + return TAlfImage( *texture ); + } + else if ( areSizesCloseEnough( requestedSize, textureSize ) && !autosize ) + { + // we found existing texure -> use that + return TAlfImage( *texture ); + } + } + } + + // If we have not found a suitable resource, create one. + TAlfImage result; + TRAPD( sError , + { + + // Create new one. + switch( imageResource->mType ) + { + case imageResourceTypeSkin: + result = CreateSkinImageResourceL( + static_cast( *imageResource ), aSizeHint ); + break; + + case imageResourceTypeFileOther: + result = CreateFileImageResourceL( + static_cast( *imageResource ), aSizeHint , imageResource->mFlag ); + break; + + case imageResourceTypeFileSVG: + result = CreateSVGImageResourceL( + static_cast( *imageResource ), aSizeHint ); + break; + + default: + break; + } + }); // TRAP + + if ( sError != KErrNone ) + { + throw invalid_argument("cannot create image resource"); + } + return result; + } + else + { + // this pool does not contain the resource, check the parent pool + if ( mParentPool ) + { + return mParentPool->getImageResource( lowerCaseTag.get(), aSizeHint ); + } + } + + return TAlfImage(); // return empty + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +ResourcePoolImpl::ImageResource* ResourcePoolImpl::findResource( const Utf8* aTag ) const + { + const int index = findResourceIndex( aTag ); + if ( index != -1 ) + { + return mResources.at(index); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +int ResourcePoolImpl::findResourceIndex( const Utf8* aTag ) const + { + for ( int i = 0 ; i < mResources.count() ; i++ ) + { + // : find a better way to compare + int c = 0; + while ( mResources.at(i)->mTag[c] != '\0' ) + { + if ( mResources.at(i)->mTag[c] != aTag[c] ) + { + break; + } + c++; + } + + if ( mResources.at(i)->mTag[c] == '\0' && aTag[c] == '\0' ) + { + return i; + } + } + return -1; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void ResourcePoolImpl::DetermineSkinInstanceL( + const Utf8* aTag, TAknsItemID& aSkinItemID ) const + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TSize ResourcePoolImpl::determineSizeInPixels( const TAlfXYMetric& aSize ) + { + TSize result(0,0); + TRect displayRect(0,0,0,0); + + // check X + if ( aSize.iX.iUnit == EAlfUnitPixel ) + { + result.iWidth = aSize.iX.iMagnitude; + } + else if ( aSize.iX.iUnit == EAlfUnitDisplaySize ) + { + // check the primary display + if ( mTextureManager.Env().DisplayCount() ) + { + const CAlfDisplay& display = mTextureManager.Env().PrimaryDisplay(); + displayRect = display.VisibleArea(); + result.iWidth = RoundFloatToInt( TReal32(displayRect.Width())*aSize.iX.iUnit ); + } + } + + // check Y + if ( aSize.iY.iUnit == EAlfUnitPixel ) + { + result.iHeight = aSize.iY.iMagnitude; + } + else if ( aSize.iY.iUnit == EAlfUnitDisplaySize ) + { + // check the primary display (if not checked already + if ( !displayRect.Height() && mTextureManager.Env().DisplayCount() ) + { + const CAlfDisplay& display = mTextureManager.Env().PrimaryDisplay(); + displayRect = display.VisibleArea(); + } + result.iHeight = RoundFloatToInt( TReal32(displayRect.Height())*aSize.iY.iUnit ); + } + + return result; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void ResourcePoolImpl::determineSkinId( const UString& aNumberString, int& aSkinItem ) + { + aSkinItem = -1; + + const unsigned int charLength = aNumberString.getCharLength(); + if ( charLength ) + { + // there is something + // check if we are dealing with hexadecimal entry + const string strNumber = aNumberString.getUtf8(); + if ( charLength > 3 && strNumber.substr(0,2).compare( KResourcePoolHexadecimalPrefix ) == 0 ) + { + // hexa it is + aSkinItem = strtol( aNumberString.getUtf8(), NULL, 16 ); + } + else + { + // try normal decimal number + aSkinItem = atoi( aNumberString.getUtf8() ); + // if the 'atoi' returns 0, make sure it is that + if ( aSkinItem == 0 ) + { + if ( aNumberString.getUtf8()[0] != '0' ) + { + aSkinItem = -1; + } + } + } + } + } + + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TAlfImage ResourcePoolImpl::CreateSkinImageResourceL( + SkinImageResource& aSkinImageResource, + const TAlfXYMetric& aSizeHint) + { + CAlfAutoSizeImageLoaderUtil* imageLoaderUtil = new (ELeave) CAlfAutoSizeImageLoaderUtil; + CleanupStack::PushL( imageLoaderUtil ); + CAlfTexture* texture = NULL; + MAlfBitmapProvider* bitmapProvider = NULL; + + TAknsItemID skinId; + skinId.Set( aSkinImageResource.mSkinIdMajor, aSkinImageResource.mSkinIdMinor ); + + TSize size( determineSizeInPixels(aSizeHint) ); + imageLoaderUtil->SetSize( size, static_cast(aSkinImageResource.mAspectRatio)); + + TInt textureFlags = IMAGE_RESOURCE_SKINNED_TEXTURE_FLAGS; + if (size != TSize(0,0)) + { + // If sizehint was provided, turn autosize off at least for now. + textureFlags &= ~EAlfTextureFlagAutoSize; + } + + if ( aSkinImageResource.mFallBackFileName.getCharLength() ) + { + HBufC* sUnicodeBuffer = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( + TPtrC8((TUint8*)aSkinImageResource.mFallBackFileName.getUtf8())); + CleanupStack::PushL( sUnicodeBuffer ); + bitmapProvider = + imageLoaderUtil->CreateImageLoaderL( + skinId, + *sUnicodeBuffer, + aSkinImageResource.mFallBackIndex, + aSkinImageResource.mFallBackMaskIndex ); + CleanupStack::PopAndDestroy( sUnicodeBuffer ); + } + else + { + bitmapProvider = + imageLoaderUtil->CreateImageLoaderL( + skinId, + KNullDesC(), + -1, + -1 ); + } + + texture = &mTextureManager.CreateTextureL( KAlfAutoGeneratedTextureId, bitmapProvider, TAlfTextureFlags(textureFlags)); + CleanupStack::PushL( texture ); + + // Enable ref counting + texture->EnableRefCounting(); + + // store texture ID and create image + ResourceInstanceData* newResourceInstance = new (ELeave) ResourceInstanceData; + newResourceInstance->mTextureId = texture->Id(); + newResourceInstance->mImageLoaderUtil = imageLoaderUtil; + newResourceInstance->mAutoSizeTexture = (textureFlags & EAlfTextureFlagAutoSize); + + try + { + aSkinImageResource.mLoadedTextures.resize(aSkinImageResource.mLoadedTextures.count()+1); + aSkinImageResource.mLoadedTextures.insert(aSkinImageResource.mLoadedTextures.count(),newResourceInstance); + } + catch ( ... ) + { + delete newResourceInstance; + User::Leave( KErrNoMemory ); + } + CleanupStack::Pop( texture ); + CleanupStack::Pop( imageLoaderUtil ); // mLoadedTextures has taken the ownership + + if (textureFlags & EAlfTextureFlagAutoSize) + { + mTextureManager.AddAutoSizeObserverL(imageLoaderUtil); + } + + return TAlfImage( *texture ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TAlfImage ResourcePoolImpl::CreateFileImageResourceL( + FileImageResource& aFileImageResource, + const TAlfXYMetric& aSizeHint , TAlfTextureFlags aFlag) + { + CAlfTexture* texture = NULL; + + HBufC* sUnicodeBuffer = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( + TPtrC8((TUint8*)aFileImageResource.mFileName.getUtf8())); + CleanupStack::PushL( sUnicodeBuffer ); + TSize size(determineSizeInPixels( aSizeHint ) ); + + TInt textureFlags = IMAGE_RESOURCE_DEFAULT_TEXTURE_FLAGS; + textureFlags |= aFlag; + if (size != TSize(0,0)) + { + // If sizehint was provided, turn autosize off at least for now. + textureFlags &= ~EAlfTextureFlagAutoSize; + } + + if ( size.iWidth && size.iHeight ) + { + texture = &mTextureManager.LoadTextureL( + *sUnicodeBuffer, + size, + TAlfTextureFlags(textureFlags), + KAlfAutoGeneratedTextureId ); + } + else + { + texture = &mTextureManager.LoadTextureL( + *sUnicodeBuffer, + TAlfTextureFlags(textureFlags), + KAlfAutoGeneratedTextureId ); + } + CleanupStack::PopAndDestroy( sUnicodeBuffer ); + CleanupStack::PushL( texture ); + + // Enable ref counting + texture->EnableRefCounting(); + + // store texture ID and create image + ResourceInstanceData* newResourceInstance = new (ELeave) ResourceInstanceData; + newResourceInstance->mTextureId = texture->Id(); + newResourceInstance->mAutoSizeTexture = (textureFlags & EAlfTextureFlagAutoSize); + + try + { + aFileImageResource.mLoadedTextures.resize(aFileImageResource.mLoadedTextures.count()+1); + aFileImageResource.mLoadedTextures.insert(aFileImageResource.mLoadedTextures.count(),newResourceInstance); + } + catch ( ... ) + { + delete newResourceInstance; + User::Leave( KErrNoMemory ); + } + + CleanupStack::Pop( texture ); + return TAlfImage( *texture ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +TAlfImage ResourcePoolImpl::CreateSVGImageResourceL( + FileImageResource& aSVGImageResource, + const TAlfXYMetric& aSizeHint) + { + CAlfAutoSizeImageLoaderUtil* imageLoaderUtil = new (ELeave) CAlfAutoSizeImageLoaderUtil; + CleanupStack::PushL( imageLoaderUtil ); + MAlfBitmapProvider* bitmapProvider = NULL; + CAlfTexture* texture = NULL; + + TSize size( determineSizeInPixels(aSizeHint) ); + imageLoaderUtil->SetSize( size, static_cast(aSVGImageResource.mAspectRatio) ); + + TInt textureFlags = IMAGE_RESOURCE_SKINNED_TEXTURE_FLAGS; + if (size != TSize(0,0)) + { + // If sizehint was provided, turn autosize off at least for now. + textureFlags &= ~EAlfTextureFlagAutoSize; + } + + HBufC* sUnicodeBuffer = + CnvUtfConverter::ConvertToUnicodeFromUtf8L( + TPtrC8((TUint8*)aSVGImageResource.mFileName.getUtf8())); + CleanupStack::PushL( sUnicodeBuffer ); + bitmapProvider = imageLoaderUtil->CreateSVGImageLoaderL( *sUnicodeBuffer ); + CleanupStack::PopAndDestroy( sUnicodeBuffer ); + + texture = &mTextureManager.CreateTextureL( KAlfAutoGeneratedTextureId, bitmapProvider, TAlfTextureFlags(textureFlags)); + CleanupStack::PushL( texture ); + + // Enable ref counting + texture->EnableRefCounting(); + + // store texture ID and create image + ResourceInstanceData* newResourceInstance = new (ELeave) ResourceInstanceData; + newResourceInstance->mTextureId = texture->Id(); + newResourceInstance->mImageLoaderUtil = imageLoaderUtil; + newResourceInstance->mAutoSizeTexture = (textureFlags & EAlfTextureFlagAutoSize); + + try + { + aSVGImageResource.mLoadedTextures.resize(aSVGImageResource.mLoadedTextures.count()+1); + aSVGImageResource.mLoadedTextures.insert(aSVGImageResource.mLoadedTextures.count(),newResourceInstance); + } + catch ( ... ) + { + delete newResourceInstance; + User::Leave( KErrNoMemory ); + } + CleanupStack::Pop( texture ); + CleanupStack::Pop( imageLoaderUtil ); // mLoadedTextures has taken the ownership + + if (textureFlags & EAlfTextureFlagAutoSize) + { + mTextureManager.AddAutoSizeObserverL(imageLoaderUtil); + } + + return TAlfImage( *texture ); + } + +bool ResourcePoolImpl::areSizesCloseEnough( const TSize& aSize1, const TSize& aSize2 ) + { + // this is the inteligent part:) + // the function tries to determine do we need to rasterize a new texture or use the existing one. + + // check if the other one is zero size + if ( !aSize1.iWidth || !aSize1.iHeight || !aSize2.iWidth || !aSize2.iHeight ) + { + return false; + } + + // check if both are smaller than 10px + if ( aSize1.iWidth < 10 && aSize1.iHeight < 10 && aSize2.iWidth < 10 && aSize2.iHeight < 10 ) + { + return true; + } + + // check if both dimensions fit in 10% range. + bool result = false; + // check width + if ( aSize1.iWidth <= aSize2.iWidth*1.1f && aSize1.iWidth >= aSize2.iWidth*0.9f ) + { + // width in the range, chech height + if ( aSize1.iHeight <= aSize2.iHeight*1.1f && aSize1.iHeight >= aSize2.iHeight*0.9f ) + { + // height in the range + result = true; + } + } + + return result; + } + +} // namespace Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/aakash.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/aakash.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007-2008 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: Multimedia UI Library iby file. +* +*/ + + +#ifndef __AAKASH_IBY__ +#define __AAKASH_IBY__ + +#include "gesturehelper.iby" +#include "muldatamodel.iby" +// #include "mulsingleitemmodel.iby" +#include "mulutility.iby" +//#include "mulgridwidget.iby" +//#include "mullistwidget.iby" +#include "mulcoverflowwidget.iby" +//#include "mulsoftkeywidget.iby" +#include "mulsliderwidget.iby" +//#include "multoolbarwidget.iby" +//#include "mulmetapanewidget.iby" + + +#endif // __AAKASH_IBY__ +// End of file \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alfcollect.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alfcollect.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,36 @@ +/* +* 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: Grouped IBY file. +* +*/ +#ifndef __ALFCOLLECT_IBY__ +#define __ALFCOLLECT_IBY__ + +#include + + +//#include + +#include "alfresourcepool.iby" +//#include +// #include +#include "osncore.iby" +// #include +// #include +#include "widgetmodel.iby" +// #include +// Effects are not included into rom by default +//#include + +#endif // __ALFCOLLECT_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alfeditors.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alfeditors.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: AlfEditors iby file +* +*/ +#ifndef __ALFEDITORS_IBY__ +#define __ALFEDITORS_IBY__ + +#include + +#ifdef FF_ROM_INCLUDE_ALF +#ifndef __SERIES60_30__ +file=ABI_DIR\BUILD_DIR\alfwidgeteditors.dll SHARED_LIB_DIR\alfwidgeteditors.dll +file=ABI_DIR\BUILD_DIR\alfwidgeteditortools.dll SHARED_LIB_DIR\alfwidgeteditortools.dll +#endif // #ifndef __SERIES60_30__ + +#endif // #ifdef FF_ROM_INCLUDE_ALF + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alfred.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alfred.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,59 @@ +/* +* 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: Alf iby file. +* +*/ +#ifndef __ALFRED_IBY__ +#define __ALFRED_IBY__ + +#include + +REM ALFRED + +// TEMP +// New IBY file exporting improvements in 5.0 says that no need to include other IBY files +#ifndef __S60_50__ +#include +#endif + +#ifdef FF_ROM_INCLUDE_ALF + +// HUIToolkit +file=ABI_DIR\BUILD_DIR\hitchcock.dll SHARED_LIB_DIR\hitchcock.dll + +#ifndef __SERIES60_30__ +// client +file=ABI_DIR\BUILD_DIR\alfclient.dll SHARED_LIB_DIR\alfclient.dll + +// App Server exe +file=ABI_DIR\BUILD_DIR\alfredserver.exe PROGRAMS_DIR\alfredserver.exe +data=DATAZ_\APP_RESOURCE_DIR\alfredserver.RSC APP_RESOURCE_DIR\alfredserver.rsc +data=ZSYSTEM\..\PRIVATE\10003A3F\APPS\alfredserver_REG.RSC Private\10003a3f\apps\alfredserver_reg.rsc + +// Server core +file=ABI_DIR\BUILD_DIR\alfappservercore.dll SHARED_LIB_DIR\alfappservercore.dll + +// File token server +file=ABI_DIR\BUILD_DIR\ftokenclient.dll SHARED_LIB_DIR\ftokenclient.dll +file=ABI_DIR\BUILD_DIR\!ftokenserver.exe PROGRAMS_DIR\!ftokenserver.exe + + +// Stub sis file +data=ABI_DIR\BUILD_DIR\uiaccelerator_stub.sis system\install\uiaccelerator_stub.sis + +#endif // #ifndef __SERIES60_30__ + +#endif // #ifdef FF_ROM_INCLUDE_ALF + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alfresourcepool.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alfresourcepool.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ +/* +* 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: Alf Resourse Pool iby file. +* +*/ +#ifndef __ALFRESOURCEPOOL_IBY__ +#define __ALFRESOURCEPOOL_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\alfresourcepool.dll SHARED_LIB_DIR\alfresourcepool.dll + +#endif // __ALFRESOURCEPOOL_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alftranseffectplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alftranseffectplugin.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,23 @@ +/* +* 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: Transeffectplugin iby file. +* +*/ + +#ifndef ALFTRANSEFFECTPLUGIN_IBY +#define ALFTRANSEFFECTPLUGIN_IBY + +ECOM_PLUGIN(AlfTransEffectPlugin.dll, AlfTransEffectPlugin.rsc) + +#endif // ALFTRANSEFFECTPLUGIN_IBY \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/alfwidgets.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/alfwidgets.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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: alfwidgets iby file. +* +*/ +#ifndef __ALFWIDGETS_IBY__ +#define __ALFWIDGETS_IBY__ + +#include + + +ECOM_PLUGIN( alfcontainerwidget.dll , alfcontainerwidget.rsc ) +ECOM_PLUGIN( alfscrollbarwidget.dll , alfscrollbarwidget.rsc ) +ECOM_PLUGIN( alfviewwidget.dll , alfviewwidget.rsc ) + +#endif // __ALFWIDGETS_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/declarativeui.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/declarativeui.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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: DUI iby file. +* +*/ +#ifndef __DECLARATIVEUI_IBY__ +#define __DECLARATIVEUI_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\duiengine.dll SHARED_LIB_DIR\duiengine.dll +file=ABI_DIR\BUILD_DIR\duiinterpreter.dll SHARED_LIB_DIR\duiinterpreter.dll + +#endif // __DECLARATIVEUI_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/lctmanager.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/lctmanager.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ +/* +* 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: LCT Manager iby file. +* +*/ +#ifndef __LCTMANAGER_IBY__ +#define __LCTMANAGER_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\lctmanager.dll SHARED_LIB_DIR\lctmanager.dll + +#endif // __LCTMANAGER_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/osncore.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/osncore.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,24 @@ +/* +* 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: OSN core iby file. +* +*/ +#ifndef __OSNCORE_IBY__ +#define __OSNCORE_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\osncore.dll SHARED_LIB_DIR\osncore.dll + +#endif // __OSNCORE_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/thememanagement.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/thememanagement.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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: Thememanagement iby file. +* +*/ +#ifndef __THEMEMANAGEMENT_IBY__ +#define __THEMEMANAGEMENT_IBY__ + +#include + + +file=ABI_DIR\BUILD_DIR\ThemeManager.dll SHARED_LIB_DIR\ThemeManager.dll +file=ABI_DIR\BUILD_DIR\skindata.dll SHARED_LIB_DIR\skindata.dll + + +#endif // __THEMEMANAGEMENT_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/uimodel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/uimodel.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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: uimodel iby file. +* +*/ +#ifndef __UIMODEL_IBY__ +#define __UIMODEL_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\duinode.dll SHARED_LIB_DIR\duinode.dll +file=ABI_DIR\BUILD_DIR\duinodeiterator.dll SHARED_LIB_DIR\duinodeiterator.dll + +#endif // __UIMODEL_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 rom/widgetmodel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/widgetmodel.iby Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,28 @@ +/* +* 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: widgetmodel iby file. +* +*/ +#ifndef __WIDGETMODEL_IBY__ +#define __WIDGETMODEL_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\alfwidgetmodel.dll SHARED_LIB_DIR\alfwidgetmodel.dll +file=ABI_DIR\BUILD_DIR\alfwidgetutils.dll SHARED_LIB_DIR\alfwidgetutils.dll + +// ECOM_PLUGIN( alflctlayoutmanagers.dll , alflctlayoutmanagers.rsc ) +ECOM_PLUGIN( alfwidgetfactory.dll , alfwidgetfactory.rsc ) + +#endif // __WIDGETMODEL_IBY__ diff -r 4ea6f81c838a -r 0e9bb658ef58 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 systemDefinition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemDefinition.xml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,33 @@ + + + + + + + + +]> + + + + &layer_file; + + + &targetDefinition_file; + + + + &defaultbuild_file; + + + + + &defaultclean_file; + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 systemDefinitionLayer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemDefinitionLayer.xml Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,589 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/group/alfwidgetfactory.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/group/alfwidgetfactory.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2006 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: Project definition file for project alfclient +* +*/ + +#include + + +TARGET alfwidgetfactory.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10282329 + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE alfwidgetfactoryplugin.cpp +SOURCE alfwidgetfactory.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +MW_LAYER_SYSTEMINCLUDE + +OS_LAYER_LIBC_SYSTEMINCLUDE + +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY libc.lib + +LIBRARY alfclient.lib +LIBRARY alfwidgetutils.lib +LIBRARY osncore.lib +LIBRARY libstdcpp.lib +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + +LIBRARY libpthread.lib + +LANG SC +START RESOURCE 10282329.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET alfwidgetfactory.rsc +#endif +END + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 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: Build information file +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +alfwidgetfactory.mmp + +PRJ_TESTMMPFILES + + + +PRJ_TESTEXPORTS diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/inc/alfwidgetfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/inc/alfwidgetfactory.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2007-2007 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: Widget factory interface implementation +* +*/ + + +#ifndef ALFWIDGETFACTORY_H +#define ALFWIDGETFACTORY_H + +//OSN core includes +#include + +//Widget Utils Includes +#include +#include + +//Widget Factory Includes +#include + +//Forward declarations +class CAlfEnv; +class CAlfDisplay; + +//Namespaces +namespace duiuimodel +{ +class DuiNode; +} + +using namespace duiuimodel; +using namespace osncore; + +namespace Alf + { +//Forward declarations +class IAlfWidgetControl; + + +/** + * @class AlfWidgetFactory alfwidgetfactory.h "alf/alfwidgetfactory.h" + * + * Widget factory implementation. + * + * @lib alfwidgetfactory.lib + * @since S60 ?S60_version + * @status Draft + * @interfaces IAlfWidgetFactory. + */ +class AlfWidgetFactory: public IAlfWidgetFactory + { +public: + /** + * Destructor. + */ + ~AlfWidgetFactory(); + + /** + * Explicit Parametrized Constructor + */ + explicit AlfWidgetFactory(CAlfEnv& aEnv); + +public: + + // From IAlfWidgetFactory + + /** + * @see IAlfWidgetFactory. + */ + IAlfViewWidget* createViewWidget( + const char* aInstanceId, + int aControlGroupID, + DuiNode* aNode=0, + CAlfDisplay* aDisplay=0, + const char* aFilePath=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfWidget* createWidget( + const char* aLoadId, + const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode=0, + const char* aFilePath=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + int destroyWidget(IAlfWidget* aWidget); + + /** + * @see IAlfWidgetFactory. + */ + IAlfWidget* findWidget(const char* aWidgetName) const; + + + /** + * @see IAlfWidgetFactory. + */ + int appendWidget(IAlfWidget* aWidget); + + + /** + * @see IAlfWidgetFactory. + */ + IAlfModel* createModel( + const char* aLoadId, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfWidgetControl* createControl( + const char* aLoadId, + const char* aInstanceId, + CAlfDisplay* aDisplay=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfElement* createElement( + const char* aLoadId, + const char* aInstanceId, + IAlfWidgetControl& aControl, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfVisualTemplate* createVisualTemplate( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfWidgetEventHandler* createEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + IAlfLayoutManager* createLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode=0, + AlfCustomInitDataBase* aCustomData=0); + + /** + * @see IAlfWidgetFactory. + */ + void registerCustomWidgetFactory(IAlfFactoryPlugin* aFactory); + +public: // From IAlfInterfaceBase + + /** + * @see IAlfInterfaceBase. + */ + IAlfInterfaceBase* makeInterface(const IfId& aType); + +private: + /** + * Not owned. + */ + CAlfEnv& mAlfEnv; + /** + * Not owned. + */ + AlfPtrVector mRegisteredFactoryList; + + /** + * Owned. + */ + AlfFactoryPluginLoader mFactoryPluginLoader; + + /** + * List of the widgets added to the factory + * + * Owned + */ + AlfPtrVector mWidgetList; + }; + + + } // namespace Alf +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/inc/alfwidgetfactoryplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/inc/alfwidgetfactoryplugin.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2007 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: Widget factory interface +* +*/ + + +#ifndef ALFWIDGETFACTORYPLUGIN_H +#define ALFWIDGETFACTORYPLUGIN_H + +#include +#include +#include + +namespace Alf + { +class AlfWidgetFactory; + + +/** + * @class AlfWidgetFactoryPlugin AlfWidgetFactoryPlugin.h "alf/alfwidgetfactoryplugin.h" + * + * Plugin factory to create widget factory + * + * + * @lib alfwidgetfactory.dll + * @since S60 ?S60_version + * @status Draft + */ +class AlfWidgetFactoryPlugin: public IAlfFactoryPlugin + { +public: + + /** + * Static Creator Method + * @since S60 5.0 + * @return Interface pointer to factory plugin instance. + */ + static IAlfFactoryPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~AlfWidgetFactoryPlugin(); + +public: // from MAlfPluginFactory + IAlfInterfaceBase* createProduct(const char* aProduct,void* aInitData); + int productCount()const; + const char* productInfo(int aIndex)const; +public: + // from IAlfInterfaceBase + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); +private: + }; + } // namespace + +// Exported factory function required by ECOM-framework +OSN_IMPORT const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount); + +#endif + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/src/10282329.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/src/10282329.rss Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,41 @@ +/* +* 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: File defines ecom related data for factory plugin. +* +*/ + +#include + +RESOURCE REGISTRY_INFO theInfo +{ +dll_uid = 0x10282329; +interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x11201113; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10201256; + version_no = 1; + display_name = ""; + default_data = "alfwidgetfactory"; + opaque_data = ""; + } + }; + } + }; +} diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/src/alfwidgetfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/src/alfwidgetfactory.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1114 @@ +/* +* Copyright (c) 2007-2007 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: Widget factory implementation file +* +*/ + + +//STL includes +#include + +//ALF Client includes +#include +#include + +//OSN core includes +#include +#include + +//Widget Utils includes +#include + +//Widget factory includes +#include + +//Widget Model includes +#include +#include +#include +#include +#include "alf/ialfvisualtemplate.h" +#include +#include + +//View Widget includes +#include + +//Local Includes +#include "alfwidgetfactory.h" + +using namespace osncore; + +namespace Alf + { + +static const char* const KViewWidgetProductId = "viewwidget"; + + +static IAlfViewWidget* createDefaultViewWidget( + const char* aInstanceId, + int aControlGroupID, + DuiNode* aNode, + CAlfDisplay& aDisplay, + CAlfEnv& aEnv, + IAlfFactoryPlugin& aFactoryPlugin, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfViewWidget* ret = 0; + + // Create construction parameter structure. + AlfViewWidgetInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfViewWidgetInitData)); + + // Set the construction parameters. + init.mEnv = &aEnv; + init.mDisplay = &aDisplay; + init.mWidgetId = aInstanceId; + init.mControlGroupId = aControlGroupID; + init.mNode = aNode; + init.mFilePath = aFilePath; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct( + KViewWidgetProductId, &init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfWidget* createDefaultWidget( + const char* aLoadId, + const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode, + CAlfEnv& aEnv, + IAlfFactoryPlugin& aFactoryPlugin, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidget* ret = 0; + + // Create construction parameter structure. + AlfWidgetInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetInitData)); + + // Set the construction parameters. + init.mEnv = &aEnv; + init.mContainerWidget = &aContainerWidget; + init.mWidgetId = const_cast(aInstanceId); + init.mNode = aNode; + init.mFilePath = aFilePath; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfModel* createDefaultModel( + const char* aLoadId, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfModel* ret = 0; + + // Create construction parameter structure. + AlfModelInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfModelInitData)); + + // Set the construction parameters. + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfWidgetControl* createDefaultControl( + const char* aLoadId, + CAlfDisplay& aDisplay, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidgetControl* ret(0); + + // Create construction parameter structure. + AlfWidgetControlInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetControlInitData)); + + // Set the construction parameters. + init.mDisplay = &aDisplay; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfElement* createDefaultElement( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + IAlfWidgetControl& aControl, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfElement* ret(0); + + // Create construction parameter structure. + AlfElementInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfElementInitData)); + + // Set the construction parameters. + init.mControl= &aControl; + init.mElementId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfVisualTemplate* createDefaultVisualTemplate( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfVisualTemplate* ret(0); + + // Create construction parameter structure. + AlfVisualTemplateInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfVisualTemplateInitData)); + + // Set the construction parameters. + init.mVisualTemplateId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfWidgetEventHandler* createDefaultEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidgetEventHandler* ret(0); + + // Create construction parameter structure. + AlfWidgetEventHandlerInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetEventHandlerInitData)); + + // Set the construction parameters. + init.mWidgetEventHandlerId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfLayoutManager* createDefaultLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + IAlfFactoryPlugin& aFactoryPlugin, + AlfCustomInitDataBase* aCustomData) + { + IAlfLayoutManager* ret(0); + + // Create construction parameter structure. + AlfLayoutManagerInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfLayoutManagerInitData)); + + // Set the construction parameters. + init.mLayoutManagerId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Create a temporary factory product and typecast it to the correct + // interface. + IAlfInterfaceBase* tmp = aFactoryPlugin.createProduct(aLoadId, &init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + } + } + + return ret; + } + +static IAlfViewWidget* createRegisteredViewWidget( + const char* aInstanceId, + int aControlGroupID, + DuiNode* aNode, + CAlfEnv& aEnv, + CAlfDisplay& aDisplay, + AlfPtrVector& aFactoryList, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfViewWidget* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfViewWidgetInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfViewWidgetInitData)); + + // Set the construction parameters. + init.mEnv = &aEnv; + init.mDisplay = &aDisplay; + init.mWidgetId = aInstanceId; + init.mControlGroupId = aControlGroupID; + init.mNode = aNode; + init.mFilePath = aFilePath; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(KViewWidgetProductId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfWidget* createRegisteredWidget( + const char* aLoadId, + const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode, + CAlfEnv& aEnv, + AlfPtrVector& aFactoryList, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidget* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfWidgetInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetInitData)); + + // Set the construction parameters. + init.mEnv = &aEnv; + init.mContainerWidget = &aContainerWidget; + init.mWidgetId = const_cast(aInstanceId); + init.mNode = aNode; + init.mFilePath= aFilePath; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfModel* createRegisteredModel( + const char* aLoadId, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfModel* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfModelInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfModelInitData)); + + // Set the construction parameters. + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfWidgetControl* createRegisteredControl( + const char* aLoadId, + CAlfDisplay& aDisplay, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidgetControl* ret(0); + IAlfInterfaceBase* tmp(0); + + + // Create construction parameter structure. + AlfWidgetControlInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetControlInitData)); + + // Set the construction parameters. + init.mDisplay = &aDisplay; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfElement* createRegisteredElement( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + IAlfWidgetControl& aControl, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfElement* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfElementInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfElementInitData)); + + // Set the construction parameters. + init.mControl= &aControl; + init.mElementId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfVisualTemplate* createRegisteredVisualTemplate( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfVisualTemplate* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfVisualTemplateInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfVisualTemplateInitData)); + + // Set the construction parameters. + init.mVisualTemplateId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfWidgetEventHandler* createRegisteredEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidgetEventHandler* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfWidgetEventHandlerInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfWidgetEventHandlerInitData)); + + // Set the construction parameters. + init.mWidgetEventHandlerId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface( + tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + +static IAlfLayoutManager* createRegisteredLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfPtrVector& aFactoryList, + AlfCustomInitDataBase* aCustomData) + { + IAlfLayoutManager* ret(0); + IAlfInterfaceBase* tmp(0); + + // Create construction parameter structure. + AlfLayoutManagerInitData init; + + // Zero out the data in the construction structure. + memset(&init, 0, sizeof(AlfLayoutManagerInitData)); + + // Set the construction parameters. + init.mLayoutManagerId = const_cast(aInstanceId); + init.mNode= aNode; + init.mCustomData = aCustomData; + + // Run through registered factories. + for(int i=0;icreateProduct(aLoadId,&init); + if(tmp) + { + // Object created. Attempt to typecast to correct interface. + ret = IAlfInterfaceBase::makeInterface(tmp); + if(!ret) + { + // Interface not found. Delete the temporary product. + delete tmp; + tmp=0; + } + } + } + + return ret; + } + + +AlfWidgetFactory::AlfWidgetFactory(CAlfEnv& aAlfEnv): + mAlfEnv(aAlfEnv) + { + mWidgetList.setAutoDelete(true); + } + +AlfWidgetFactory::~AlfWidgetFactory() + { + mWidgetList.clear(); + mRegisteredFactoryList.clear(); + } + +IAlfViewWidget* AlfWidgetFactory::createViewWidget( + const char* aInstanceId, + int aControlGroupID, + DuiNode* aNode, + CAlfDisplay* aDisplay, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfViewWidget* ret(0); + auto_ptr autoptr = auto_ptr(0); + + IAlfFactoryPlugin* factoryPlugin = mFactoryPluginLoader.loadFactoryPlugin( + KViewWidgetProductId); + + CAlfDisplay* display = aDisplay; + + //Check there is already a widget with the same instance ID. + if(findWidget(aInstanceId)) + { + ALF_THROW(AlfWidgetException,EInvalidWidgetInstanceId, + "Instance ID same as an existing widget.") + } + + //Both node and presentation declaration file handle cannot have + //non-null value at the same time. + if(aNode && aFilePath) + { + ALF_THROW(AlfWidgetException,EInvalidArgument, + "Both node & presentation declaration file handle cannot have non-null values at the same time") + } + + if(!display) + { + if(mAlfEnv.DisplayCount() == 0) + { + // No display objects defined in the environment. + // Throw an exception. + ALF_THROW(AlfException, EDisplayNotFound, + "No display found from environment.Unable to associate a display with the view widget."); + } + display = &mAlfEnv.PrimaryDisplay(); + } + + // Try default factory first + if(factoryPlugin) + { + autoptr.reset(createDefaultViewWidget( + aInstanceId,aControlGroupID,aNode,*display, + mAlfEnv,*factoryPlugin,aFilePath,aCustomData)); + } + + // Then try registered factories + if(!autoptr.get()) + { + autoptr.reset(createRegisteredViewWidget( + aInstanceId,aControlGroupID,aNode, + mAlfEnv,*display,mRegisteredFactoryList, + aFilePath,aCustomData)); + } + + if(autoptr.get() != 0) + { + // If trap occurs throw exception. Created widget will be automatically + // destroyed since it is in auto pointer. + TRAPD(err, appendWidget( + IAlfInterfaceBase::makeInterface(autoptr.get()))); + if(err != KErrNone) + { + ALF_THROW(AlfException, err, + "Appending created widget to environment failed."); + } + + // After succesfull call to AppendWidgetL we can release the autoptr. + ret = autoptr.release(); + } + + return ret; + } + +IAlfWidget* AlfWidgetFactory::createWidget( + const char* aLoadId, + const char* aInstanceId, + IAlfContainerWidget& aContainerWidget, + DuiNode* aNode, + const char* aFilePath, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidget* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + //Check there is already a widget with the same instance ID. + if(findWidget(aInstanceId)) + { + ALF_THROW(AlfWidgetException,EInvalidWidgetInstanceId, + "Instance ID same as an existing widget.") + } + + //Both node and presentation declaration file handle cannot have + //non-null value at the same time. + if(aNode && aFilePath) + { + ALF_THROW(AlfWidgetException,EInvalidArgument, + "Both node & presentation declaration file handle cannot have non-null values at the same time") + } + + // Try first default factory + if(pluginFactory) + { + ret = createDefaultWidget( + aLoadId,aInstanceId,aContainerWidget,aNode, + mAlfEnv,*pluginFactory,aFilePath,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredWidget( + aLoadId,aInstanceId,aContainerWidget,aNode,mAlfEnv, + mRegisteredFactoryList,aFilePath,aCustomData); + } + + if(ret) + { + TRAPD(err, appendWidget(ret)); + if(err != KErrNone) + { + delete ret; + ALF_THROW(AlfException, err, + "Appending created widget to environment failed."); + } + } + + return ret; + } + +int AlfWidgetFactory::destroyWidget(IAlfWidget* aWidget) + { + int ret = -1; + int widgetCount = mWidgetList.count(); + for ( int i = 0; i < widgetCount; ++i ) + { + if ( mWidgetList[i] == aWidget ) + { + // remove and destroy the widget + mWidgetList.remove( i ); + ret = 0; + break; ; + } + } + return ret; + } + +int AlfWidgetFactory::appendWidget(IAlfWidget* aWidget) + { + int ret = 0; + int widgetCount = mWidgetList.count(); + for ( int i = 0; i < widgetCount; ++i ) + { + if ( mWidgetList[i] == aWidget ) + { + ret = -1; + break; ; + } + } + if(ret != -1 ) + { + mWidgetList.resize( mWidgetList.count()+1); + mWidgetList.insert( mWidgetList.count(), aWidget ); + } + return ret; + } + +IAlfWidget* AlfWidgetFactory::findWidget(const char* aWidgetName) const + { + IAlfWidget* ret(NULL); + int widgetCount = mWidgetList.count(); + for(int i=0; iwidgetName(); + if(!strcmp(widgetName,aWidgetName)) + { + ret = mWidgetList[i]; + } + } + return ret; + } + +IAlfModel* AlfWidgetFactory::createModel( + const char* aLoadId, + AlfCustomInitDataBase* aCustomData) + { + IAlfModel* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + // Try first default factory + if(pluginFactory) + { + ret = createDefaultModel(aLoadId,*pluginFactory, aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredModel( + aLoadId,mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +IAlfWidgetControl* AlfWidgetFactory::createControl( + const char* aLoadId, + const char* aInstanceId, + CAlfDisplay* aDisplay, + AlfCustomInitDataBase* aCustomData) + { + IAlfWidgetControl* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + //Compiler warning removal. Left here for future use cases. + (void)aInstanceId; + + CAlfDisplay* display = aDisplay; + + if(!display) + { + display = &mAlfEnv.PrimaryDisplay(); + } + + // Try first default factory + if(pluginFactory) + { + ret = createDefaultControl(aLoadId,*display,*pluginFactory,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredControl( + aLoadId,*display,mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +IAlfElement* AlfWidgetFactory::createElement( + const char* aLoadId, + const char* aInstanceId, + IAlfWidgetControl& aControl, + DuiNode* aNode, + AlfCustomInitDataBase* aCustomData) + { + IAlfElement* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + // Try first default factory + if (pluginFactory) + { + ret = createDefaultElement( + aLoadId,aInstanceId,aNode,aControl, + *pluginFactory,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredElement( + aLoadId,aInstanceId,aNode,aControl, + mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +IAlfVisualTemplate* AlfWidgetFactory::createVisualTemplate( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfCustomInitDataBase* aCustomData ) + { + + IAlfVisualTemplate* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + // Try first default factory + if (pluginFactory) + { + ret = createDefaultVisualTemplate( + aLoadId,aInstanceId,aNode,*pluginFactory,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredVisualTemplate( + aLoadId,aInstanceId,aNode, + mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +IAlfWidgetEventHandler* AlfWidgetFactory::createEventHandler( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfCustomInitDataBase* aCustomData ) + { + IAlfWidgetEventHandler* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + // Try first default factory + if (pluginFactory) + { + ret = createDefaultEventHandler( + aLoadId,aInstanceId,aNode,*pluginFactory,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredEventHandler( + aLoadId,aInstanceId,aNode, + mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +IAlfLayoutManager* AlfWidgetFactory::createLayoutManager( + const char* aLoadId, + const char* aInstanceId, + DuiNode* aNode, + AlfCustomInitDataBase* aCustomData) + { + IAlfLayoutManager* ret(0); + IAlfFactoryPlugin* pluginFactory = mFactoryPluginLoader.loadFactoryPlugin( + aLoadId); + + // Try first default factory + if (pluginFactory) + { + ret = createDefaultLayoutManager( + aLoadId,aInstanceId,aNode,*pluginFactory,aCustomData); + } + + // Then try registered factories + if(!ret) + { + ret = createRegisteredLayoutManager( + aLoadId,aInstanceId,aNode, + mRegisteredFactoryList,aCustomData); + } + + return ret; + } + +void AlfWidgetFactory::registerCustomWidgetFactory( + IAlfFactoryPlugin* aFactory) + { + mRegisteredFactoryList.resize(mRegisteredFactoryList.count()+1); + mRegisteredFactoryList.insert(mRegisteredFactoryList.count(),aFactory); + } + +IAlfInterfaceBase* AlfWidgetFactory::makeInterface(const IfId& aType) + { + if ( !strcmp(aType.mImplementationId, + IAlfWidgetFactory::type().mImplementationId) ) + { + return static_cast(this); + } + + return 0; + } + } // namespace Alf + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetfactory/src/alfwidgetfactoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetfactory/src/alfwidgetfactoryplugin.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,120 @@ +/* +* 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: File imeplemets the widgetfactory for interfaces. +* +*/ + + +//Symbian includes +#include + +//Alfred client includes +#include + +//OSN core includes +#include +#include +#include + +//Widget utils includes +#include + +//Local includes +#include "alfwidgetfactoryplugin.h" +#include "alfwidgetfactory.h" + +//Namespaces +using namespace Alf; +using namespace osncore; + + +namespace Alf + { + +const TInt KWidgetFactoryPluginUid = {0x10201256}; +const int KProductCount = 1; +static const char* const KAlfWidgetFactory = "alfwidgetfactory"; + + +IAlfFactoryPlugin* AlfWidgetFactoryPlugin::NewL() + { + // Must use (ELeave), because ECOM won't undestand bad_alloc + return new(ELeave)AlfWidgetFactoryPlugin; + } + +AlfWidgetFactoryPlugin::~AlfWidgetFactoryPlugin() + { + } + +IAlfInterfaceBase* AlfWidgetFactoryPlugin::createProduct( + const char* aProduct, + void* aInitData) + { + (void) aProduct; //Compiler Warning removal. + + CAlfEnv* env = reinterpret_cast(aInitData); + AlfWidgetFactory* widgetFactory( new( EMM ) AlfWidgetFactory(*env) ); + // This basically returns the widgetFactory object. + // The ownership of that object is transferred to the caller. + return widgetFactory->makeInterface(IAlfWidgetFactory::type()); + } + +IAlfInterfaceBase* AlfWidgetFactoryPlugin::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + if(param == UString(IAlfFactoryPlugin::type().mImplementationId)) + { + return static_cast(this); + } + return NULL; + } + +int AlfWidgetFactoryPlugin::productCount()const + { + return KProductCount; + } + +const char* AlfWidgetFactoryPlugin::productInfo(int aIndex)const + { + if(aIndex == 0) + { + return KAlfWidgetFactory; + } + return 0; + } + + } // namespace Alf + + + +const TImplementationProxy ImplementationTable[] = + { + #ifdef __EABI__ + IMPLEMENTATION_PROXY_ENTRY( + KWidgetFactoryPluginUid, + AlfWidgetFactoryPlugin::NewL), + #else + {{KWidgetFactoryPluginUid}, AlfWidgetFactoryPlugin::NewL} + #endif + }; + +OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +// End of File diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/bwins/alfwidgetmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/bwins/alfwidgetmodelu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,468 @@ +EXPORTS + ?makeInterface@AlfFlowLayoutManager@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 1 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfFlowLayoutManager::makeInterface(struct Alf::IfId const &) + ?isValueSet@AlfAttribute@Alf@@QBE_NXZ @ 2 NONAME ; bool Alf::AlfAttribute::isValueSet(void) const + ?getTargetValue@AlfAttribute@Alf@@QBEPAVAlfAttributeValueType@2@I@Z @ 3 NONAME ; class Alf::AlfAttributeValueType * Alf::AlfAttribute::getTargetValue(unsigned int) const + ??0AlfCurvePathLayoutAttributeSetter@Alf@@QAE@XZ @ 4 NONAME ; Alf::AlfCurvePathLayoutAttributeSetter::AlfCurvePathLayoutAttributeSetter(void) + ?setTime@AlfAttribute@Alf@@QAEXH@Z @ 5 NONAME ; void Alf::AlfAttribute::setTime(int) + ?replaceItem@AlfMap@Alf@@UAEXIPAVIAlfVariantType@2@@Z @ 6 NONAME ; void Alf::AlfMap::replaceItem(unsigned int, class Alf::IAlfVariantType *) + ?checkState@CAlfWidgetControl@Alf@@UBE_NI@Z @ 7 NONAME ; bool Alf::CAlfWidgetControl::checkState(unsigned int) const + ?getLayout@AlfLayoutManager@Alf@@UBEAAVCAlfLayout@@XZ @ 8 NONAME ; class CAlfLayout & Alf::AlfLayoutManager::getLayout(void) const + ?findEventHandler@CAlfWidgetControl@Alf@@UAEPAVIAlfWidgetEventHandler@2@ABVTAlfEvent@@@Z @ 9 NONAME ; class Alf::IAlfWidgetEventHandler * Alf::CAlfWidgetControl::findEventHandler(class TAlfEvent const &) + ?numContainerIndices@AlfModelOperation@Alf@@QBEHXZ @ 10 NONAME ; int Alf::AlfModelOperation::numContainerIndices(void) const + ??0AlfContainer@Alf@@QAE@XZ @ 11 NONAME ; Alf::AlfContainer::AlfContainer(void) + ?index@AlfModelOperation@Alf@@QBEHXZ @ 12 NONAME ; int Alf::AlfModelOperation::index(void) const + ?childRemoved@AlfLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 13 NONAME ; void Alf::AlfLayoutManager::childRemoved(class Alf::CAlfWidgetControl *) + ?addCustomInput@AlfWidgetEventHandler@Alf@@QAEXH_NH@Z @ 14 NONAME ; void Alf::AlfWidgetEventHandler::addCustomInput(int, bool, int) + ?map@AlfMap@Alf@@UAEPAVIAlfMap@2@XZ @ 15 NONAME ; class Alf::IAlfMap * Alf::AlfMap::map(void) + ?setLayoutType@AlfVisualTemplate@Alf@@UAEXW4TAlfLayoutType@@@Z @ 16 NONAME ; void Alf::AlfVisualTemplate::setLayoutType(enum TAlfLayoutType) + ??1CAlfWidgetControl@Alf@@UAE@XZ @ 17 NONAME ; Alf::CAlfWidgetControl::~CAlfWidgetControl(void) + ?widgetCount@AlfWidget@Alf@@UBEHXZ @ 18 NONAME ; int Alf::AlfWidget::widgetCount(void) const + ?integer@AlfBranch@Alf@@UBEHXZ @ 19 NONAME ; int Alf::AlfBranch::integer(void) const + ?container@AlfBranch@Alf@@UAEPAVIAlfContainer@2@XZ @ 20 NONAME ; class Alf::IAlfContainer * Alf::AlfBranch::container(void) + ?setMappingFunctionId@AlfAttribute@Alf@@QAEXH@Z @ 21 NONAME ; void Alf::AlfAttribute::setMappingFunctionId(int) + ?removeItem@AlfMap@Alf@@UAEXI@Z @ 22 NONAME ; void Alf::AlfMap::removeItem(unsigned int) + ?handleFocusPrevious@CAlfWidgetControl@Alf@@IAE_NXZ @ 23 NONAME ; bool Alf::CAlfWidgetControl::handleFocusPrevious(void) + ?createAndSendCommands@AlfCommonVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 24 NONAME ; void Alf::AlfCommonVisualAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?set@AlfVariantType@Alf@@UAEXAAVIAlfVariantType@2@@Z @ 25 NONAME ; void Alf::AlfVariantType::set(class Alf::IAlfVariantType &) + ?parentElementDataId@CAlfWidgetControl@Alf@@UAEIABVIAlfElement@2@I@Z @ 26 NONAME ; unsigned int Alf::CAlfWidgetControl::parentElementDataId(class Alf::IAlfElement const &, unsigned int) + ?makeInterface@AlfLayoutManager@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 27 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfLayoutManager::makeInterface(struct Alf::IfId const &) + ?addPointerInput@AlfWidgetEventHandler@Alf@@QAEXPBD0W4WidgetPointerEvent@2@@Z @ 28 NONAME ; void Alf::AlfWidgetEventHandler::addPointerInput(char const *, char const *, enum Alf::WidgetPointerEvent) + ?item@AlfMap@Alf@@UAEPAVIAlfVariantType@2@ABVUString@osncore@@@Z @ 29 NONAME ; class Alf::IAlfVariantType * Alf::AlfMap::item(class osncore::UString const &) + ?branch@AlfMap@Alf@@UAEPAVIAlfBranch@2@XZ @ 30 NONAME ; class Alf::IAlfBranch * Alf::AlfMap::branch(void) + ?removeElement@CAlfWidgetControl@Alf@@UAEXABVIAlfElement@2@@Z @ 31 NONAME ; void Alf::CAlfWidgetControl::removeElement(class Alf::IAlfElement const &) + ?childRemoved@AlfAnchorLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 32 NONAME ; void Alf::AlfAnchorLayoutManager::childRemoved(class Alf::CAlfWidgetControl *) + ?integer@AlfMap@Alf@@UBEHXZ @ 33 NONAME ; int Alf::AlfMap::integer(void) const + ?getAttribute@AlfAttributeContainer@Alf@@QBEAAVAlfAttribute@2@I@Z @ 34 NONAME ; class Alf::AlfAttribute & Alf::AlfAttributeContainer::getAttribute(unsigned int) const + ?addItem@AlfMap@Alf@@UAEXPAVIAlfVariantType@2@ABVUString@osncore@@@Z @ 35 NONAME ; void Alf::AlfMap::addItem(class Alf::IAlfVariantType *, class osncore::UString const &) + ??1AlfVisualTemplate@Alf@@UAE@XZ @ 36 NONAME ; Alf::AlfVisualTemplate::~AlfVisualTemplate(void) + ?removeVisualTree@AlfElement@Alf@@UAEXAAVIAlfBranch@2@HI@Z @ 37 NONAME ; void Alf::AlfElement::removeVisualTree(class Alf::IAlfBranch &, int, unsigned int) + ?makeInterface@CAlfWidgetControl@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 38 NONAME ; class Alf::IAlfInterfaceBase * Alf::CAlfWidgetControl::makeInterface(struct Alf::IfId const &) + ?childTemplate@AlfVisualTemplate@Alf@@UBEAAVIAlfVisualTemplate@2@H@Z @ 39 NONAME ; class Alf::IAlfVisualTemplate & Alf::AlfVisualTemplate::childTemplate(int) const + ?model@AlfWidget@Alf@@UAEPAVIAlfModel@2@XZ @ 40 NONAME ; class Alf::IAlfModel * Alf::AlfWidget::model(void) + ?replaceVisualTree@AlfElement@Alf@@UAEXAAVIAlfVariantType@2@II@Z @ 41 NONAME ; void Alf::AlfElement::replaceVisualTree(class Alf::IAlfVariantType &, unsigned int, unsigned int) + ?customData@AlfBranch@Alf@@UAEPAVIAlfModelBase@2@XZ @ 42 NONAME ; class Alf::IAlfModelBase * Alf::AlfBranch::customData(void) + ?addWidgetEventOutputSignalSubscriber@AlfWidgetEventHandler@Alf@@QAEXAAVIAlfEventOutputSignalSubscriber@2@@Z @ 43 NONAME ; void Alf::AlfWidgetEventHandler::addWidgetEventOutputSignalSubscriber(class Alf::IAlfEventOutputSignalSubscriber &) + ?string@AlfBranch@Alf@@UBEABVUString@osncore@@XZ @ 44 NONAME ; class osncore::UString const & Alf::AlfBranch::string(void) const + ?setDelay@AlfAttribute@Alf@@QAEXH@Z @ 45 NONAME ; void Alf::AlfAttribute::setDelay(int) + ??0AlfVariantType@Alf@@QAE@ABH@Z @ 46 NONAME ; Alf::AlfVariantType::AlfVariantType(int const &) + ??0AlfAnchorLayoutManager@Alf@@QAE@XZ @ 47 NONAME ; Alf::AlfAnchorLayoutManager::AlfAnchorLayoutManager(void) + ??1AlfDeckLayoutAttributeSetter@Alf@@UAE@XZ @ 48 NONAME ; Alf::AlfDeckLayoutAttributeSetter::~AlfDeckLayoutAttributeSetter(void) + ?uinteger@AlfContainer@Alf@@UBEIXZ @ 49 NONAME ; unsigned int Alf::AlfContainer::uinteger(void) const + ?makeInterface@AlfModel@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 50 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfModel::makeInterface(struct Alf::IfId const &) + ??0AlfFlowLayoutAttributeSetter@Alf@@QAE@XZ @ 51 NONAME ; Alf::AlfFlowLayoutAttributeSetter::AlfFlowLayoutAttributeSetter(void) + ?getAttributeByName@AlfAttributeContainer@Alf@@QBEAAVAlfAttribute@2@PBD@Z @ 52 NONAME ; class Alf::AlfAttribute & Alf::AlfAttributeContainer::getAttributeByName(char const *) const + ?string@AlfContainer@Alf@@UBEABVUString@osncore@@XZ @ 53 NONAME ; class osncore::UString const & Alf::AlfContainer::string(void) const + ??1AlfAnimationOutput@Alf@@QAE@XZ @ 54 NONAME ; Alf::AlfAnimationOutput::~AlfAnimationOutput(void) + ?attributeCount@AlfAttributeContainer@Alf@@QBEIXZ @ 55 NONAME ; unsigned int Alf::AlfAttributeContainer::attributeCount(void) const + ?type@AlfAttributeValueType@Alf@@UBE?AW4Type@12@XZ @ 56 NONAME ; enum Alf::AlfAttributeValueType::Type Alf::AlfAttributeValueType::type(void) const + ?setEventHandlerData@AlfRecyclingGridElement@Alf@@UAEXABUAlfWidgetEventHandlerInitData@2@@Z @ 57 NONAME ; void Alf::AlfRecyclingGridElement::setEventHandlerData(struct Alf::AlfWidgetEventHandlerInitData const &) + ??0AlfElement@Alf@@QAE@AAVCAlfWidgetControl@1@PBD@Z @ 58 NONAME ; Alf::AlfElement::AlfElement(class Alf::CAlfWidgetControl &, char const *) + ?real@AlfMap@Alf@@UBENXZ @ 59 NONAME ; double Alf::AlfMap::real(void) const + ?setData@AlfModel@Alf@@UAEXPAVIAlfVariantType@2@@Z @ 60 NONAME ; void Alf::AlfModel::setData(class Alf::IAlfVariantType *) + ?addKeyInput@AlfWidgetEventHandler@Alf@@QAEXHW4EventTypeFlags@2@I@Z @ 61 NONAME ; void Alf::AlfWidgetEventHandler::addKeyInput(int, enum Alf::EventTypeFlags, unsigned int) + ?numAttributeSetters@AlfVisualTemplate@Alf@@UBEHXZ @ 62 NONAME ; int Alf::AlfVisualTemplate::numAttributeSetters(void) const + ??0AlfCommonLayoutAttributeSetter@Alf@@QAE@XZ @ 63 NONAME ; Alf::AlfCommonLayoutAttributeSetter::AlfCommonLayoutAttributeSetter(void) + ??1AlfMap@Alf@@UAE@XZ @ 64 NONAME ; Alf::AlfMap::~AlfMap(void) + ??0AlfAttribute@Alf@@QAE@XZ @ 65 NONAME ; Alf::AlfAttribute::AlfAttribute(void) + ?createVisualTree@AlfRecyclingGridElement@Alf@@UAEPAVCAlfVisual@@AAVIAlfVariantType@2@IPAVCAlfLayout@@H@Z @ 66 NONAME ; class CAlfVisual * Alf::AlfRecyclingGridElement::createVisualTree(class Alf::IAlfVariantType &, unsigned int, class CAlfLayout *, int) + ?removeWidget@AlfWidget@Alf@@UAEXH@Z @ 67 NONAME ; void Alf::AlfWidget::removeWidget(int) + ?eventHandler@CAlfWidgetControl@Alf@@UAEAAVIAlfWidgetEventHandler@2@H@Z @ 68 NONAME ; class Alf::IAlfWidgetEventHandler & Alf::CAlfWidgetControl::eventHandler(int) + ?removeChildVisualTree@AlfRecyclingGridElement@Alf@@UAEXPAVIAlfElement@2@AAVIAlfBranch@2@HI@Z @ 69 NONAME ; void Alf::AlfRecyclingGridElement::removeChildVisualTree(class Alf::IAlfElement *, class Alf::IAlfBranch &, int, unsigned int) + ?createCommand@AlfViewportLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 70 NONAME ; class TAlfCommand * Alf::AlfViewportLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?addWidgetAttributeInput@AlfWidgetEventHandler@Alf@@QAEXAAVUString@osncore@@PAVAlfAttributeValueType@2@PBD@Z @ 71 NONAME ; void Alf::AlfWidgetEventHandler::addWidgetAttributeInput(class osncore::UString &, class Alf::AlfAttributeValueType *, char const *) + ??1AlfAnchorLayoutManager@Alf@@UAE@XZ @ 72 NONAME ; Alf::AlfAnchorLayoutManager::~AlfAnchorLayoutManager(void) + ?createChildVisualTree@AlfElement@Alf@@UAEXPAVIAlfElement@2@AAVIAlfVariantType@2@AAVIAlfBranch@2@HI@Z @ 73 NONAME ; void Alf::AlfElement::createChildVisualTree(class Alf::IAlfElement *, class Alf::IAlfVariantType &, class Alf::IAlfBranch &, int, unsigned int) + ?map@AlfVariantType@Alf@@UAEPAVIAlfMap@2@XZ @ 74 NONAME ; class Alf::IAlfMap * Alf::AlfVariantType::map(void) + ?container@AlfContainer@Alf@@UAEPAVIAlfContainer@2@XZ @ 75 NONAME ; class Alf::IAlfContainer * Alf::AlfContainer::container(void) + ?dataID@AlfElement@Alf@@UBEIABVCAlfVisual@@@Z @ 76 NONAME ; unsigned int Alf::AlfElement::dataID(class CAlfVisual const &) const + ?setSelectChildMode@AlfVisualTemplate@Alf@@UAEX_NABVUString@osncore@@@Z @ 77 NONAME ; void Alf::AlfVisualTemplate::setSelectChildMode(bool, class osncore::UString const &) + ?createVisualTree@AlfElement@Alf@@UAEPAVCAlfVisual@@AAVIAlfVariantType@2@IPAVCAlfLayout@@H@Z @ 78 NONAME ; class CAlfVisual * Alf::AlfElement::createVisualTree(class Alf::IAlfVariantType &, unsigned int, class CAlfLayout *, int) + ??0AlfModel@Alf@@QAE@PAVIAlfVariantType@1@@Z @ 79 NONAME ; Alf::AlfModel::AlfModel(class Alf::IAlfVariantType *) + ?widget@CAlfWidgetControl@Alf@@UAEPAVAlfWidget@2@XZ @ 80 NONAME ; class Alf::AlfWidget * Alf::CAlfWidgetControl::widget(void) + ?owner@AlfLayoutManager@Alf@@QBEAAVCAlfWidgetControl@2@XZ @ 81 NONAME ; class Alf::CAlfWidgetControl & Alf::AlfLayoutManager::owner(void) const + ?updateChildLayout@AlfGridLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 82 NONAME ; void Alf::AlfGridLayoutManager::updateChildLayout(class Alf::CAlfWidgetControl *) + ?setAttributeValue@AlfMeshVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 83 NONAME ; void Alf::AlfMeshVisualAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?makeInterface@AlfWidget@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 84 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfWidget::makeInterface(struct Alf::IfId const &) + ?notifyModelChanged@AlfModel@Alf@@QAEXXZ @ 85 NONAME ; void Alf::AlfModel::notifyModelChanged(void) + ?resourcePool@AlfWidgetEnvExtension@Alf@@SAAAVResourcePool@2@AAVCAlfEnv@@@Z @ 86 NONAME ; class Alf::ResourcePool & Alf::AlfWidgetEnvExtension::resourcePool(class CAlfEnv &) + ??1AlfBranch@Alf@@UAE@XZ @ 87 NONAME ; Alf::AlfBranch::~AlfBranch(void) + ?getDataField@AlfAttribute@Alf@@QBEPBDXZ @ 88 NONAME ; char const * Alf::AlfAttribute::getDataField(void) const + ?createAndSendCommands@AlfMeshVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 89 NONAME ; void Alf::AlfMeshVisualAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?numChildTemplates@AlfVisualTemplate@Alf@@UBEHXZ @ 90 NONAME ; int Alf::AlfVisualTemplate::numChildTemplates(void) const + ?attributeSetter@AlfVisualTemplate@Alf@@UBEAAVIAlfAttributeSetter@2@H@Z @ 91 NONAME ; class Alf::IAlfAttributeSetter & Alf::AlfVisualTemplate::attributeSetter(int) const + ??0AlfLineVisualAttributeSetter@Alf@@QAE@XZ @ 92 NONAME ; Alf::AlfLineVisualAttributeSetter::AlfLineVisualAttributeSetter(void) + ?branch@AlfContainer@Alf@@UAEPAVIAlfBranch@2@XZ @ 93 NONAME ; class Alf::IAlfBranch * Alf::AlfContainer::branch(void) + ?setState@CAlfWidgetControl@Alf@@UAEXI@Z @ 94 NONAME ; void Alf::CAlfWidgetControl::setState(unsigned int) + ?rgbValue@AlfAttributeValueType@Alf@@UBEMXZ @ 95 NONAME ; float Alf::AlfAttributeValueType::rgbValue(void) const + ?string@AlfVariantType@Alf@@UBEABVUString@osncore@@XZ @ 96 NONAME ; class osncore::UString const & Alf::AlfVariantType::string(void) const + ??1AlfModelOperation@Alf@@QAE@XZ @ 97 NONAME ; Alf::AlfModelOperation::~AlfModelOperation(void) + ??0AlfVisualTemplate@Alf@@IAE@W4TAlfVisualType@@@Z @ 98 NONAME ; Alf::AlfVisualTemplate::AlfVisualTemplate(enum TAlfVisualType) + ?unit@AlfAttributeValueType@Alf@@UBE?AW4TAlfUnit@@XZ @ 99 NONAME ; enum TAlfUnit Alf::AlfAttributeValueType::unit(void) const + ?removeItem@AlfContainer@Alf@@UAEXI@Z @ 100 NONAME ; void Alf::AlfContainer::removeItem(unsigned int) + ?addWidget@AlfWidget@Alf@@UAEXAAVIAlfWidget@2@@Z @ 101 NONAME ; void Alf::AlfWidget::addWidget(class Alf::IAlfWidget &) + ?removeData@AlfModel@Alf@@UAEXHPAH@Z @ 102 NONAME ; void Alf::AlfModel::removeData(int, int *) + ?addElement@CAlfWidgetControl@Alf@@UAEXPAVIAlfElement@2@@Z @ 103 NONAME ; void Alf::CAlfWidgetControl::addElement(class Alf::IAlfElement *) + ??0AlfWidget@Alf@@QAE@PBD@Z @ 104 NONAME ; Alf::AlfWidget::AlfWidget(char const *) + ??1AlfFlowLayoutAttributeSetter@Alf@@UAE@XZ @ 105 NONAME ; Alf::AlfFlowLayoutAttributeSetter::~AlfFlowLayoutAttributeSetter(void) + ?sort@AlfBranch@Alf@@UAEXABVIAlfSortFunction@2@@Z @ 106 NONAME ; void Alf::AlfBranch::sort(class Alf::IAlfSortFunction const &) + ?doUpdateChildLayout@AlfAnchorLayoutManager@Alf@@MAEXPAVCAlfWidgetControl@2@@Z @ 107 NONAME ; void Alf::AlfAnchorLayoutManager::doUpdateChildLayout(class Alf::CAlfWidgetControl *) + ?integer@AlfVariantType@Alf@@UBEHXZ @ 108 NONAME ; int Alf::AlfVariantType::integer(void) const + ?createAndSendCommands@AlfViewportLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 109 NONAME ; void Alf::AlfViewportLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?nextFocusableControl@CAlfWidgetControl@Alf@@AAEPAV12@PAV12@@Z @ 110 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::nextFocusableControl(class Alf::CAlfWidgetControl *) + ?getLayoutPreferences@AlfLayoutManager@Alf@@IBEPBVIAlfLayoutPreferences@2@PAVCAlfWidgetControl@2@@Z @ 111 NONAME ; class Alf::IAlfLayoutPreferences const * Alf::AlfLayoutManager::getLayoutPreferences(class Alf::CAlfWidgetControl *) const + ?findVisual@AlfElement@Alf@@QAEPAVCAlfVisual@@I@Z @ 112 NONAME ; class CAlfVisual * Alf::AlfElement::findVisual(unsigned int) + ?removeAndDestroyElement@CAlfWidgetControl@Alf@@UAEXABVIAlfElement@2@@Z @ 113 NONAME ; void Alf::CAlfWidgetControl::removeAndDestroyElement(class Alf::IAlfElement const &) + ?setSourceValue@AlfAttribute@Alf@@QAEXPAVAlfAttributeValueType@2@I@Z @ 114 NONAME ; void Alf::AlfAttribute::setSourceValue(class Alf::AlfAttributeValueType *, unsigned int) + ??0AlfVariantType@Alf@@QAE@ABN@Z @ 115 NONAME ; Alf::AlfVariantType::AlfVariantType(double const &) + ??1AlfCommonVisualAttributeSetter@Alf@@UAE@XZ @ 116 NONAME ; Alf::AlfCommonVisualAttributeSetter::~AlfCommonVisualAttributeSetter(void) + ??0AlfImageVisualAttributeSetter@Alf@@QAE@XZ @ 117 NONAME ; Alf::AlfImageVisualAttributeSetter::AlfImageVisualAttributeSetter(void) + ?createChildVisualTree@AlfRecyclingGridElement@Alf@@UAEXPAVIAlfElement@2@AAVIAlfVariantType@2@AAVIAlfBranch@2@HI@Z @ 118 NONAME ; void Alf::AlfRecyclingGridElement::createChildVisualTree(class Alf::IAlfElement *, class Alf::IAlfVariantType &, class Alf::IAlfBranch &, int, unsigned int) + ?getFocusableBefore@CAlfWidgetControl@Alf@@MAEPAV12@AAVIAlfContainerWidget@2@AAV12@@Z @ 119 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::getFocusableBefore(class Alf::IAlfContainerWidget &, class Alf::CAlfWidgetControl &) + ?setAttributeValue@AlfDeckLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 120 NONAME ; void Alf::AlfDeckLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?modelChanged@CAlfWidgetControl@Alf@@UAEXAAVIAlfModel@2@@Z @ 121 NONAME ; void Alf::CAlfWidgetControl::modelChanged(class Alf::IAlfModel &) + ?createCommand@AlfFlowLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 122 NONAME ; class TAlfCommand * Alf::AlfFlowLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?createAndSendCommands@AlfAnchorLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 123 NONAME ; void Alf::AlfAnchorLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?createVisualTree@AlfVisualTemplate@Alf@@UAEPAVCAlfVisual@@AAVCAlfControl@@PAVIAlfMap@2@PAVCAlfLayout@@H@Z @ 124 NONAME ; class CAlfVisual * Alf::AlfVisualTemplate::createVisualTree(class CAlfControl &, class Alf::IAlfMap *, class CAlfLayout *, int) + ?uinteger@AlfBranch@Alf@@UBEIXZ @ 125 NONAME ; unsigned int Alf::AlfBranch::uinteger(void) const + ?getWidget@AlfWidget@Alf@@UBEPAVIAlfWidget@2@H@Z @ 126 NONAME ; class Alf::IAlfWidget * Alf::AlfWidget::getWidget(int) const + ?getSourceValueCount@AlfAttribute@Alf@@QBEIXZ @ 127 NONAME ; unsigned int Alf::AlfAttribute::getSourceValueCount(void) const + ??0AlfVariantType@Alf@@QAE@ABI@Z @ 128 NONAME ; Alf::AlfVariantType::AlfVariantType(unsigned int const &) + ?getSourceValue@AlfAttribute@Alf@@QBEPAVAlfAttributeValueType@2@I@Z @ 129 NONAME ; class Alf::AlfAttributeValueType * Alf::AlfAttribute::getSourceValue(unsigned int) const + ?boolean@AlfContainer@Alf@@UBE_NXZ @ 130 NONAME ; bool Alf::AlfContainer::boolean(void) const + ?setVisualType@AlfVisualTemplate@Alf@@UAEXW4TAlfVisualType@@@Z @ 131 NONAME ; void Alf::AlfVisualTemplate::setVisualType(enum TAlfVisualType) + ?construct@CAlfWidgetControl@Alf@@IAEXAAVCAlfEnv@@@Z @ 132 NONAME ; void Alf::CAlfWidgetControl::construct(class CAlfEnv &) + ?addEventHandler@CAlfWidgetControl@Alf@@UAEXPAVIAlfWidgetEventHandler@2@H@Z @ 133 NONAME ; void Alf::CAlfWidgetControl::addEventHandler(class Alf::IAlfWidgetEventHandler *, int) + ?integer@AlfContainer@Alf@@UBEHXZ @ 134 NONAME ; int Alf::AlfContainer::integer(void) const + ??1AlfReferenceToVisual@Alf@@QAE@XZ @ 135 NONAME ; Alf::AlfReferenceToVisual::~AlfReferenceToVisual(void) + ?uinteger@AlfVariantType@Alf@@UBEIXZ @ 136 NONAME ; unsigned int Alf::AlfVariantType::uinteger(void) const + ?destroyPresentation@CAlfWidgetControl@Alf@@UAEXH@Z @ 137 NONAME ; void Alf::CAlfWidgetControl::destroyPresentation(int) + ??1AlfLineVisualAttributeSetter@Alf@@UAE@XZ @ 138 NONAME ; Alf::AlfLineVisualAttributeSetter::~AlfLineVisualAttributeSetter(void) + ??0AlfVariantType@Alf@@QAE@ABVUString@osncore@@@Z @ 139 NONAME ; Alf::AlfVariantType::AlfVariantType(class osncore::UString const &) + ?executeOperations@AlfModel@Alf@@UAEXAAV?$AlfPtrVector@VAlfModelOperation@Alf@@@osncore@@@Z @ 140 NONAME ; void Alf::AlfModel::executeOperations(class osncore::AlfPtrVector &) + ??1AlfVariantType@Alf@@UAE@XZ @ 141 NONAME ; Alf::AlfVariantType::~AlfVariantType(void) + ?removeSourceValue@AlfAttribute@Alf@@QAEXI@Z @ 142 NONAME ; void Alf::AlfAttribute::removeSourceValue(unsigned int) + ?removeEventHandler@CAlfWidgetControl@Alf@@UAEXAAVIAlfWidgetEventHandler@2@@Z @ 143 NONAME ; void Alf::CAlfWidgetControl::removeEventHandler(class Alf::IAlfWidgetEventHandler &) + ?parent@AlfVisualTemplate@Alf@@UBEPAVIAlfVisualTemplate@2@XZ @ 144 NONAME ; class Alf::IAlfVisualTemplate * Alf::AlfVisualTemplate::parent(void) const + ?createAndSendCommands@AlfCommonAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 145 NONAME ; void Alf::AlfCommonAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?getTime@AlfAttributeContainer@Alf@@QBEIXZ @ 146 NONAME ; unsigned int Alf::AlfAttributeContainer::getTime(void) const + ?addVisualTree@AlfElement@Alf@@QAEXPAVCAlfVisual@@I@Z @ 147 NONAME ; void Alf::AlfElement::addVisualTree(class CAlfVisual *, unsigned int) + ?setAttributeValue@AlfTextVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 148 NONAME ; void Alf::AlfTextVisualAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?isDirty@AlfAttribute@Alf@@QBE_NXZ @ 149 NONAME ; bool Alf::AlfAttribute::isDirty(void) const + ?makeInterface@AlfAnchorLayoutManager@Alf@@MAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 150 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfAnchorLayoutManager::makeInterface(struct Alf::IfId const &) + ?insertChildTemplate@AlfVisualTemplate@Alf@@UAEXAAVIAlfVisualTemplate@2@H@Z @ 151 NONAME ; void Alf::AlfVisualTemplate::insertChildTemplate(class Alf::IAlfVisualTemplate &, int) + ?create@AlfVisualTemplate@Alf@@SAPAV12@W4TAlfVisualType@@@Z @ 152 NONAME ; class Alf::AlfVisualTemplate * Alf::AlfVisualTemplate::create(enum TAlfVisualType) + ?setTime@AlfAttributeContainer@Alf@@QAEXI@Z @ 153 NONAME ; void Alf::AlfAttributeContainer::setTime(unsigned int) + ?real@AlfContainer@Alf@@UBENXZ @ 154 NONAME ; double Alf::AlfContainer::real(void) const + ?clone@AlfContainer@Alf@@UAEPAVIAlfContainer@2@XZ @ 155 NONAME ; class Alf::IAlfContainer * Alf::AlfContainer::clone(void) + ?getFirstFocusable@CAlfWidgetControl@Alf@@MAEPAV12@AAVIAlfContainerWidget@2@@Z @ 156 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::getFirstFocusable(class Alf::IAlfContainerWidget &) + ?setData@AlfBranch@Alf@@UAEXPAVIAlfMap@2@@Z @ 157 NONAME ; void Alf::AlfBranch::setData(class Alf::IAlfMap *) + ??1AlfGridLayoutManager@Alf@@UAE@XZ @ 158 NONAME ; Alf::AlfGridLayoutManager::~AlfGridLayoutManager(void) + ?setAttributeValue@AlfAnchorLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 159 NONAME ; void Alf::AlfAnchorLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?destroyChildTemplate@AlfVisualTemplate@Alf@@UAEXH@Z @ 160 NONAME ; void Alf::AlfVisualTemplate::destroyChildTemplate(int) + ?setAttributeValue@AlfViewportLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 161 NONAME ; void Alf::AlfViewportLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?setPresentation@AlfWidget@Alf@@UAEXPBD@Z @ 162 NONAME ; void Alf::AlfWidget::setPresentation(char const *) + ?customData@AlfMap@Alf@@UAEPAVIAlfModelBase@2@XZ @ 163 NONAME ; class Alf::IAlfModelBase * Alf::AlfMap::customData(void) + ?createVisualTree@AlfElement@Alf@@UAEPAVCAlfVisual@@AAVIAlfVariantType@2@AAVIAlfBranch@2@HIPAVCAlfLayout@@H@Z @ 164 NONAME ; class CAlfVisual * Alf::AlfElement::createVisualTree(class Alf::IAlfVariantType &, class Alf::IAlfBranch &, int, unsigned int, class CAlfLayout *, int) + ?childName@AlfBranch@Alf@@UAEABVUString@osncore@@H@Z @ 165 NONAME ; class osncore::UString const & Alf::AlfBranch::childName(int) + ?type@AlfAttribute@Alf@@QBE?AW4Type@AlfAttributeValueType@2@I@Z @ 166 NONAME ; enum Alf::AlfAttributeValueType::Type Alf::AlfAttribute::type(unsigned int) const + ??0AlfAttribute@Alf@@QAE@PBDABVUString@osncore@@W4attributecategory@01@@Z @ 167 NONAME ; Alf::AlfAttribute::AlfAttribute(char const *, class osncore::UString const &, enum Alf::AlfAttribute::attributecategory) + ?intValue@AlfAttributeValueType@Alf@@UBEHXZ @ 168 NONAME ; int Alf::AlfAttributeValueType::intValue(void) const + ?branch@AlfVariantType@Alf@@UAEPAVIAlfBranch@2@XZ @ 169 NONAME ; class Alf::IAlfBranch * Alf::AlfVariantType::branch(void) + ?addItem@AlfContainer@Alf@@UAEXIPAVIAlfVariantType@2@@Z @ 170 NONAME ; void Alf::AlfContainer::addItem(unsigned int, class Alf::IAlfVariantType *) + ?dataIdToIndex@CAlfWidgetControl@Alf@@UAEIABVIAlfElement@2@I@Z @ 171 NONAME ; unsigned int Alf::CAlfWidgetControl::dataIdToIndex(class Alf::IAlfElement const &, unsigned int) + ?type@AlfMap@Alf@@UBE?AW4Type@IAlfVariantType@2@XZ @ 172 NONAME ; enum Alf::IAlfVariantType::Type Alf::AlfMap::type(void) const + ??0CAlfWidgetControl@Alf@@IAE@XZ @ 173 NONAME ; Alf::CAlfWidgetControl::CAlfWidgetControl(void) + ?removeVisualTree@AlfElement@Alf@@UAEXAAVIAlfVariantType@2@I@Z @ 174 NONAME ; void Alf::AlfElement::removeVisualTree(class Alf::IAlfVariantType &, unsigned int) + ?name@AlfMap@Alf@@UBEABVUString@osncore@@I@Z @ 175 NONAME ; class osncore::UString const & Alf::AlfMap::name(unsigned int) const + ?updateVisualTree@AlfElement@Alf@@UAEXAAVIAlfVariantType@2@0I@Z @ 176 NONAME ; void Alf::AlfElement::updateVisualTree(class Alf::IAlfVariantType &, class Alf::IAlfVariantType &, unsigned int) + ??0AlfBranch@Alf@@QAE@PAVIAlfMap@1@0@Z @ 177 NONAME ; Alf::AlfBranch::AlfBranch(class Alf::IAlfMap *, class Alf::IAlfMap *) + ?destroyVisualTemplate@AlfElement@Alf@@UAEXXZ @ 178 NONAME ; void Alf::AlfElement::destroyVisualTemplate(void) + ??0AlfWidgetEventHandler@Alf@@QAE@W4AlfEventHandlerType@IAlfWidgetEventHandler@1@W4AlfEventHandlerExecutionPhase@31@@Z @ 179 NONAME ; Alf::AlfWidgetEventHandler::AlfWidgetEventHandler(enum Alf::IAlfWidgetEventHandler::AlfEventHandlerType, enum Alf::IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase) + ?addBrush@AlfVisualTemplate@Alf@@UAEXAAVCAlfBrush@@@Z @ 180 NONAME ; void Alf::AlfVisualTemplate::addBrush(class CAlfBrush &) + ?category@AlfAttribute@Alf@@QBE?AW4attributecategory@12@XZ @ 181 NONAME ; enum Alf::AlfAttribute::attributecategory Alf::AlfAttribute::category(void) const + ?intValue@AlfAttribute@Alf@@QBEHI@Z @ 182 NONAME ; int Alf::AlfAttribute::intValue(unsigned int) const + ?createAndSendCommands@AlfImageVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 183 NONAME ; void Alf::AlfImageVisualAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?updatePresentation@CAlfWidgetControl@Alf@@UAEXXZ @ 184 NONAME ; void Alf::CAlfWidgetControl::updatePresentation(void) + ?makeInterface@AlfGridLayoutManager@Alf@@MAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 185 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfGridLayoutManager::makeInterface(struct Alf::IfId const &) + ??0AlfRecyclingGridElement@Alf@@QAE@AAVCAlfWidgetControl@1@PBDHH@Z @ 186 NONAME ; Alf::AlfRecyclingGridElement::AlfRecyclingGridElement(class Alf::CAlfWidgetControl &, char const *, int, int) + ??0AlfVisualTemplate@Alf@@IAE@XZ @ 187 NONAME ; Alf::AlfVisualTemplate::AlfVisualTemplate(void) + ?setFillStyle@AlfRecyclingGridElement@Alf@@QAEXW4FillStyle@12@H@Z @ 188 NONAME ; void Alf::AlfRecyclingGridElement::setFillStyle(enum Alf::AlfRecyclingGridElement::FillStyle, int) + ?addItem@AlfMap@Alf@@UAEXIPAVIAlfVariantType@2@ABVUString@osncore@@@Z @ 189 NONAME ; void Alf::AlfMap::addItem(unsigned int, class Alf::IAlfVariantType *, class osncore::UString const &) + ??1AlfAttributeValueType@Alf@@UAE@XZ @ 190 NONAME ; Alf::AlfAttributeValueType::~AlfAttributeValueType(void) + ??1AlfCommonLayoutAttributeSetter@Alf@@UAE@XZ @ 191 NONAME ; Alf::AlfCommonLayoutAttributeSetter::~AlfCommonLayoutAttributeSetter(void) + ?AcquireFocus@CAlfWidgetControl@Alf@@QAEXXZ @ 192 NONAME ; void Alf::CAlfWidgetControl::AcquireFocus(void) + ?visualType@AlfVisualTemplate@Alf@@UBEHXZ @ 193 NONAME ; int Alf::AlfVisualTemplate::visualType(void) const + ?processEvent@CAlfWidgetControl@Alf@@QAE?AW4AlfEventStatus@2@ABVTAlfEvent@@@Z @ 194 NONAME ; enum Alf::AlfEventStatus Alf::CAlfWidgetControl::processEvent(class TAlfEvent const &) + ??0AlfCommonAttributeSetter@Alf@@QAE@XZ @ 195 NONAME ; Alf::AlfCommonAttributeSetter::AlfCommonAttributeSetter(void) + ?setParent@AlfVisualTemplate@Alf@@UAEXPAVIAlfVisualTemplate@2@@Z @ 196 NONAME ; void Alf::AlfVisualTemplate::setParent(class Alf::IAlfVisualTemplate *) + ?stringValue@AlfAttributeValueType@Alf@@UBEABVUString@osncore@@XZ @ 197 NONAME ; class osncore::UString const & Alf::AlfAttributeValueType::stringValue(void) const + ??0AlfAttribute@Alf@@QAE@PBDHW4TAlfUnit@@W4attributecategory@01@@Z @ 198 NONAME ; Alf::AlfAttribute::AlfAttribute(char const *, int, enum TAlfUnit, enum Alf::AlfAttribute::attributecategory) + ?updateVisualTree@AlfVisualTemplate@Alf@@UAEPAVCAlfVisual@@PAVIAlfMap@2@0AAV3@@Z @ 199 NONAME ; class CAlfVisual * Alf::AlfVisualTemplate::updateVisualTree(class Alf::IAlfMap *, class Alf::IAlfMap *, class CAlfVisual &) + ??0AlfTextVisualAttributeSetter@Alf@@QAE@XZ @ 200 NONAME ; Alf::AlfTextVisualAttributeSetter::AlfTextVisualAttributeSetter(void) + ?handleFocusNext@CAlfWidgetControl@Alf@@IAE_NXZ @ 201 NONAME ; bool Alf::CAlfWidgetControl::handleFocusNext(void) + ?initializeEnvironment@AlfWidgetEnvExtension@Alf@@SAXAAVCAlfEnv@@@Z @ 202 NONAME ; void Alf::AlfWidgetEnvExtension::initializeEnvironment(class CAlfEnv &) + ?setAttributeValue@AlfCommonAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 203 NONAME ; void Alf::AlfCommonAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ??0AlfGridLayoutAttributeSetter@Alf@@QAE@XZ @ 204 NONAME ; Alf::AlfGridLayoutAttributeSetter::AlfGridLayoutAttributeSetter(void) + ?makeInterface@AlfHostAPIImpl@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 205 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfHostAPIImpl::makeInterface(struct Alf::IfId const &) + ?createCommand@AlfGridLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 206 NONAME ; class TAlfCommand * Alf::AlfGridLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?type@AlfBranch@Alf@@UBE?AW4Type@IAlfVariantType@2@XZ @ 207 NONAME ; enum Alf::IAlfVariantType::Type Alf::AlfBranch::type(void) const + ?addCancelOutput@AlfWidgetEventHandler@Alf@@QAEXPBDH_N@Z @ 208 NONAME ; void Alf::AlfWidgetEventHandler::addCancelOutput(char const *, int, bool) + ?enumValue@AlfAttributeValueType@Alf@@UBEHXZ @ 209 NONAME ; int Alf::AlfAttributeValueType::enumValue(void) const + ??1AlfAttributeContainer@Alf@@QAE@XZ @ 210 NONAME ; Alf::AlfAttributeContainer::~AlfAttributeContainer(void) + ?setModel@AlfWidget@Alf@@UAEXPAVIAlfModel@2@_N@Z @ 211 NONAME ; void Alf::AlfWidget::setModel(class Alf::IAlfModel *, bool) + ?createCommand@AlfLineVisualAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 212 NONAME ; class TAlfCommand * Alf::AlfLineVisualAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?set@AlfContainer@Alf@@UAEXAAVIAlfVariantType@2@@Z @ 213 NONAME ; void Alf::AlfContainer::set(class Alf::IAlfVariantType &) + ?addWidgetAttributeOutput@AlfWidgetEventHandler@Alf@@QAEXAAVAlfAttribute@2@PBD@Z @ 214 NONAME ; void Alf::AlfWidgetEventHandler::addWidgetAttributeOutput(class Alf::AlfAttribute &, char const *) + ?setControlSize@AlfLayoutManager@Alf@@IAEXAAVCAlfWidgetControl@2@ABUTAlfRealPoint@@@Z @ 215 NONAME ; void Alf::AlfLayoutManager::setControlSize(class Alf::CAlfWidgetControl &, struct TAlfRealPoint const &) + ?control@AlfElement@Alf@@IAEAAVCAlfWidgetControl@2@XZ @ 216 NONAME ; class Alf::CAlfWidgetControl & Alf::AlfElement::control(void) + ??0AlfGridLayoutManager@Alf@@QAE@XZ @ 217 NONAME ; Alf::AlfGridLayoutManager::AlfGridLayoutManager(void) + ?findVisual@AlfElement@Alf@@UAEPAVCAlfVisual@@PBDI@Z @ 218 NONAME ; class CAlfVisual * Alf::AlfElement::findVisual(char const *, unsigned int) + ?numEventHandlers@CAlfWidgetControl@Alf@@UBEHXZ @ 219 NONAME ; int Alf::CAlfWidgetControl::numEventHandlers(void) const + ??0AlfVariantType@Alf@@QAE@AB_N@Z @ 220 NONAME ; Alf::AlfVariantType::AlfVariantType(bool const &) + ??1AlfViewportLayoutAttributeSetter@Alf@@UAE@XZ @ 221 NONAME ; Alf::AlfViewportLayoutAttributeSetter::~AlfViewportLayoutAttributeSetter(void) + ?dataIdRange@CAlfWidgetControl@Alf@@UAEIABVIAlfElement@2@@Z @ 222 NONAME ; unsigned int Alf::CAlfWidgetControl::dataIdRange(class Alf::IAlfElement const &) + ?item@AlfMap@Alf@@UAEPAVIAlfVariantType@2@I@Z @ 223 NONAME ; class Alf::IAlfVariantType * Alf::AlfMap::item(unsigned int) + ??0AlfAttribute@Alf@@QAE@PBDMW4TAlfUnit@@W4attributecategory@01@@Z @ 224 NONAME ; Alf::AlfAttribute::AlfAttribute(char const *, float, enum TAlfUnit, enum Alf::AlfAttribute::attributecategory) + ?boolean@AlfVariantType@Alf@@UBE_NXZ @ 225 NONAME ; bool Alf::AlfVariantType::boolean(void) const + ?replaceItem@AlfMap@Alf@@UAEXABVUString@osncore@@PAVIAlfVariantType@2@@Z @ 226 NONAME ; void Alf::AlfMap::replaceItem(class osncore::UString const &, class Alf::IAlfVariantType *) + ??0AlfVariantType@Alf@@QAE@XZ @ 227 NONAME ; Alf::AlfVariantType::AlfVariantType(void) + ?count@AlfContainer@Alf@@UAEHXZ @ 228 NONAME ; int Alf::AlfContainer::count(void) + ??1AlfRecyclingGridElement@Alf@@UAE@XZ @ 229 NONAME ; Alf::AlfRecyclingGridElement::~AlfRecyclingGridElement(void) + ?map@AlfBranch@Alf@@UAEPAVIAlfMap@2@XZ @ 230 NONAME ; class Alf::IAlfMap * Alf::AlfBranch::map(void) + ?getMappingFunctionId@AlfAttribute@Alf@@QBEHXZ @ 231 NONAME ; int Alf::AlfAttribute::getMappingFunctionId(void) const + ??0AlfAttributeValueType@Alf@@QAE@MW4TAlfUnit@@@Z @ 232 NONAME ; Alf::AlfAttributeValueType::AlfAttributeValueType(float, enum TAlfUnit) + ?childData@AlfBranch@Alf@@UAEPAVIAlfVariantType@2@H@Z @ 233 NONAME ; class Alf::IAlfVariantType * Alf::AlfBranch::childData(int) + ?name@AlfVisualTemplate@Alf@@UBEPBDXZ @ 234 NONAME ; char const * Alf::AlfVisualTemplate::name(void) const + ?setDirty@AlfAttribute@Alf@@QAEX_N@Z @ 235 NONAME ; void Alf::AlfAttribute::setDirty(bool) + ?removeAndDestroyVisuals@AlfRecyclingGridElement@Alf@@UAEXH@Z @ 236 NONAME ; void Alf::AlfRecyclingGridElement::removeAndDestroyVisuals(int) + ?createAndSendCommands@AlfCurvePathLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 237 NONAME ; void Alf::AlfCurvePathLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?updateChildrenLayout@AlfLayoutManager@Alf@@UAEXXZ @ 238 NONAME ; void Alf::AlfLayoutManager::updateChildrenLayout(void) + ?setAttributeValue@AlfImageVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 239 NONAME ; void Alf::AlfImageVisualAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ??0CAlfWidgetControl@Alf@@QAE@AAVCAlfEnv@@@Z @ 240 NONAME ; Alf::CAlfWidgetControl::CAlfWidgetControl(class CAlfEnv &) + ?count@AlfMap@Alf@@UBEHXZ @ 241 NONAME ; int Alf::AlfMap::count(void) const + ?uinteger@AlfMap@Alf@@UBEIXZ @ 242 NONAME ; unsigned int Alf::AlfMap::uinteger(void) const + ?removeAndDestroyEventHandler@CAlfWidgetControl@Alf@@UAEXABVUString@osncore@@@Z @ 243 NONAME ; void Alf::CAlfWidgetControl::removeAndDestroyEventHandler(class osncore::UString const &) + ?map@AlfContainer@Alf@@UAEPAVIAlfMap@2@XZ @ 244 NONAME ; class Alf::IAlfMap * Alf::AlfContainer::map(void) + ?accept@AlfRecyclingGridElement@Alf@@UBE_NAAVCAlfWidgetControl@2@ABVTAlfEvent@@@Z @ 245 NONAME ; bool Alf::AlfRecyclingGridElement::accept(class Alf::CAlfWidgetControl &, class TAlfEvent const &) const + ?createAndSendCommands@AlfFlowLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 246 NONAME ; void Alf::AlfFlowLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?widgetName@AlfWidget@Alf@@UBEPBDXZ @ 247 NONAME ; char const * Alf::AlfWidget::widgetName(void) const + ??0AlfElement@Alf@@IAE@XZ @ 248 NONAME ; Alf::AlfElement::AlfElement(void) + ?childRemoved@AlfGridLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 249 NONAME ; void Alf::AlfGridLayoutManager::childRemoved(class Alf::CAlfWidgetControl *) + ??1AlfCurvePathLayoutAttributeSetter@Alf@@UAE@XZ @ 250 NONAME ; Alf::AlfCurvePathLayoutAttributeSetter::~AlfCurvePathLayoutAttributeSetter(void) + ?brush@AlfVisualTemplate@Alf@@UBEAAVCAlfBrush@@H@Z @ 251 NONAME ; class CAlfBrush & Alf::AlfVisualTemplate::brush(int) const + ?createCommand@AlfCurvePathLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 252 NONAME ; class TAlfCommand * Alf::AlfCurvePathLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?addTargetValue@AlfAttribute@Alf@@QAEXPAVAlfAttributeValueType@2@@Z @ 253 NONAME ; void Alf::AlfAttribute::addTargetValue(class Alf::AlfAttributeValueType *) + ?attributeContainer@AlfVisualTemplate@Alf@@UBEAAVAlfAttributeContainer@2@H@Z @ 254 NONAME ; class Alf::AlfAttributeContainer & Alf::AlfVisualTemplate::attributeContainer(int) const + ?getTime@AlfAttribute@Alf@@QBEHXZ @ 255 NONAME ; int Alf::AlfAttribute::getTime(void) const + ??0AlfAttributeValueType@Alf@@QAE@HW4TAlfUnit@@@Z @ 256 NONAME ; Alf::AlfAttributeValueType::AlfAttributeValueType(int, enum TAlfUnit) + ??8AlfContainer@Alf@@QBE_NABVIAlfVariantType@1@@Z @ 257 NONAME ; bool Alf::AlfContainer::operator==(class Alf::IAlfVariantType const &) const + ?realValue@AlfAttribute@Alf@@QBEMI@Z @ 258 NONAME ; float Alf::AlfAttribute::realValue(unsigned int) const + ?getNewData@AlfModelOperation@Alf@@QAEPAVIAlfVariantType@2@XZ @ 259 NONAME ; class Alf::IAlfVariantType * Alf::AlfModelOperation::getNewData(void) + ?customData@AlfVariantType@Alf@@UAEPAVIAlfModelBase@2@XZ @ 260 NONAME ; class Alf::IAlfModelBase * Alf::AlfVariantType::customData(void) + ?findElement@CAlfWidgetControl@Alf@@UAEPAVIAlfElement@2@PBD@Z @ 261 NONAME ; class Alf::IAlfElement * Alf::CAlfWidgetControl::findElement(char const *) + ?setAttributeValue@AlfCommonLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 262 NONAME ; void Alf::AlfCommonLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?newData@AlfModelOperation@Alf@@QBEAAVIAlfVariantType@2@XZ @ 263 NONAME ; class Alf::IAlfVariantType & Alf::AlfModelOperation::newData(void) const + ??1AlfTextVisualAttributeSetter@Alf@@UAE@XZ @ 264 NONAME ; Alf::AlfTextVisualAttributeSetter::~AlfTextVisualAttributeSetter(void) + ??0AlfMap@Alf@@QAE@XZ @ 265 NONAME ; Alf::AlfMap::AlfMap(void) + ??8AlfVariantType@Alf@@QBE_NABVIAlfVariantType@1@@Z @ 266 NONAME ; bool Alf::AlfVariantType::operator==(class Alf::IAlfVariantType const &) const + ?setAttributeValue@AlfLineVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 267 NONAME ; void Alf::AlfLineVisualAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ??1AlfGridLayoutAttributeSetter@Alf@@UAE@XZ @ 268 NONAME ; Alf::AlfGridLayoutAttributeSetter::~AlfGridLayoutAttributeSetter(void) + ?RelinquishFocus@CAlfWidgetControl@Alf@@QAEXXZ @ 269 NONAME ; void Alf::CAlfWidgetControl::RelinquishFocus(void) + ?makeInterface@AlfVisualTemplate@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 270 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfVisualTemplate::makeInterface(struct Alf::IfId const &) + ??1AlfWidget@Alf@@UAE@XZ @ 271 NONAME ; Alf::AlfWidget::~AlfWidget(void) + ?real@AlfVariantType@Alf@@UBENXZ @ 272 NONAME ; double Alf::AlfVariantType::real(void) const + ?OfferEventL@CAlfWidgetControl@Alf@@EAEHABVTAlfEvent@@@Z @ 273 NONAME ; int Alf::CAlfWidgetControl::OfferEventL(class TAlfEvent const &) + ?elementDataId@CAlfWidgetControl@Alf@@UAEIABVIAlfElement@2@II@Z @ 274 NONAME ; unsigned int Alf::CAlfWidgetControl::elementDataId(class Alf::IAlfElement const &, unsigned int, unsigned int) + ?setName@AlfVisualTemplate@Alf@@UAEXPBD@Z @ 275 NONAME ; void Alf::AlfVisualTemplate::setName(char const *) + ?removeAttribute@AlfAttributeContainer@Alf@@QAEXI@Z @ 276 NONAME ; void Alf::AlfAttributeContainer::removeAttribute(unsigned int) + ?offerEvent@AlfRecyclingGridElement@Alf@@UAE?AW4AlfEventStatus@2@AAVCAlfWidgetControl@2@ABVTAlfEvent@@@Z @ 277 NONAME ; enum Alf::AlfEventStatus Alf::AlfRecyclingGridElement::offerEvent(class Alf::CAlfWidgetControl &, class TAlfEvent const &) + ?createCommand@AlfDeckLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 278 NONAME ; class TAlfCommand * Alf::AlfDeckLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?create@AlfVisualTemplate@Alf@@SAPAV12@XZ @ 279 NONAME ; class Alf::AlfVisualTemplate * Alf::AlfVisualTemplate::create(void) + ??1AlfContainer@Alf@@UAE@XZ @ 280 NONAME ; Alf::AlfContainer::~AlfContainer(void) + ?setInterpolationStyle@AlfAttribute@Alf@@QAEXW4TAlfInterpolationStyle@@@Z @ 281 NONAME ; void Alf::AlfAttribute::setInterpolationStyle(enum TAlfInterpolationStyle) + ?getInterpolationStyle@AlfAttribute@Alf@@QBE?AW4TAlfInterpolationStyle@@XZ @ 282 NONAME ; enum TAlfInterpolationStyle Alf::AlfAttribute::getInterpolationStyle(void) const + ?setAttributeValue@AlfFlowLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 283 NONAME ; void Alf::AlfFlowLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?updateChildLayout@AlfLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 284 NONAME ; void Alf::AlfLayoutManager::updateChildLayout(class Alf::CAlfWidgetControl *) + ?control@AlfWidget@Alf@@UBEPAVCAlfWidgetControl@2@XZ @ 285 NONAME ; class Alf::CAlfWidgetControl * Alf::AlfWidget::control(void) const + ?isContainer@CAlfWidgetControl@Alf@@QBE_NXZ @ 286 NONAME ; bool Alf::CAlfWidgetControl::isContainer(void) const + ??0AlfAttributeValueType@Alf@@QAE@ABVUString@osncore@@@Z @ 287 NONAME ; Alf::AlfAttributeValueType::AlfAttributeValueType(class osncore::UString const &) + ?addAttribute@AlfAttributeContainer@Alf@@QAEXPAVAlfAttribute@2@@Z @ 288 NONAME ; void Alf::AlfAttributeContainer::addAttribute(class Alf::AlfAttribute *) + ??1AlfLayoutManager@Alf@@UAE@XZ @ 289 NONAME ; Alf::AlfLayoutManager::~AlfLayoutManager(void) + ?setAttributeValue@AlfGridLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 290 NONAME ; void Alf::AlfGridLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?addWidgetStateOutput@AlfWidgetEventHandler@Alf@@QAEXABVUString@osncore@@II@Z @ 291 NONAME ; void Alf::AlfWidgetEventHandler::addWidgetStateOutput(class osncore::UString const &, unsigned int, unsigned int) + ?makeInterface@AlfWidget@Alf@@SAPAVIAlfInterfaceBase@2@PAV12@ABUIfId@2@@Z @ 292 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfWidget::makeInterface(class Alf::AlfWidget *, struct Alf::IfId const &) + ??0AlfAnchorLayoutAttributeSetter@Alf@@QAE@XZ @ 293 NONAME ; Alf::AlfAnchorLayoutAttributeSetter::AlfAnchorLayoutAttributeSetter(void) + ?string@AlfMap@Alf@@UBEABVUString@osncore@@XZ @ 294 NONAME ; class osncore::UString const & Alf::AlfMap::string(void) const + ?set@AlfMap@Alf@@UAEXAAVIAlfVariantType@2@@Z @ 295 NONAME ; void Alf::AlfMap::set(class Alf::IAlfVariantType &) + ??0AlfWidget@Alf@@QAE@PBDAAVIAlfContainerWidget@1@AAVCAlfEnv@@@Z @ 296 NONAME ; Alf::AlfWidget::AlfWidget(char const *, class Alf::IAlfContainerWidget &, class CAlfEnv &) + ??0AlfLayoutManager@Alf@@QAE@W4TAlfLayoutType@@@Z @ 297 NONAME ; Alf::AlfLayoutManager::AlfLayoutManager(enum TAlfLayoutType) + ?removePresentationEventHandlers@CAlfWidgetControl@Alf@@UAEXXZ @ 298 NONAME ; void Alf::CAlfWidgetControl::removePresentationEventHandlers(void) + ?setActiveStates@AlfRecyclingGridElement@Alf@@UAEXI@Z @ 299 NONAME ; void Alf::AlfRecyclingGridElement::setActiveStates(unsigned int) + ?addAnimationOutput@AlfWidgetEventHandler@Alf@@QAEXPAVAlfReferenceToVisual@2@0PAVIAlfAttributeSetter@2@PAVAlfAttributeContainer@2@II@Z @ 300 NONAME ; void Alf::AlfWidgetEventHandler::addAnimationOutput(class Alf::AlfReferenceToVisual *, class Alf::AlfReferenceToVisual *, class Alf::IAlfAttributeSetter *, class Alf::AlfAttributeContainer *, unsigned int, unsigned int) + ?removeTargetValue@AlfAttribute@Alf@@QAEXI@Z @ 301 NONAME ; void Alf::AlfAttribute::removeTargetValue(unsigned int) + ?create@AlfModelOperation@Alf@@SAPAV12@W4OperationType@12@HPAHPAVIAlfVariantType@2@ABVUString@osncore@@@Z @ 302 NONAME ; class Alf::AlfModelOperation * Alf::AlfModelOperation::create(enum Alf::AlfModelOperation::OperationType, int, int *, class Alf::IAlfVariantType *, class osncore::UString const &) + ?ContainerLayout@CAlfWidgetControl@Alf@@UBEPAVCAlfLayout@@PBVCAlfControl@@@Z @ 303 NONAME ; class CAlfLayout * Alf::CAlfWidgetControl::ContainerLayout(class CAlfControl const *) const + ?data@AlfModel@Alf@@UBEPAVIAlfVariantType@2@XZ @ 304 NONAME ; class Alf::IAlfVariantType * Alf::AlfModel::data(void) const + ?replaceItem@AlfContainer@Alf@@UAEXIPAVIAlfVariantType@2@@Z @ 305 NONAME ; void Alf::AlfContainer::replaceItem(unsigned int, class Alf::IAlfVariantType *) + ?numBrushes@AlfVisualTemplate@Alf@@UBEHXZ @ 306 NONAME ; int Alf::AlfVisualTemplate::numBrushes(void) const + ??0AlfAttribute@Alf@@QAE@PBDW4attributecategory@01@@Z @ 307 NONAME ; Alf::AlfAttribute::AlfAttribute(char const *, enum Alf::AlfAttribute::attributecategory) + ?doUpdateChildLayout@AlfLayoutManager@Alf@@MAEXPAVCAlfWidgetControl@2@@Z @ 308 NONAME ; void Alf::AlfLayoutManager::doUpdateChildLayout(class Alf::CAlfWidgetControl *) + ?type@AlfContainer@Alf@@UBE?AW4Type@IAlfVariantType@2@XZ @ 309 NONAME ; enum Alf::IAlfVariantType::Type Alf::AlfContainer::type(void) const + ?clone@AlfBranch@Alf@@UAEPAVIAlfBranch@2@XZ @ 310 NONAME ; class Alf::IAlfBranch * Alf::AlfBranch::clone(void) + ?setParentElement@AlfElement@Alf@@UAEXAAVIAlfElement@2@@Z @ 311 NONAME ; void Alf::AlfElement::setParentElement(class Alf::IAlfElement &) + ?setOwner@AlfVisualTemplate@Alf@@UAEXPAVIAlfElement@2@@Z @ 312 NONAME ; void Alf::AlfVisualTemplate::setOwner(class Alf::IAlfElement *) + ?addEventPasserOutput@AlfWidgetEventHandler@Alf@@QAEXPBD0@Z @ 313 NONAME ; void Alf::AlfWidgetEventHandler::addEventPasserOutput(char const *, char const *) + ?setTargetValue@AlfAttribute@Alf@@QAEXPAVAlfAttributeValueType@2@I@Z @ 314 NONAME ; void Alf::AlfAttribute::setTargetValue(class Alf::AlfAttributeValueType *, unsigned int) + ??8AlfBranch@Alf@@QBE_NABVIAlfVariantType@1@@Z @ 315 NONAME ; bool Alf::AlfBranch::operator==(class Alf::IAlfVariantType const &) const + ?container@AlfVariantType@Alf@@UAEPAVIAlfContainer@2@XZ @ 316 NONAME ; class Alf::IAlfContainer * Alf::AlfVariantType::container(void) + ?eventHandlerData@AlfRecyclingGridElement@Alf@@UAEPAUAlfWidgetEventHandlerInitData@2@XZ @ 317 NONAME ; struct Alf::AlfWidgetEventHandlerInitData * Alf::AlfRecyclingGridElement::eventHandlerData(void) + ?numElements@CAlfWidgetControl@Alf@@UBEHXZ @ 318 NONAME ; int Alf::CAlfWidgetControl::numElements(void) const + ?getLastFocusable@CAlfWidgetControl@Alf@@MAEPAV12@AAVIAlfContainerWidget@2@@Z @ 319 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::getLastFocusable(class Alf::IAlfContainerWidget &) + ??1AlfFlowLayoutManager@Alf@@UAE@XZ @ 320 NONAME ; Alf::AlfFlowLayoutManager::~AlfFlowLayoutManager(void) + ?type@AlfVariantType@Alf@@UBE?AW4Type@IAlfVariantType@2@XZ @ 321 NONAME ; enum Alf::IAlfVariantType::Type Alf::AlfVariantType::type(void) const + ?disableState@CAlfWidgetControl@Alf@@UAEXI@Z @ 322 NONAME ; void Alf::CAlfWidgetControl::disableState(unsigned int) + ?count@AlfLayoutManager@Alf@@QBEHXZ @ 323 NONAME ; int Alf::AlfLayoutManager::count(void) const + ?setAnimationTimes@AlfRecyclingGridElement@Alf@@QAEXHHHHH@Z @ 324 NONAME ; void Alf::AlfRecyclingGridElement::setAnimationTimes(int, int, int, int, int) + ?removeAndDestroyPresentationEventHandlers@CAlfWidgetControl@Alf@@UAEXXZ @ 325 NONAME ; void Alf::CAlfWidgetControl::removeAndDestroyPresentationEventHandlers(void) + ?eventHandlerIndex@CAlfWidgetControl@Alf@@UBEHAAVIAlfWidgetEventHandler@2@@Z @ 326 NONAME ; int Alf::CAlfWidgetControl::eventHandlerIndex(class Alf::IAlfWidgetEventHandler &) const + ?addEventPasserOutput@AlfWidgetEventHandler@Alf@@QAEXPBD0HH@Z @ 327 NONAME ; void Alf::AlfWidgetEventHandler::addEventPasserOutput(char const *, char const *, int, int) + ?createCommand@AlfCommonLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 328 NONAME ; class TAlfCommand * Alf::AlfCommonLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?updateData@AlfModel@Alf@@UAEXHPAHPAVIAlfVariantType@2@@Z @ 329 NONAME ; void Alf::AlfModel::updateData(int, int *, class Alf::IAlfVariantType *) + ?addOutput@AlfWidgetEventHandler@Alf@@QAEXHHPBDI@Z @ 330 NONAME ; void Alf::AlfWidgetEventHandler::addOutput(int, int, char const *, unsigned int) + ?createCommand@AlfTextVisualAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 331 NONAME ; class TAlfCommand * Alf::AlfTextVisualAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ??0AlfAnimationOutput@Alf@@QAE@PAVAlfReferenceToVisual@1@0PAVIAlfAttributeSetter@1@PAVAlfAttributeContainer@1@II@Z @ 332 NONAME ; Alf::AlfAnimationOutput::AlfAnimationOutput(class Alf::AlfReferenceToVisual *, class Alf::AlfReferenceToVisual *, class Alf::IAlfAttributeSetter *, class Alf::AlfAttributeContainer *, unsigned int, unsigned int) + ?data@AlfBranch@Alf@@UAEPAVIAlfMap@2@XZ @ 333 NONAME ; class Alf::IAlfMap * Alf::AlfBranch::data(void) + ??1AlfAttribute@Alf@@UAE@XZ @ 334 NONAME ; Alf::AlfAttribute::~AlfAttribute(void) + ?sort@AlfContainer@Alf@@UAEXABVIAlfSortFunction@2@@Z @ 335 NONAME ; void Alf::AlfContainer::sort(class Alf::IAlfSortFunction const &) + ?doUpdateChildLayout@AlfGridLayoutManager@Alf@@MAEXPAVCAlfWidgetControl@2@@Z @ 336 NONAME ; void Alf::AlfGridLayoutManager::doUpdateChildLayout(class Alf::CAlfWidgetControl *) + ?type@AlfAttributeContainer@Alf@@QBE?AW4Type@12@XZ @ 337 NONAME ; enum Alf::AlfAttributeContainer::Type Alf::AlfAttributeContainer::type(void) const + ?stringValue@AlfAttribute@Alf@@QBEABVUString@osncore@@I@Z @ 338 NONAME ; class osncore::UString const & Alf::AlfAttribute::stringValue(unsigned int) const + ?destroyChildTemplate@AlfVisualTemplate@Alf@@UAEXPBD@Z @ 339 NONAME ; void Alf::AlfVisualTemplate::destroyChildTemplate(char const *) + ?parentElement@AlfElement@Alf@@UBEPBVIAlfElement@2@XZ @ 340 NONAME ; class Alf::IAlfElement const * Alf::AlfElement::parentElement(void) const + ?addEventPasserInput@AlfWidgetEventHandler@Alf@@QAEXHH@Z @ 341 NONAME ; void Alf::AlfWidgetEventHandler::addEventPasserInput(int, int) + ?setControlPosition@AlfLayoutManager@Alf@@IAEXAAVCAlfWidgetControl@2@ABUTAlfRealPoint@@@Z @ 342 NONAME ; void Alf::AlfLayoutManager::setControlPosition(class Alf::CAlfWidgetControl &, struct TAlfRealPoint const &) + ??0AlfWidget@Alf@@IAE@XZ @ 343 NONAME ; Alf::AlfWidget::AlfWidget(void) + ?customData@AlfContainer@Alf@@UAEPAVIAlfModelBase@2@XZ @ 344 NONAME ; class Alf::IAlfModelBase * Alf::AlfContainer::customData(void) + ?addItem@AlfContainer@Alf@@UAEXPAVIAlfVariantType@2@@Z @ 345 NONAME ; void Alf::AlfContainer::addItem(class Alf::IAlfVariantType *) + ?updateChildLayout@AlfFlowLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 346 NONAME ; void Alf::AlfFlowLayoutManager::updateChildLayout(class Alf::CAlfWidgetControl *) + ?isFocusable@CAlfWidgetControl@Alf@@QBE_NXZ @ 347 NONAME ; bool Alf::CAlfWidgetControl::isFocusable(void) const + ?clearModel@AlfModel@Alf@@UAEXXZ @ 348 NONAME ; void Alf::AlfModel::clearModel(void) + ?element@CAlfWidgetControl@Alf@@UAEAAVIAlfElement@2@H@Z @ 349 NONAME ; class Alf::IAlfElement & Alf::CAlfWidgetControl::element(int) + ??0AlfViewportLayoutAttributeSetter@Alf@@QAE@XZ @ 350 NONAME ; Alf::AlfViewportLayoutAttributeSetter::AlfViewportLayoutAttributeSetter(void) + ?removeWidget@AlfWidget@Alf@@QAEXAAVIAlfWidget@2@@Z @ 351 NONAME ; void Alf::AlfWidget::removeWidget(class Alf::IAlfWidget &) + ?realValue@AlfAttributeValueType@Alf@@UBEMXZ @ 352 NONAME ; float Alf::AlfAttributeValueType::realValue(void) const + ?handleEvent@CAlfWidgetControl@Alf@@UAE?AW4AlfEventStatus@2@ABVTAlfEvent@@@Z @ 353 NONAME ; enum Alf::AlfEventStatus Alf::CAlfWidgetControl::handleEvent(class TAlfEvent const &) + ?clone@AlfAttribute@Alf@@QAEPAV12@XZ @ 354 NONAME ; class Alf::AlfAttribute * Alf::AlfAttribute::clone(void) + ?setDataField@AlfAttribute@Alf@@QAEXPBD@Z @ 355 NONAME ; void Alf::AlfAttribute::setDataField(char const *) + ?childrenCount@AlfBranch@Alf@@UAEIXZ @ 356 NONAME ; unsigned int Alf::AlfBranch::childrenCount(void) + ?addAnimationCancelOutput@AlfWidgetEventHandler@Alf@@QAEXPBD0W4TAlfOp@@_N@Z @ 357 NONAME ; void Alf::AlfWidgetEventHandler::addAnimationCancelOutput(char const *, char const *, enum TAlfOp, bool) + ?container@AlfMap@Alf@@UAEPAVIAlfContainer@2@XZ @ 358 NONAME ; class Alf::IAlfContainer * Alf::AlfMap::container(void) + ??0AlfVisualTemplate@Alf@@IAE@W4TAlfLayoutType@@@Z @ 359 NONAME ; Alf::AlfVisualTemplate::AlfVisualTemplate(enum TAlfLayoutType) + ??0AlfMeshVisualAttributeSetter@Alf@@QAE@XZ @ 360 NONAME ; Alf::AlfMeshVisualAttributeSetter::AlfMeshVisualAttributeSetter(void) + ?setDefaultParentLayout@AlfElement@Alf@@QAEXPAVAlfReferenceToVisual@2@@Z @ 361 NONAME ; void Alf::AlfElement::setDefaultParentLayout(class Alf::AlfReferenceToVisual *) + ?clear@AlfMap@Alf@@UAEXXZ @ 362 NONAME ; void Alf::AlfMap::clear(void) + ?addTactileOutput@AlfWidgetEventHandler@Alf@@QAEXW4WidgetTactileFeedbackType@2@@Z @ 363 NONAME ; void Alf::AlfWidgetEventHandler::addTactileOutput(enum Alf::WidgetTactileFeedbackType) + ?setAttributeValue@AlfCurvePathLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@@Z @ 364 NONAME ; void Alf::AlfCurvePathLayoutAttributeSetter::setAttributeValue(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *) + ?addModelChangeObserver@AlfModel@Alf@@UAEXAAVIAlfModelChangeObserver@2@@Z @ 365 NONAME ; void Alf::AlfModel::addModelChangeObserver(class Alf::IAlfModelChangeObserver &) + ?resolve@AlfReferenceToVisual@Alf@@QAEPAVCAlfVisual@@AAVCAlfWidgetControl@2@I@Z @ 366 NONAME ; class CAlfVisual * Alf::AlfReferenceToVisual::resolve(class Alf::CAlfWidgetControl &, unsigned int) + ?updateChildLayout@AlfAnchorLayoutManager@Alf@@UAEXPAVCAlfWidgetControl@2@@Z @ 367 NONAME ; void Alf::AlfAnchorLayoutManager::updateChildLayout(class Alf::CAlfWidgetControl *) + ?makeInterface@AlfCommonAttributeSetter@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 368 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfCommonAttributeSetter::makeInterface(struct Alf::IfId const &) + ?createCommand@AlfCommonVisualAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 369 NONAME ; class TAlfCommand * Alf::AlfCommonVisualAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?create@AlfReferenceToVisual@Alf@@SAPAV12@PBD0_N@Z @ 370 NONAME ; class Alf::AlfReferenceToVisual * Alf::AlfReferenceToVisual::create(char const *, char const *, bool) + ?createAndSendCommands@AlfCommonLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 371 NONAME ; void Alf::AlfCommonLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?destroyVisualsAndElements@CAlfWidgetControl@Alf@@UAEXH@Z @ 372 NONAME ; void Alf::CAlfWidgetControl::destroyVisualsAndElements(int) + ?setDataIdRange@CAlfWidgetControl@Alf@@UAEXABVIAlfElement@2@I@Z @ 373 NONAME ; void Alf::CAlfWidgetControl::setDataIdRange(class Alf::IAlfElement const &, unsigned int) + ?createCommand@AlfCommonAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 374 NONAME ; class TAlfCommand * Alf::AlfCommonAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?childData@AlfBranch@Alf@@UAEPAVIAlfMap@2@XZ @ 375 NONAME ; class Alf::IAlfMap * Alf::AlfBranch::childData(void) + ?setChildFocus@AlfWidget@Alf@@UAEX_N@Z @ 376 NONAME ; void Alf::AlfWidget::setChildFocus(bool) + ?getTargetValueCount@AlfAttribute@Alf@@QBEIXZ @ 377 NONAME ; unsigned int Alf::AlfAttribute::getTargetValueCount(void) const + ?addAttributeSetter@AlfVisualTemplate@Alf@@UAEXPAVIAlfAttributeSetter@2@PAVAlfAttributeContainer@2@@Z @ 378 NONAME ; void Alf::AlfVisualTemplate::addAttributeSetter(class Alf::IAlfAttributeSetter *, class Alf::AlfAttributeContainer *) + ?state@CAlfWidgetControl@Alf@@UBEIXZ @ 379 NONAME ; unsigned int Alf::CAlfWidgetControl::state(void) const + ?operation@AlfModelOperation@Alf@@QBE?AW4OperationType@12@XZ @ 380 NONAME ; enum Alf::AlfModelOperation::OperationType Alf::AlfModelOperation::operation(void) const + ?removeItem@AlfMap@Alf@@UAEXABVUString@osncore@@@Z @ 381 NONAME ; void Alf::AlfMap::removeItem(class osncore::UString const &) + ?getVisualTemplate@AlfElement@Alf@@UBEPAVIAlfVisualTemplate@2@XZ @ 382 NONAME ; class Alf::IAlfVisualTemplate * Alf::AlfElement::getVisualTemplate(void) const + ?itemIndex@AlfMap@Alf@@UAEHABVUString@osncore@@@Z @ 383 NONAME ; int Alf::AlfMap::itemIndex(class osncore::UString const &) + ??1AlfElement@Alf@@UAE@XZ @ 384 NONAME ; Alf::AlfElement::~AlfElement(void) + ??0AlfAttributeContainer@Alf@@QAE@W4Type@01@@Z @ 385 NONAME ; Alf::AlfAttributeContainer::AlfAttributeContainer(enum Alf::AlfAttributeContainer::Type) + ?removeAndDestroyVisuals@AlfElement@Alf@@UAEXH@Z @ 386 NONAME ; void Alf::AlfElement::removeAndDestroyVisuals(int) + ?executeOperation@AlfModel@Alf@@UAEXPAVAlfModelOperation@2@@Z @ 387 NONAME ; void Alf::AlfModel::executeOperation(class Alf::AlfModelOperation *) + ?getWidgetIndex@AlfWidget@Alf@@UBEHAAVIAlfWidget@2@@Z @ 388 NONAME ; int Alf::AlfWidget::getWidgetIndex(class Alf::IAlfWidget &) const + ??0AlfFlowLayoutManager@Alf@@QAE@XZ @ 389 NONAME ; Alf::AlfFlowLayoutManager::AlfFlowLayoutManager(void) + ?addWidgetAttributeOutput@AlfWidgetEventHandler@Alf@@QAEXAAVUString@osncore@@PAVAlfAttributeValueType@2@PBD@Z @ 390 NONAME ; void Alf::AlfWidgetEventHandler::addWidgetAttributeOutput(class osncore::UString &, class Alf::AlfAttributeValueType *, char const *) + ?addData@AlfModel@Alf@@UAEXHPAHPAVIAlfVariantType@2@@Z @ 391 NONAME ; void Alf::AlfModel::addData(int, int *, class Alf::IAlfVariantType *) + ?addChildTemplate@AlfVisualTemplate@Alf@@UAEXAAVIAlfVisualTemplate@2@@Z @ 392 NONAME ; void Alf::AlfVisualTemplate::addChildTemplate(class Alf::IAlfVisualTemplate &) + ?clear@AlfContainer@Alf@@UAEXXZ @ 393 NONAME ; void Alf::AlfContainer::clear(void) + ??4AlfAttribute@Alf@@QAEAAV01@ABV01@@Z @ 394 NONAME ; class Alf::AlfAttribute & Alf::AlfAttribute::operator=(class Alf::AlfAttribute const &) + ?name@AlfAttribute@Alf@@QBEPBDXZ @ 395 NONAME ; char const * Alf::AlfAttribute::name(void) const + ?createAndSendCommands@AlfGridLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 396 NONAME ; void Alf::AlfGridLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?removeChildVisualTree@AlfElement@Alf@@UAEXPAVIAlfElement@2@AAVIAlfBranch@2@HI@Z @ 397 NONAME ; void Alf::AlfElement::removeChildVisualTree(class Alf::IAlfElement *, class Alf::IAlfBranch &, int, unsigned int) + ?parent@AlfWidget@Alf@@UBEPAVIAlfContainerWidget@2@XZ @ 398 NONAME ; class Alf::IAlfContainerWidget * Alf::AlfWidget::parent(void) const + ?addSourceValue@AlfAttribute@Alf@@QAEXPAVAlfAttributeValueType@2@@Z @ 399 NONAME ; void Alf::AlfAttribute::addSourceValue(class Alf::AlfAttributeValueType *) + ?FocusChanged@CAlfWidgetControl@Alf@@MAEXAAVCAlfDisplay@@H@Z @ 400 NONAME ; void Alf::CAlfWidgetControl::FocusChanged(class CAlfDisplay &, int) + ?makeInterface@AlfElement@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 401 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfElement::makeInterface(struct Alf::IfId const &) + ?addAppEventOutput@AlfWidgetEventHandler@Alf@@QAEXABVUString@osncore@@AAVIAlfAppEventListener@2@@Z @ 402 NONAME ; void Alf::AlfWidgetEventHandler::addAppEventOutput(class osncore::UString const &, class Alf::IAlfAppEventListener &) + ?defaultParentLayout@AlfElement@Alf@@UAEPAVCAlfLayout@@I@Z @ 403 NONAME ; class CAlfLayout * Alf::AlfElement::defaultParentLayout(unsigned int) + ?setControlRect@AlfLayoutManager@Alf@@IAEXAAVCAlfWidgetControl@2@ABUTAlfRealRect@@@Z @ 404 NONAME ; void Alf::AlfLayoutManager::setControlRect(class Alf::CAlfWidgetControl &, struct TAlfRealRect const &) + ?makeInterface@AlfRecyclingGridElement@Alf@@UAEPAVIAlfInterfaceBase@2@ABUIfId@2@@Z @ 405 NONAME ; class Alf::IAlfInterfaceBase * Alf::AlfRecyclingGridElement::makeInterface(struct Alf::IfId const &) + ?previousFocusableControl@CAlfWidgetControl@Alf@@AAEPAV12@PAV12@@Z @ 406 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::previousFocusableControl(class Alf::CAlfWidgetControl *) + ?setChildData@AlfBranch@Alf@@UAEXPAVIAlfMap@2@@Z @ 407 NONAME ; void Alf::AlfBranch::setChildData(class Alf::IAlfMap *) + ?setControl@AlfWidget@Alf@@UAEXPAVCAlfWidgetControl@2@_N@Z @ 408 NONAME ; void Alf::AlfWidget::setControl(class Alf::CAlfWidgetControl *, bool) + ??2CAlfWidgetControl@Alf@@SAPAXIW4newarg@@@Z @ 409 NONAME ; void * Alf::CAlfWidgetControl::operator new(unsigned int, enum newarg) + ?enableState@CAlfWidgetControl@Alf@@UAEXI@Z @ 410 NONAME ; void Alf::CAlfWidgetControl::enableState(unsigned int) + ?themeManagerUtil@AlfWidgetEnvExtension@Alf@@SAAAVAlfThemeManagerUtil@2@AAVCAlfEnv@@@Z @ 411 NONAME ; class Alf::AlfThemeManagerUtil & Alf::AlfWidgetEnvExtension::themeManagerUtil(class CAlfEnv &) + ??1AlfMeshVisualAttributeSetter@Alf@@UAE@XZ @ 412 NONAME ; Alf::AlfMeshVisualAttributeSetter::~AlfMeshVisualAttributeSetter(void) + ?createLayout@AlfLayoutManager@Alf@@UAEXAAVCAlfWidgetControl@2@PAVCAlfLayout@@H@Z @ 413 NONAME ; void Alf::AlfLayoutManager::createLayout(class Alf::CAlfWidgetControl &, class CAlfLayout *, int) + ?sendCommand@AlfAnimationOutput@Alf@@QAEXAAVCAlfWidgetControl@2@I@Z @ 414 NONAME ; void Alf::AlfAnimationOutput::sendCommand(class Alf::CAlfWidgetControl &, unsigned int) + ??0AlfBranch@Alf@@QAE@XZ @ 415 NONAME ; Alf::AlfBranch::AlfBranch(void) + ?set@AlfBranch@Alf@@UAEXAAVIAlfVariantType@2@@Z @ 416 NONAME ; void Alf::AlfBranch::set(class Alf::IAlfVariantType &) + ?unit@AlfAttribute@Alf@@UBE?AW4TAlfUnit@@I@Z @ 417 NONAME ; enum TAlfUnit Alf::AlfAttribute::unit(unsigned int) const + ?resolve@AlfReferenceToVisual@Alf@@QAEPAVCAlfVisual@@AAVCAlfWidgetControl@2@PAV3@@Z @ 418 NONAME ; class CAlfVisual * Alf::AlfReferenceToVisual::resolve(class Alf::CAlfWidgetControl &, class CAlfVisual *) + ?real@AlfBranch@Alf@@UBENXZ @ 419 NONAME ; double Alf::AlfBranch::real(void) const + ?layoutType@AlfVisualTemplate@Alf@@UBEHXZ @ 420 NONAME ; int Alf::AlfVisualTemplate::layoutType(void) const + ?contains@AlfElement@Alf@@UBE_NAAVCAlfVisual@@@Z @ 421 NONAME ; bool Alf::AlfElement::contains(class CAlfVisual &) const + ?boolean@AlfMap@Alf@@UBE_NXZ @ 422 NONAME ; bool Alf::AlfMap::boolean(void) const + ?create@AlfVisualTemplate@Alf@@SAPAV12@W4TAlfLayoutType@@@Z @ 423 NONAME ; class Alf::AlfVisualTemplate * Alf::AlfVisualTemplate::create(enum TAlfLayoutType) + ?construct@AlfElement@Alf@@IAEXAAVCAlfWidgetControl@2@PBD@Z @ 424 NONAME ; void Alf::AlfElement::construct(class Alf::CAlfWidgetControl &, char const *) + ?createCommand@AlfAnchorLayoutAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 425 NONAME ; class TAlfCommand * Alf::AlfAnchorLayoutAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?removeAndDestroyEventHandler@CAlfWidgetControl@Alf@@UAEXAAVIAlfWidgetEventHandler@2@@Z @ 426 NONAME ; void Alf::CAlfWidgetControl::removeAndDestroyEventHandler(class Alf::IAlfWidgetEventHandler &) + ?getFocusableAfter@CAlfWidgetControl@Alf@@MAEPAV12@AAVIAlfContainerWidget@2@AAV12@@Z @ 427 NONAME ; class Alf::CAlfWidgetControl * Alf::CAlfWidgetControl::getFocusableAfter(class Alf::IAlfContainerWidget &, class Alf::CAlfWidgetControl &) + ??1AlfModel@Alf@@UAE@XZ @ 428 NONAME ; Alf::AlfModel::~AlfModel(void) + ?containerIndex@AlfModelOperation@Alf@@QBEHH@Z @ 429 NONAME ; int Alf::AlfModelOperation::containerIndex(int) const + ?updateDataIDs@AlfElement@Alf@@UAEXAAVIAlfBranch@2@HHII@Z @ 430 NONAME ; void Alf::AlfElement::updateDataIDs(class Alf::IAlfBranch &, int, int, unsigned int, unsigned int) + ?controlRect@AlfLayoutManager@Alf@@IAE_NAAVCAlfWidgetControl@2@AAUTAlfRealRect@@@Z @ 431 NONAME ; bool Alf::AlfLayoutManager::controlRect(class Alf::CAlfWidgetControl &, struct TAlfRealRect &) + ?setterType@AlfCommonAttributeSetter@Alf@@UAE?AW4SetterType@@XZ @ 432 NONAME ; enum SetterType Alf::AlfCommonAttributeSetter::setterType(void) + ?enableDirtyCheck@AlfCommonAttributeSetter@Alf@@QAEX_N@Z @ 433 NONAME ; void Alf::AlfCommonAttributeSetter::enableDirtyCheck(bool) + ?removeVisualTemplate@AlfElement@Alf@@UAEPAVIAlfVisualTemplate@2@XZ @ 434 NONAME ; class Alf::IAlfVisualTemplate * Alf::AlfElement::removeVisualTemplate(void) + ??0AlfCommonVisualAttributeSetter@Alf@@QAE@XZ @ 435 NONAME ; Alf::AlfCommonVisualAttributeSetter::AlfCommonVisualAttributeSetter(void) + ?dataChanging@CAlfWidgetControl@Alf@@UAEXABVAlfModelOperation@2@@Z @ 436 NONAME ; void Alf::CAlfWidgetControl::dataChanging(class Alf::AlfModelOperation const &) + ?applyLayout@AlfWidget@Alf@@UAEXAAVIAlfLayoutManager@2@@Z @ 437 NONAME ; void Alf::AlfWidget::applyLayout(class Alf::IAlfLayoutManager &) + ?dataChanging@CAlfWidgetControl@Alf@@UAEXABV?$AlfPtrVector@VAlfModelOperation@Alf@@@osncore@@@Z @ 438 NONAME ; void Alf::CAlfWidgetControl::dataChanging(class osncore::AlfPtrVector const &) + ?branch@AlfBranch@Alf@@UAEPAVIAlfBranch@2@XZ @ 439 NONAME ; class Alf::IAlfBranch * Alf::AlfBranch::branch(void) + ?dataChanged@CAlfWidgetControl@Alf@@UAEXXZ @ 440 NONAME ; void Alf::CAlfWidgetControl::dataChanged(void) + ??0AlfVariantType@Alf@@QAE@PAVIAlfModelBase@1@@Z @ 441 NONAME ; Alf::AlfVariantType::AlfVariantType(class Alf::IAlfModelBase *) + ?parentData@AlfModelOperation@Alf@@QBEPAVIAlfVariantType@2@AAV32@@Z @ 442 NONAME ; class Alf::IAlfVariantType * Alf::AlfModelOperation::parentData(class Alf::IAlfVariantType &) const + ?createAndSendCommands@AlfLineVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 443 NONAME ; void Alf::AlfLineVisualAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?createCommand@AlfMeshVisualAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 444 NONAME ; class TAlfCommand * Alf::AlfMeshVisualAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ??1AlfCommonAttributeSetter@Alf@@UAE@XZ @ 445 NONAME ; Alf::AlfCommonAttributeSetter::~AlfCommonAttributeSetter(void) + ??0AlfModel@Alf@@QAE@XZ @ 446 NONAME ; Alf::AlfModel::AlfModel(void) + ?boolean@AlfBranch@Alf@@UBE_NXZ @ 447 NONAME ; bool Alf::AlfBranch::boolean(void) const + ??1AlfImageVisualAttributeSetter@Alf@@UAE@XZ @ 448 NONAME ; Alf::AlfImageVisualAttributeSetter::~AlfImageVisualAttributeSetter(void) + ?getDelay@AlfAttribute@Alf@@QBEHXZ @ 449 NONAME ; int Alf::AlfAttribute::getDelay(void) const + ?item@AlfContainer@Alf@@UAEPAVIAlfVariantType@2@I@Z @ 450 NONAME ; class Alf::IAlfVariantType * Alf::AlfContainer::item(unsigned int) + ?updateParentLayout@CAlfWidgetControl@Alf@@QAEXXZ @ 451 NONAME ; void Alf::CAlfWidgetControl::updateParentLayout(void) + ?createAndSendCommands@AlfTextVisualAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 452 NONAME ; void Alf::AlfTextVisualAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?create@AlfModelOperation@Alf@@SAPAV12@W4OperationType@12@HPAHPAVIAlfVariantType@2@@Z @ 453 NONAME ; class Alf::AlfModelOperation * Alf::AlfModelOperation::create(enum Alf::AlfModelOperation::OperationType, int, int *, class Alf::IAlfVariantType *) + ??0AlfDeckLayoutAttributeSetter@Alf@@QAE@XZ @ 454 NONAME ; Alf::AlfDeckLayoutAttributeSetter::AlfDeckLayoutAttributeSetter(void) + ?createAndSendCommands@AlfDeckLayoutAttributeSetter@Alf@@UAEXAAVCAlfVisual@@PAVAlfAttributeContainer@2@PAV3@@Z @ 455 NONAME ; void Alf::AlfDeckLayoutAttributeSetter::createAndSendCommands(class CAlfVisual &, class Alf::AlfAttributeContainer *, class CAlfVisual *) + ?elementData@CAlfWidgetControl@Alf@@UAEPAVIAlfVariantType@2@ABVIAlfElement@2@I@Z @ 456 NONAME ; class Alf::IAlfVariantType * Alf::CAlfWidgetControl::elementData(class Alf::IAlfElement const &, unsigned int) + ??1AlfAnchorLayoutAttributeSetter@Alf@@UAE@XZ @ 457 NONAME ; Alf::AlfAnchorLayoutAttributeSetter::~AlfAnchorLayoutAttributeSetter(void) + ?createCommand@AlfImageVisualAttributeSetter@Alf@@UAEPAVTAlfCommand@@AAVCAlfVisual@@PAVAlfAttributeContainer@2@PAVIAlfMap@2@HPAV4@@Z @ 458 NONAME ; class TAlfCommand * Alf::AlfImageVisualAttributeSetter::createCommand(class CAlfVisual &, class Alf::AlfAttributeContainer *, class Alf::IAlfMap *, int, class CAlfVisual *) + ?newDataName@AlfModelOperation@Alf@@QBEABVUString@osncore@@XZ @ 459 NONAME ; class osncore::UString const & Alf::AlfModelOperation::newDataName(void) const + ?widgetFactory@AlfWidgetEnvExtension@Alf@@SAAAVIAlfWidgetFactory@2@AAVCAlfEnv@@@Z @ 460 NONAME ; class Alf::IAlfWidgetFactory & Alf::AlfWidgetEnvExtension::widgetFactory(class CAlfEnv &) + ?name@AlfElement@Alf@@UBEPBDXZ @ 461 NONAME ; char const * Alf::AlfElement::name(void) const + ?setVisualTemplate@AlfElement@Alf@@UAEXAAVIAlfVisualTemplate@2@@Z @ 462 NONAME ; void Alf::AlfElement::setVisualTemplate(class Alf::IAlfVisualTemplate &) + ?clone@AlfMap@Alf@@UAEPAVIAlfMap@2@XZ @ 463 NONAME ; class Alf::IAlfMap * Alf::AlfMap::clone(void) + ?owner@AlfVisualTemplate@Alf@@UBEPAVIAlfElement@2@XZ @ 464 NONAME ; class Alf::IAlfElement * Alf::AlfVisualTemplate::owner(void) const + ?removeModelChangeObserver@AlfModel@Alf@@UAEXAAVIAlfModelChangeObserver@2@@Z @ 465 NONAME ; void Alf::AlfModel::removeModelChangeObserver(class Alf::IAlfModelChangeObserver &) + ?getControl@AlfLayoutManager@Alf@@QBEPAVCAlfWidgetControl@2@H@Z @ 466 NONAME ; class Alf::CAlfWidgetControl * Alf::AlfLayoutManager::getControl(int) const + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/eabi/alfwidgetmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/eabi/alfwidgetmodelu.def Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,715 @@ +EXPORTS + _ZN3Alf10AlfElement10findVisualEPKcj @ 1 NONAME + _ZN3Alf10AlfElement10findVisualEj @ 2 NONAME + _ZN3Alf10AlfElement13addVisualTreeEP10CAlfVisualj @ 3 NONAME + _ZN3Alf10AlfElement13makeInterfaceERKNS_4IfIdE @ 4 NONAME + _ZN3Alf10AlfElement13updateDataIDsERNS_10IAlfBranchEiijj @ 5 NONAME + _ZN3Alf10AlfElement16createVisualTreeERNS_15IAlfVariantTypeERNS_10IAlfBranchEijP10CAlfLayouti @ 6 NONAME + _ZN3Alf10AlfElement16createVisualTreeERNS_15IAlfVariantTypeEjP10CAlfLayouti @ 7 NONAME + _ZN3Alf10AlfElement16removeVisualTreeERNS_10IAlfBranchEij @ 8 NONAME + _ZN3Alf10AlfElement16removeVisualTreeERNS_15IAlfVariantTypeEj @ 9 NONAME + _ZN3Alf10AlfElement16setParentElementERNS_11IAlfElementE @ 10 NONAME + _ZN3Alf10AlfElement16updateVisualTreeERNS_15IAlfVariantTypeES2_j @ 11 NONAME + _ZN3Alf10AlfElement17replaceVisualTreeERNS_15IAlfVariantTypeEjj @ 12 NONAME + _ZN3Alf10AlfElement17setVisualTemplateERNS_18IAlfVisualTemplateE @ 13 NONAME + _ZN3Alf10AlfElement19defaultParentLayoutEj @ 14 NONAME + _ZN3Alf10AlfElement20removeVisualTemplateEv @ 15 NONAME + _ZN3Alf10AlfElement21createChildVisualTreeEPNS_11IAlfElementERNS_15IAlfVariantTypeERNS_10IAlfBranchEij @ 16 NONAME + _ZN3Alf10AlfElement21destroyVisualTemplateEv @ 17 NONAME + _ZN3Alf10AlfElement21removeChildVisualTreeEPNS_11IAlfElementERNS_10IAlfBranchEij @ 18 NONAME + _ZN3Alf10AlfElement22setDefaultParentLayoutEPNS_20AlfReferenceToVisualE @ 19 NONAME + _ZN3Alf10AlfElement23removeAndDestroyVisualsEi @ 20 NONAME + _ZN3Alf10AlfElement7controlEv @ 21 NONAME + _ZN3Alf10AlfElement9constructERNS_17CAlfWidgetControlEPKc @ 22 NONAME + _ZN3Alf10AlfElementC1ERNS_17CAlfWidgetControlEPKc @ 23 NONAME + _ZN3Alf10AlfElementC1Ev @ 24 NONAME + _ZN3Alf10AlfElementC2ERNS_17CAlfWidgetControlEPKc @ 25 NONAME + _ZN3Alf10AlfElementC2Ev @ 26 NONAME + _ZN3Alf10AlfElementD0Ev @ 27 NONAME + _ZN3Alf10AlfElementD1Ev @ 28 NONAME + _ZN3Alf10AlfElementD2Ev @ 29 NONAME + _ZN3Alf12AlfAttribute12setDataFieldEPKc @ 30 NONAME + _ZN3Alf12AlfAttribute14addSourceValueEPNS_21AlfAttributeValueTypeE @ 31 NONAME + _ZN3Alf12AlfAttribute14addTargetValueEPNS_21AlfAttributeValueTypeE @ 32 NONAME + _ZN3Alf12AlfAttribute14setSourceValueEPNS_21AlfAttributeValueTypeEj @ 33 NONAME + _ZN3Alf12AlfAttribute14setTargetValueEPNS_21AlfAttributeValueTypeEj @ 34 NONAME + _ZN3Alf12AlfAttribute17removeSourceValueEj @ 35 NONAME + _ZN3Alf12AlfAttribute17removeTargetValueEj @ 36 NONAME + _ZN3Alf12AlfAttribute20setMappingFunctionIdEi @ 37 NONAME + _ZN3Alf12AlfAttribute21setInterpolationStyleE22TAlfInterpolationStyle @ 38 NONAME + _ZN3Alf12AlfAttribute5cloneEv @ 39 NONAME + _ZN3Alf12AlfAttribute7setTimeEi @ 40 NONAME + _ZN3Alf12AlfAttribute8setDelayEi @ 41 NONAME + _ZN3Alf12AlfAttribute8setDirtyEb @ 42 NONAME + _ZN3Alf12AlfAttributeC1EPKcNS0_17attributecategoryE @ 43 NONAME + _ZN3Alf12AlfAttributeC1EPKcRKN7osncore7UStringENS0_17attributecategoryE @ 44 NONAME + _ZN3Alf12AlfAttributeC1EPKcf8TAlfUnitNS0_17attributecategoryE @ 45 NONAME + _ZN3Alf12AlfAttributeC1EPKci8TAlfUnitNS0_17attributecategoryE @ 46 NONAME + _ZN3Alf12AlfAttributeC1Ev @ 47 NONAME + _ZN3Alf12AlfAttributeC2EPKcNS0_17attributecategoryE @ 48 NONAME + _ZN3Alf12AlfAttributeC2EPKcRKN7osncore7UStringENS0_17attributecategoryE @ 49 NONAME + _ZN3Alf12AlfAttributeC2EPKcf8TAlfUnitNS0_17attributecategoryE @ 50 NONAME + _ZN3Alf12AlfAttributeC2EPKci8TAlfUnitNS0_17attributecategoryE @ 51 NONAME + _ZN3Alf12AlfAttributeC2Ev @ 52 NONAME + _ZN3Alf12AlfAttributeD0Ev @ 53 NONAME + _ZN3Alf12AlfAttributeD1Ev @ 54 NONAME + _ZN3Alf12AlfAttributeD2Ev @ 55 NONAME + _ZN3Alf12AlfAttributeaSERKS0_ @ 56 NONAME + _ZN3Alf12AlfContainer10customDataEv @ 57 NONAME + _ZN3Alf12AlfContainer10removeItemEj @ 58 NONAME + _ZN3Alf12AlfContainer11replaceItemEjPNS_15IAlfVariantTypeE @ 59 NONAME + _ZN3Alf12AlfContainer3mapEv @ 60 NONAME + _ZN3Alf12AlfContainer3setERNS_15IAlfVariantTypeE @ 61 NONAME + _ZN3Alf12AlfContainer4itemEj @ 62 NONAME + _ZN3Alf12AlfContainer4sortERKNS_16IAlfSortFunctionE @ 63 NONAME + _ZN3Alf12AlfContainer5clearEv @ 64 NONAME + _ZN3Alf12AlfContainer5cloneEv @ 65 NONAME + _ZN3Alf12AlfContainer5countEv @ 66 NONAME + _ZN3Alf12AlfContainer6branchEv @ 67 NONAME + _ZN3Alf12AlfContainer7addItemEPNS_15IAlfVariantTypeE @ 68 NONAME + _ZN3Alf12AlfContainer7addItemEjPNS_15IAlfVariantTypeE @ 69 NONAME + _ZN3Alf12AlfContainer9containerEv @ 70 NONAME + _ZN3Alf12AlfContainerC1Ev @ 71 NONAME + _ZN3Alf12AlfContainerC2Ev @ 72 NONAME + _ZN3Alf12AlfContainerD0Ev @ 73 NONAME + _ZN3Alf12AlfContainerD1Ev @ 74 NONAME + _ZN3Alf12AlfContainerD2Ev @ 75 NONAME + _ZN3Alf14AlfHostAPIImpl13makeInterfaceERKNS_4IfIdE @ 76 NONAME + _ZN3Alf14AlfVariantType10customDataEv @ 77 NONAME + _ZN3Alf14AlfVariantType3mapEv @ 78 NONAME + _ZN3Alf14AlfVariantType3setERNS_15IAlfVariantTypeE @ 79 NONAME + _ZN3Alf14AlfVariantType6branchEv @ 80 NONAME + _ZN3Alf14AlfVariantType9containerEv @ 81 NONAME + _ZN3Alf14AlfVariantTypeC1EPNS_13IAlfModelBaseE @ 82 NONAME + _ZN3Alf14AlfVariantTypeC1ERKN7osncore7UStringE @ 83 NONAME + _ZN3Alf14AlfVariantTypeC1ERKb @ 84 NONAME + _ZN3Alf14AlfVariantTypeC1ERKd @ 85 NONAME + _ZN3Alf14AlfVariantTypeC1ERKi @ 86 NONAME + _ZN3Alf14AlfVariantTypeC1ERKj @ 87 NONAME + _ZN3Alf14AlfVariantTypeC1Ev @ 88 NONAME + _ZN3Alf14AlfVariantTypeC2EPNS_13IAlfModelBaseE @ 89 NONAME + _ZN3Alf14AlfVariantTypeC2ERKN7osncore7UStringE @ 90 NONAME + _ZN3Alf14AlfVariantTypeC2ERKb @ 91 NONAME + _ZN3Alf14AlfVariantTypeC2ERKd @ 92 NONAME + _ZN3Alf14AlfVariantTypeC2ERKi @ 93 NONAME + _ZN3Alf14AlfVariantTypeC2ERKj @ 94 NONAME + _ZN3Alf14AlfVariantTypeC2Ev @ 95 NONAME + _ZN3Alf14AlfVariantTypeD0Ev @ 96 NONAME + _ZN3Alf14AlfVariantTypeD1Ev @ 97 NONAME + _ZN3Alf14AlfVariantTypeD2Ev @ 98 NONAME + _ZN3Alf16AlfLayoutManager11controlRectERNS_17CAlfWidgetControlER12TAlfRealRect @ 99 NONAME + _ZN3Alf16AlfLayoutManager12childRemovedEPNS_17CAlfWidgetControlE @ 100 NONAME + _ZN3Alf16AlfLayoutManager12createLayoutERNS_17CAlfWidgetControlEP10CAlfLayouti @ 101 NONAME + _ZN3Alf16AlfLayoutManager13makeInterfaceERKNS_4IfIdE @ 102 NONAME + _ZN3Alf16AlfLayoutManager14setControlRectERNS_17CAlfWidgetControlERK12TAlfRealRect @ 103 NONAME + _ZN3Alf16AlfLayoutManager14setControlSizeERNS_17CAlfWidgetControlERK13TAlfRealPoint @ 104 NONAME + _ZN3Alf16AlfLayoutManager17updateChildLayoutEPNS_17CAlfWidgetControlE @ 105 NONAME + _ZN3Alf16AlfLayoutManager18setControlPositionERNS_17CAlfWidgetControlERK13TAlfRealPoint @ 106 NONAME + _ZN3Alf16AlfLayoutManager19doUpdateChildLayoutEPNS_17CAlfWidgetControlE @ 107 NONAME + _ZN3Alf16AlfLayoutManager20updateChildrenLayoutEv @ 108 NONAME + _ZN3Alf16AlfLayoutManagerC1E14TAlfLayoutType @ 109 NONAME + _ZN3Alf16AlfLayoutManagerC2E14TAlfLayoutType @ 110 NONAME + _ZN3Alf16AlfLayoutManagerD0Ev @ 111 NONAME + _ZN3Alf16AlfLayoutManagerD1Ev @ 112 NONAME + _ZN3Alf16AlfLayoutManagerD2Ev @ 113 NONAME + _ZN3Alf17AlfModelOperation10getNewDataEv @ 114 NONAME + _ZN3Alf17AlfModelOperation6createENS0_13OperationTypeEiPiPNS_15IAlfVariantTypeE @ 115 NONAME + _ZN3Alf17AlfModelOperation6createENS0_13OperationTypeEiPiPNS_15IAlfVariantTypeERKN7osncore7UStringE @ 116 NONAME + _ZN3Alf17AlfModelOperationD1Ev @ 117 NONAME + _ZN3Alf17AlfModelOperationD2Ev @ 118 NONAME + _ZN3Alf17AlfVisualTemplate13makeInterfaceERKNS_4IfIdE @ 119 NONAME + _ZN3Alf17AlfVisualTemplate13setLayoutTypeE14TAlfLayoutType @ 120 NONAME + _ZN3Alf17AlfVisualTemplate13setVisualTypeE14TAlfVisualType @ 121 NONAME + _ZN3Alf17AlfVisualTemplate16addChildTemplateERNS_18IAlfVisualTemplateE @ 122 NONAME + _ZN3Alf17AlfVisualTemplate16createVisualTreeER11CAlfControlPNS_7IAlfMapEP10CAlfLayouti @ 123 NONAME + _ZN3Alf17AlfVisualTemplate16updateVisualTreeEPNS_7IAlfMapES2_R10CAlfVisual @ 124 NONAME + _ZN3Alf17AlfVisualTemplate18addAttributeSetterEPNS_19IAlfAttributeSetterEPNS_21AlfAttributeContainerE @ 125 NONAME + _ZN3Alf17AlfVisualTemplate18setSelectChildModeEbRKN7osncore7UStringE @ 126 NONAME + _ZN3Alf17AlfVisualTemplate19insertChildTemplateERNS_18IAlfVisualTemplateEi @ 127 NONAME + _ZN3Alf17AlfVisualTemplate20destroyChildTemplateEPKc @ 128 NONAME + _ZN3Alf17AlfVisualTemplate20destroyChildTemplateEi @ 129 NONAME + _ZN3Alf17AlfVisualTemplate6createE14TAlfLayoutType @ 130 NONAME + _ZN3Alf17AlfVisualTemplate6createE14TAlfVisualType @ 131 NONAME + _ZN3Alf17AlfVisualTemplate6createEv @ 132 NONAME + _ZN3Alf17AlfVisualTemplate7setNameEPKc @ 133 NONAME + _ZN3Alf17AlfVisualTemplate8addBrushER9CAlfBrush @ 134 NONAME + _ZN3Alf17AlfVisualTemplate8setOwnerEPNS_11IAlfElementE @ 135 NONAME + _ZN3Alf17AlfVisualTemplate9setParentEPNS_18IAlfVisualTemplateE @ 136 NONAME + _ZN3Alf17AlfVisualTemplateC1E14TAlfLayoutType @ 137 NONAME + _ZN3Alf17AlfVisualTemplateC1E14TAlfVisualType @ 138 NONAME + _ZN3Alf17AlfVisualTemplateC1Ev @ 139 NONAME + _ZN3Alf17AlfVisualTemplateC2E14TAlfLayoutType @ 140 NONAME + _ZN3Alf17AlfVisualTemplateC2E14TAlfVisualType @ 141 NONAME + _ZN3Alf17AlfVisualTemplateC2Ev @ 142 NONAME + _ZN3Alf17AlfVisualTemplateD0Ev @ 143 NONAME + _ZN3Alf17AlfVisualTemplateD1Ev @ 144 NONAME + _ZN3Alf17AlfVisualTemplateD2Ev @ 145 NONAME + _ZN3Alf17CAlfWidgetControl10addElementEPNS_11IAlfElementE @ 146 NONAME + _ZN3Alf17CAlfWidgetControl11OfferEventLERK9TAlfEvent @ 147 NONAME + _ZN3Alf17CAlfWidgetControl11dataChangedEv @ 148 NONAME + _ZN3Alf17CAlfWidgetControl11dataIdRangeERKNS_11IAlfElementE @ 149 NONAME + _ZN3Alf17CAlfWidgetControl11elementDataERKNS_11IAlfElementEj @ 150 NONAME + _ZN3Alf17CAlfWidgetControl11enableStateEj @ 151 NONAME + _ZN3Alf17CAlfWidgetControl11findElementEPKc @ 152 NONAME + _ZN3Alf17CAlfWidgetControl11handleEventERK9TAlfEvent @ 153 NONAME + _ZN3Alf17CAlfWidgetControl12AcquireFocusEv @ 154 NONAME + _ZN3Alf17CAlfWidgetControl12FocusChangedER11CAlfDisplayi @ 155 NONAME + _ZN3Alf17CAlfWidgetControl12dataChangingERKN7osncore12AlfPtrVectorINS_17AlfModelOperationEEE @ 156 NONAME + _ZN3Alf17CAlfWidgetControl12dataChangingERKNS_17AlfModelOperationE @ 157 NONAME + _ZN3Alf17CAlfWidgetControl12disableStateEj @ 158 NONAME + _ZN3Alf17CAlfWidgetControl12eventHandlerEi @ 159 NONAME + _ZN3Alf17CAlfWidgetControl12modelChangedERNS_9IAlfModelE @ 160 NONAME + _ZN3Alf17CAlfWidgetControl12processEventERK9TAlfEvent @ 161 NONAME + _ZN3Alf17CAlfWidgetControl13dataIdToIndexERKNS_11IAlfElementEj @ 162 NONAME + _ZN3Alf17CAlfWidgetControl13elementDataIdERKNS_11IAlfElementEjj @ 163 NONAME + _ZN3Alf17CAlfWidgetControl13makeInterfaceERKNS_4IfIdE @ 164 NONAME + _ZN3Alf17CAlfWidgetControl13removeElementERKNS_11IAlfElementE @ 165 NONAME + _ZN3Alf17CAlfWidgetControl14setDataIdRangeERKNS_11IAlfElementEj @ 166 NONAME + _ZN3Alf17CAlfWidgetControl15RelinquishFocusEv @ 167 NONAME + _ZN3Alf17CAlfWidgetControl15addEventHandlerEPNS_22IAlfWidgetEventHandlerEi @ 168 NONAME + _ZN3Alf17CAlfWidgetControl15handleFocusNextEv @ 169 NONAME + _ZN3Alf17CAlfWidgetControl16findEventHandlerERK9TAlfEvent @ 170 NONAME + _ZN3Alf17CAlfWidgetControl16getLastFocusableERNS_19IAlfContainerWidgetE @ 171 NONAME + _ZN3Alf17CAlfWidgetControl17getFirstFocusableERNS_19IAlfContainerWidgetE @ 172 NONAME + _ZN3Alf17CAlfWidgetControl17getFocusableAfterERNS_19IAlfContainerWidgetERS0_ @ 173 NONAME + _ZN3Alf17CAlfWidgetControl18getFocusableBeforeERNS_19IAlfContainerWidgetERS0_ @ 174 NONAME + _ZN3Alf17CAlfWidgetControl18removeEventHandlerERNS_22IAlfWidgetEventHandlerE @ 175 NONAME + _ZN3Alf17CAlfWidgetControl18updateParentLayoutEv @ 176 NONAME + _ZN3Alf17CAlfWidgetControl18updatePresentationEv @ 177 NONAME + _ZN3Alf17CAlfWidgetControl19destroyPresentationEi @ 178 NONAME + _ZN3Alf17CAlfWidgetControl19handleFocusPreviousEv @ 179 NONAME + _ZN3Alf17CAlfWidgetControl19parentElementDataIdERKNS_11IAlfElementEj @ 180 NONAME + _ZN3Alf17CAlfWidgetControl20nextFocusableControlEPS0_ @ 181 NONAME + _ZN3Alf17CAlfWidgetControl23removeAndDestroyElementERKNS_11IAlfElementE @ 182 NONAME + _ZN3Alf17CAlfWidgetControl24previousFocusableControlEPS0_ @ 183 NONAME + _ZN3Alf17CAlfWidgetControl25destroyVisualsAndElementsEi @ 184 NONAME + _ZN3Alf17CAlfWidgetControl28removeAndDestroyEventHandlerERKN7osncore7UStringE @ 185 NONAME + _ZN3Alf17CAlfWidgetControl28removeAndDestroyEventHandlerERNS_22IAlfWidgetEventHandlerE @ 186 NONAME + _ZN3Alf17CAlfWidgetControl31removePresentationEventHandlersEv @ 187 NONAME + _ZN3Alf17CAlfWidgetControl41removeAndDestroyPresentationEventHandlersEv @ 188 NONAME + _ZN3Alf17CAlfWidgetControl6widgetEv @ 189 NONAME + _ZN3Alf17CAlfWidgetControl7elementEi @ 190 NONAME + _ZN3Alf17CAlfWidgetControl8setStateEj @ 191 NONAME + _ZN3Alf17CAlfWidgetControl9constructER7CAlfEnv @ 192 NONAME + _ZN3Alf17CAlfWidgetControlC1ER7CAlfEnv @ 193 NONAME + _ZN3Alf17CAlfWidgetControlC1Ev @ 194 NONAME + _ZN3Alf17CAlfWidgetControlC2ER7CAlfEnv @ 195 NONAME + _ZN3Alf17CAlfWidgetControlC2Ev @ 196 NONAME + _ZN3Alf17CAlfWidgetControlD0Ev @ 197 NONAME + _ZN3Alf17CAlfWidgetControlD1Ev @ 198 NONAME + _ZN3Alf17CAlfWidgetControlD2Ev @ 199 NONAME + _ZN3Alf17CAlfWidgetControlnwEj6newarg @ 200 NONAME + _ZN3Alf18AlfAnimationOutput11sendCommandERNS_17CAlfWidgetControlEj @ 201 NONAME + _ZN3Alf18AlfAnimationOutputC1EPNS_20AlfReferenceToVisualES2_PNS_19IAlfAttributeSetterEPNS_21AlfAttributeContainerEjj @ 202 NONAME + _ZN3Alf18AlfAnimationOutputC2EPNS_20AlfReferenceToVisualES2_PNS_19IAlfAttributeSetterEPNS_21AlfAttributeContainerEjj @ 203 NONAME + _ZN3Alf18AlfAnimationOutputD1Ev @ 204 NONAME + _ZN3Alf18AlfAnimationOutputD2Ev @ 205 NONAME + _ZN3Alf20AlfFlowLayoutManager13makeInterfaceERKNS_4IfIdE @ 206 NONAME + _ZN3Alf20AlfFlowLayoutManager17updateChildLayoutEPNS_17CAlfWidgetControlE @ 207 NONAME + _ZN3Alf20AlfFlowLayoutManagerC1Ev @ 208 NONAME + _ZN3Alf20AlfFlowLayoutManagerC2Ev @ 209 NONAME + _ZN3Alf20AlfFlowLayoutManagerD0Ev @ 210 NONAME + _ZN3Alf20AlfFlowLayoutManagerD1Ev @ 211 NONAME + _ZN3Alf20AlfFlowLayoutManagerD2Ev @ 212 NONAME + _ZN3Alf20AlfGridLayoutManager12childRemovedEPNS_17CAlfWidgetControlE @ 213 NONAME + _ZN3Alf20AlfGridLayoutManager13makeInterfaceERKNS_4IfIdE @ 214 NONAME + _ZN3Alf20AlfGridLayoutManager17updateChildLayoutEPNS_17CAlfWidgetControlE @ 215 NONAME + _ZN3Alf20AlfGridLayoutManager19doUpdateChildLayoutEPNS_17CAlfWidgetControlE @ 216 NONAME + _ZN3Alf20AlfGridLayoutManagerC1Ev @ 217 NONAME + _ZN3Alf20AlfGridLayoutManagerC2Ev @ 218 NONAME + _ZN3Alf20AlfGridLayoutManagerD0Ev @ 219 NONAME + _ZN3Alf20AlfGridLayoutManagerD1Ev @ 220 NONAME + _ZN3Alf20AlfGridLayoutManagerD2Ev @ 221 NONAME + _ZN3Alf20AlfReferenceToVisual6createEPKcS2_b @ 222 NONAME + _ZN3Alf20AlfReferenceToVisual7resolveERNS_17CAlfWidgetControlEP10CAlfVisual @ 223 NONAME + _ZN3Alf20AlfReferenceToVisual7resolveERNS_17CAlfWidgetControlEj @ 224 NONAME + _ZN3Alf20AlfReferenceToVisualD1Ev @ 225 NONAME + _ZN3Alf20AlfReferenceToVisualD2Ev @ 226 NONAME + _ZN3Alf21AlfAttributeContainer12addAttributeEPNS_12AlfAttributeE @ 227 NONAME + _ZN3Alf21AlfAttributeContainer15removeAttributeEj @ 228 NONAME + _ZN3Alf21AlfAttributeContainer7setTimeEj @ 229 NONAME + _ZN3Alf21AlfAttributeContainerC1ENS0_4TypeE @ 230 NONAME + _ZN3Alf21AlfAttributeContainerC2ENS0_4TypeE @ 231 NONAME + _ZN3Alf21AlfAttributeContainerD1Ev @ 232 NONAME + _ZN3Alf21AlfAttributeContainerD2Ev @ 233 NONAME + _ZN3Alf21AlfAttributeValueTypeC1ERKN7osncore7UStringE @ 234 NONAME + _ZN3Alf21AlfAttributeValueTypeC1Ef8TAlfUnit @ 235 NONAME + _ZN3Alf21AlfAttributeValueTypeC1Ei8TAlfUnit @ 236 NONAME + _ZN3Alf21AlfAttributeValueTypeC2ERKN7osncore7UStringE @ 237 NONAME + _ZN3Alf21AlfAttributeValueTypeC2Ef8TAlfUnit @ 238 NONAME + _ZN3Alf21AlfAttributeValueTypeC2Ei8TAlfUnit @ 239 NONAME + _ZN3Alf21AlfAttributeValueTypeD0Ev @ 240 NONAME + _ZN3Alf21AlfAttributeValueTypeD1Ev @ 241 NONAME + _ZN3Alf21AlfAttributeValueTypeD2Ev @ 242 NONAME + _ZN3Alf21AlfWidgetEnvExtension12resourcePoolER7CAlfEnv @ 243 NONAME + _ZN3Alf21AlfWidgetEnvExtension13widgetFactoryER7CAlfEnv @ 244 NONAME + _ZN3Alf21AlfWidgetEnvExtension16themeManagerUtilER7CAlfEnv @ 245 NONAME + _ZN3Alf21AlfWidgetEnvExtension21initializeEnvironmentER7CAlfEnv @ 246 NONAME + _ZN3Alf21AlfWidgetEventHandler11addKeyInputEiNS_14EventTypeFlagsEj @ 247 NONAME + _ZN3Alf21AlfWidgetEventHandler14addCustomInputEibi @ 248 NONAME + _ZN3Alf21AlfWidgetEventHandler15addCancelOutputEPKcib @ 249 NONAME + _ZN3Alf21AlfWidgetEventHandler15addPointerInputEPKcS2_NS_18WidgetPointerEventE @ 250 NONAME + _ZN3Alf21AlfWidgetEventHandler16addTactileOutputENS_25WidgetTactileFeedbackTypeE @ 251 NONAME + _ZN3Alf21AlfWidgetEventHandler17addAppEventOutputERKN7osncore7UStringERNS_20IAlfAppEventListenerE @ 252 NONAME + _ZN3Alf21AlfWidgetEventHandler18addAnimationOutputEPNS_20AlfReferenceToVisualES2_PNS_19IAlfAttributeSetterEPNS_21AlfAttributeContainerEjj @ 253 NONAME + _ZN3Alf21AlfWidgetEventHandler19addEventPasserInputEii @ 254 NONAME + _ZN3Alf21AlfWidgetEventHandler20addEventPasserOutputEPKcS2_ @ 255 NONAME + _ZN3Alf21AlfWidgetEventHandler20addEventPasserOutputEPKcS2_ii @ 256 NONAME + _ZN3Alf21AlfWidgetEventHandler20addWidgetStateOutputERKN7osncore7UStringEjj @ 257 NONAME + _ZN3Alf21AlfWidgetEventHandler23addWidgetAttributeInputERN7osncore7UStringEPNS_21AlfAttributeValueTypeEPKc @ 258 NONAME + _ZN3Alf21AlfWidgetEventHandler24addAnimationCancelOutputEPKcS2_6TAlfOpb @ 259 NONAME + _ZN3Alf21AlfWidgetEventHandler24addWidgetAttributeOutputERN7osncore7UStringEPNS_21AlfAttributeValueTypeEPKc @ 260 NONAME + _ZN3Alf21AlfWidgetEventHandler24addWidgetAttributeOutputERNS_12AlfAttributeEPKc @ 261 NONAME + _ZN3Alf21AlfWidgetEventHandler36addWidgetEventOutputSignalSubscriberERNS_31IAlfEventOutputSignalSubscriberE @ 262 NONAME + _ZN3Alf21AlfWidgetEventHandler9addOutputEiiPKcj @ 263 NONAME + _ZN3Alf21AlfWidgetEventHandlerC1ENS_22IAlfWidgetEventHandler19AlfEventHandlerTypeENS1_29AlfEventHandlerExecutionPhaseE @ 264 NONAME + _ZN3Alf21AlfWidgetEventHandlerC2ENS_22IAlfWidgetEventHandler19AlfEventHandlerTypeENS1_29AlfEventHandlerExecutionPhaseE @ 265 NONAME + _ZN3Alf22AlfAnchorLayoutManager12childRemovedEPNS_17CAlfWidgetControlE @ 266 NONAME + _ZN3Alf22AlfAnchorLayoutManager13makeInterfaceERKNS_4IfIdE @ 267 NONAME + _ZN3Alf22AlfAnchorLayoutManager17updateChildLayoutEPNS_17CAlfWidgetControlE @ 268 NONAME + _ZN3Alf22AlfAnchorLayoutManager19doUpdateChildLayoutEPNS_17CAlfWidgetControlE @ 269 NONAME + _ZN3Alf22AlfAnchorLayoutManagerC1Ev @ 270 NONAME + _ZN3Alf22AlfAnchorLayoutManagerC2Ev @ 271 NONAME + _ZN3Alf22AlfAnchorLayoutManagerD0Ev @ 272 NONAME + _ZN3Alf22AlfAnchorLayoutManagerD1Ev @ 273 NONAME + _ZN3Alf22AlfAnchorLayoutManagerD2Ev @ 274 NONAME + _ZN3Alf23AlfRecyclingGridElement10offerEventERNS_17CAlfWidgetControlERK9TAlfEvent @ 275 NONAME + _ZN3Alf23AlfRecyclingGridElement12setFillStyleENS0_9FillStyleEi @ 276 NONAME + _ZN3Alf23AlfRecyclingGridElement13makeInterfaceERKNS_4IfIdE @ 277 NONAME + _ZN3Alf23AlfRecyclingGridElement15setActiveStatesEj @ 278 NONAME + _ZN3Alf23AlfRecyclingGridElement16createVisualTreeERNS_15IAlfVariantTypeEjP10CAlfLayouti @ 279 NONAME + _ZN3Alf23AlfRecyclingGridElement16eventHandlerDataEv @ 280 NONAME + _ZN3Alf23AlfRecyclingGridElement17setAnimationTimesEiiiii @ 281 NONAME + _ZN3Alf23AlfRecyclingGridElement19setEventHandlerDataERKNS_29AlfWidgetEventHandlerInitDataE @ 282 NONAME + _ZN3Alf23AlfRecyclingGridElement21createChildVisualTreeEPNS_11IAlfElementERNS_15IAlfVariantTypeERNS_10IAlfBranchEij @ 283 NONAME + _ZN3Alf23AlfRecyclingGridElement21removeChildVisualTreeEPNS_11IAlfElementERNS_10IAlfBranchEij @ 284 NONAME + _ZN3Alf23AlfRecyclingGridElementC1ERNS_17CAlfWidgetControlEPKcii @ 285 NONAME + _ZN3Alf23AlfRecyclingGridElementC2ERNS_17CAlfWidgetControlEPKcii @ 286 NONAME + _ZN3Alf23AlfRecyclingGridElementD0Ev @ 287 NONAME + _ZN3Alf23AlfRecyclingGridElementD1Ev @ 288 NONAME + _ZN3Alf23AlfRecyclingGridElementD2Ev @ 289 NONAME + _ZN3Alf24AlfCommonAttributeSetter10setterTypeEv @ 290 NONAME + _ZN3Alf24AlfCommonAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 291 NONAME + _ZN3Alf24AlfCommonAttributeSetter13makeInterfaceERKNS_4IfIdE @ 292 NONAME + _ZN3Alf24AlfCommonAttributeSetter16enableDirtyCheckEb @ 293 NONAME + _ZN3Alf24AlfCommonAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 294 NONAME + _ZN3Alf24AlfCommonAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 295 NONAME + _ZN3Alf24AlfCommonAttributeSetterC1Ev @ 296 NONAME + _ZN3Alf24AlfCommonAttributeSetterC2Ev @ 297 NONAME + _ZN3Alf24AlfCommonAttributeSetterD0Ev @ 298 NONAME + _ZN3Alf24AlfCommonAttributeSetterD1Ev @ 299 NONAME + _ZN3Alf24AlfCommonAttributeSetterD2Ev @ 300 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 301 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 302 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 303 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetterC1Ev @ 304 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetterC2Ev @ 305 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetterD0Ev @ 306 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetterD1Ev @ 307 NONAME + _ZN3Alf28AlfDeckLayoutAttributeSetterD2Ev @ 308 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 309 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 310 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 311 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetterC1Ev @ 312 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetterC2Ev @ 313 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetterD0Ev @ 314 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetterD1Ev @ 315 NONAME + _ZN3Alf28AlfFlowLayoutAttributeSetterD2Ev @ 316 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 317 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 318 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 319 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetterC1Ev @ 320 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetterC2Ev @ 321 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetterD0Ev @ 322 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetterD1Ev @ 323 NONAME + _ZN3Alf28AlfGridLayoutAttributeSetterD2Ev @ 324 NONAME + _ZN3Alf28AlfLineVisualAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 325 NONAME + _ZN3Alf28AlfLineVisualAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 326 NONAME + _ZN3Alf28AlfLineVisualAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 327 NONAME + _ZN3Alf28AlfLineVisualAttributeSetterC1Ev @ 328 NONAME + _ZN3Alf28AlfLineVisualAttributeSetterC2Ev @ 329 NONAME + _ZN3Alf28AlfLineVisualAttributeSetterD0Ev @ 330 NONAME + _ZN3Alf28AlfLineVisualAttributeSetterD1Ev @ 331 NONAME + _ZN3Alf28AlfLineVisualAttributeSetterD2Ev @ 332 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 333 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 334 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 335 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetterC1Ev @ 336 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetterC2Ev @ 337 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetterD0Ev @ 338 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetterD1Ev @ 339 NONAME + _ZN3Alf28AlfMeshVisualAttributeSetterD2Ev @ 340 NONAME + _ZN3Alf28AlfTextVisualAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 341 NONAME + _ZN3Alf28AlfTextVisualAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 342 NONAME + _ZN3Alf28AlfTextVisualAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 343 NONAME + _ZN3Alf28AlfTextVisualAttributeSetterC1Ev @ 344 NONAME + _ZN3Alf28AlfTextVisualAttributeSetterC2Ev @ 345 NONAME + _ZN3Alf28AlfTextVisualAttributeSetterD0Ev @ 346 NONAME + _ZN3Alf28AlfTextVisualAttributeSetterD1Ev @ 347 NONAME + _ZN3Alf28AlfTextVisualAttributeSetterD2Ev @ 348 NONAME + _ZN3Alf29AlfImageVisualAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 349 NONAME + _ZN3Alf29AlfImageVisualAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 350 NONAME + _ZN3Alf29AlfImageVisualAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 351 NONAME + _ZN3Alf29AlfImageVisualAttributeSetterC1Ev @ 352 NONAME + _ZN3Alf29AlfImageVisualAttributeSetterC2Ev @ 353 NONAME + _ZN3Alf29AlfImageVisualAttributeSetterD0Ev @ 354 NONAME + _ZN3Alf29AlfImageVisualAttributeSetterD1Ev @ 355 NONAME + _ZN3Alf29AlfImageVisualAttributeSetterD2Ev @ 356 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 357 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 358 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 359 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetterC1Ev @ 360 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetterC2Ev @ 361 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetterD0Ev @ 362 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetterD1Ev @ 363 NONAME + _ZN3Alf30AlfAnchorLayoutAttributeSetterD2Ev @ 364 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 365 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 366 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 367 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetterC1Ev @ 368 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetterC2Ev @ 369 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetterD0Ev @ 370 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetterD1Ev @ 371 NONAME + _ZN3Alf30AlfCommonLayoutAttributeSetterD2Ev @ 372 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 373 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 374 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetterC1Ev @ 375 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetterC2Ev @ 376 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetterD0Ev @ 377 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetterD1Ev @ 378 NONAME + _ZN3Alf30AlfCommonVisualAttributeSetterD2Ev @ 379 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 380 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 381 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 382 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetterC1Ev @ 383 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetterC2Ev @ 384 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetterD0Ev @ 385 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetterD1Ev @ 386 NONAME + _ZN3Alf32AlfViewportLayoutAttributeSetterD2Ev @ 387 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetter13createCommandER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapEiPS1_ @ 388 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetter17setAttributeValueER10CAlfVisualPNS_21AlfAttributeContainerEPNS_7IAlfMapE @ 389 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetter21createAndSendCommandsER10CAlfVisualPNS_21AlfAttributeContainerEPS1_ @ 390 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetterC1Ev @ 391 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetterC2Ev @ 392 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetterD0Ev @ 393 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetterD1Ev @ 394 NONAME + _ZN3Alf33AlfCurvePathLayoutAttributeSetterD2Ev @ 395 NONAME + _ZN3Alf6AlfMap10customDataEv @ 396 NONAME + _ZN3Alf6AlfMap10removeItemERKN7osncore7UStringE @ 397 NONAME + _ZN3Alf6AlfMap10removeItemEj @ 398 NONAME + _ZN3Alf6AlfMap11replaceItemERKN7osncore7UStringEPNS_15IAlfVariantTypeE @ 399 NONAME + _ZN3Alf6AlfMap11replaceItemEjPNS_15IAlfVariantTypeE @ 400 NONAME + _ZN3Alf6AlfMap3mapEv @ 401 NONAME + _ZN3Alf6AlfMap3setERNS_15IAlfVariantTypeE @ 402 NONAME + _ZN3Alf6AlfMap4itemERKN7osncore7UStringE @ 403 NONAME + _ZN3Alf6AlfMap4itemEj @ 404 NONAME + _ZN3Alf6AlfMap5clearEv @ 405 NONAME + _ZN3Alf6AlfMap5cloneEv @ 406 NONAME + _ZN3Alf6AlfMap6branchEv @ 407 NONAME + _ZN3Alf6AlfMap9containerEv @ 408 NONAME + _ZN3Alf6AlfMap9itemIndexERKN7osncore7UStringE @ 409 NONAME + _ZN3Alf6AlfMapC1Ev @ 410 NONAME + _ZN3Alf6AlfMapC2Ev @ 411 NONAME + _ZN3Alf6AlfMapD0Ev @ 412 NONAME + _ZN3Alf6AlfMapD1Ev @ 413 NONAME + _ZN3Alf6AlfMapD2Ev @ 414 NONAME + _ZN3Alf8AlfModel10clearModelEv @ 415 NONAME + _ZN3Alf8AlfModel10removeDataEiPi @ 416 NONAME + _ZN3Alf8AlfModel10updateDataEiPiPNS_15IAlfVariantTypeE @ 417 NONAME + _ZN3Alf8AlfModel13makeInterfaceERKNS_4IfIdE @ 418 NONAME + _ZN3Alf8AlfModel16executeOperationEPNS_17AlfModelOperationE @ 419 NONAME + _ZN3Alf8AlfModel17executeOperationsERN7osncore12AlfPtrVectorINS_17AlfModelOperationEEE @ 420 NONAME + _ZN3Alf8AlfModel18notifyModelChangedEv @ 421 NONAME + _ZN3Alf8AlfModel22addModelChangeObserverERNS_23IAlfModelChangeObserverE @ 422 NONAME + _ZN3Alf8AlfModel25removeModelChangeObserverERNS_23IAlfModelChangeObserverE @ 423 NONAME + _ZN3Alf8AlfModel7addDataEiPiPNS_15IAlfVariantTypeE @ 424 NONAME + _ZN3Alf8AlfModel7setDataEPNS_15IAlfVariantTypeE @ 425 NONAME + _ZN3Alf8AlfModelC1EPNS_15IAlfVariantTypeE @ 426 NONAME + _ZN3Alf8AlfModelC1Ev @ 427 NONAME + _ZN3Alf8AlfModelC2EPNS_15IAlfVariantTypeE @ 428 NONAME + _ZN3Alf8AlfModelC2Ev @ 429 NONAME + _ZN3Alf8AlfModelD0Ev @ 430 NONAME + _ZN3Alf8AlfModelD1Ev @ 431 NONAME + _ZN3Alf8AlfModelD2Ev @ 432 NONAME + _ZN3Alf9AlfBranch10customDataEv @ 433 NONAME + _ZN3Alf9AlfBranch12setChildDataEPNS_7IAlfMapE @ 434 NONAME + _ZN3Alf9AlfBranch13childrenCountEv @ 435 NONAME + _ZN3Alf9AlfBranch3mapEv @ 436 NONAME + _ZN3Alf9AlfBranch3setERNS_15IAlfVariantTypeE @ 437 NONAME + _ZN3Alf9AlfBranch4dataEv @ 438 NONAME + _ZN3Alf9AlfBranch4sortERKNS_16IAlfSortFunctionE @ 439 NONAME + _ZN3Alf9AlfBranch5cloneEv @ 440 NONAME + _ZN3Alf9AlfBranch6branchEv @ 441 NONAME + _ZN3Alf9AlfBranch7setDataEPNS_7IAlfMapE @ 442 NONAME + _ZN3Alf9AlfBranch9childDataEi @ 443 NONAME + _ZN3Alf9AlfBranch9childDataEv @ 444 NONAME + _ZN3Alf9AlfBranch9childNameEi @ 445 NONAME + _ZN3Alf9AlfBranch9containerEv @ 446 NONAME + _ZN3Alf9AlfBranchC1EPNS_7IAlfMapES2_ @ 447 NONAME + _ZN3Alf9AlfBranchC1Ev @ 448 NONAME + _ZN3Alf9AlfBranchC2EPNS_7IAlfMapES2_ @ 449 NONAME + _ZN3Alf9AlfBranchC2Ev @ 450 NONAME + _ZN3Alf9AlfBranchD0Ev @ 451 NONAME + _ZN3Alf9AlfBranchD1Ev @ 452 NONAME + _ZN3Alf9AlfBranchD2Ev @ 453 NONAME + _ZN3Alf9AlfWidget10setControlEPNS_17CAlfWidgetControlEb @ 454 NONAME + _ZN3Alf9AlfWidget11applyLayoutERNS_17IAlfLayoutManagerE @ 455 NONAME + _ZN3Alf9AlfWidget12removeWidgetERNS_10IAlfWidgetE @ 456 NONAME + _ZN3Alf9AlfWidget12removeWidgetEi @ 457 NONAME + _ZN3Alf9AlfWidget13makeInterfaceEPS0_RKNS_4IfIdE @ 458 NONAME + _ZN3Alf9AlfWidget13makeInterfaceERKNS_4IfIdE @ 459 NONAME + _ZN3Alf9AlfWidget13setChildFocusEb @ 460 NONAME + _ZN3Alf9AlfWidget15setPresentationEPKc @ 461 NONAME + _ZN3Alf9AlfWidget5modelEv @ 462 NONAME + _ZN3Alf9AlfWidget8setModelEPNS_9IAlfModelEb @ 463 NONAME + _ZN3Alf9AlfWidget9addWidgetERNS_10IAlfWidgetE @ 464 NONAME + _ZN3Alf9AlfWidgetC1EPKc @ 465 NONAME + _ZN3Alf9AlfWidgetC1EPKcRNS_19IAlfContainerWidgetER7CAlfEnv @ 466 NONAME + _ZN3Alf9AlfWidgetC1Ev @ 467 NONAME + _ZN3Alf9AlfWidgetC2EPKc @ 468 NONAME + _ZN3Alf9AlfWidgetC2EPKcRNS_19IAlfContainerWidgetER7CAlfEnv @ 469 NONAME + _ZN3Alf9AlfWidgetC2Ev @ 470 NONAME + _ZN3Alf9AlfWidgetD0Ev @ 471 NONAME + _ZN3Alf9AlfWidgetD1Ev @ 472 NONAME + _ZN3Alf9AlfWidgetD2Ev @ 473 NONAME + _ZNK3Alf10AlfElement13parentElementEv @ 474 NONAME + _ZNK3Alf10AlfElement17getVisualTemplateEv @ 475 NONAME + _ZNK3Alf10AlfElement4nameEv @ 476 NONAME + _ZNK3Alf10AlfElement6dataIDERK10CAlfVisual @ 477 NONAME + _ZNK3Alf10AlfElement8containsER10CAlfVisual @ 478 NONAME + _ZNK3Alf12AlfAttribute10isValueSetEv @ 479 NONAME + _ZNK3Alf12AlfAttribute11stringValueEj @ 480 NONAME + _ZNK3Alf12AlfAttribute12getDataFieldEv @ 481 NONAME + _ZNK3Alf12AlfAttribute14getSourceValueEj @ 482 NONAME + _ZNK3Alf12AlfAttribute14getTargetValueEj @ 483 NONAME + _ZNK3Alf12AlfAttribute19getSourceValueCountEv @ 484 NONAME + _ZNK3Alf12AlfAttribute19getTargetValueCountEv @ 485 NONAME + _ZNK3Alf12AlfAttribute20getMappingFunctionIdEv @ 486 NONAME + _ZNK3Alf12AlfAttribute21getInterpolationStyleEv @ 487 NONAME + _ZNK3Alf12AlfAttribute4nameEv @ 488 NONAME + _ZNK3Alf12AlfAttribute4typeEj @ 489 NONAME + _ZNK3Alf12AlfAttribute4unitEj @ 490 NONAME + _ZNK3Alf12AlfAttribute7getTimeEv @ 491 NONAME + _ZNK3Alf12AlfAttribute7isDirtyEv @ 492 NONAME + _ZNK3Alf12AlfAttribute8categoryEv @ 493 NONAME + _ZNK3Alf12AlfAttribute8getDelayEv @ 494 NONAME + _ZNK3Alf12AlfAttribute8intValueEj @ 495 NONAME + _ZNK3Alf12AlfAttribute9realValueEj @ 496 NONAME + _ZNK3Alf12AlfContainer4realEv @ 497 NONAME + _ZNK3Alf12AlfContainer4typeEv @ 498 NONAME + _ZNK3Alf12AlfContainer6stringEv @ 499 NONAME + _ZNK3Alf12AlfContainer7booleanEv @ 500 NONAME + _ZNK3Alf12AlfContainer7integerEv @ 501 NONAME + _ZNK3Alf12AlfContainer8uintegerEv @ 502 NONAME + _ZNK3Alf12AlfContainereqERKNS_15IAlfVariantTypeE @ 503 NONAME + _ZNK3Alf14AlfVariantType4realEv @ 504 NONAME + _ZNK3Alf14AlfVariantType4typeEv @ 505 NONAME + _ZNK3Alf14AlfVariantType6stringEv @ 506 NONAME + _ZNK3Alf14AlfVariantType7booleanEv @ 507 NONAME + _ZNK3Alf14AlfVariantType7integerEv @ 508 NONAME + _ZNK3Alf14AlfVariantType8uintegerEv @ 509 NONAME + _ZNK3Alf14AlfVariantTypeeqERKNS_15IAlfVariantTypeE @ 510 NONAME + _ZNK3Alf16AlfLayoutManager10getControlEi @ 511 NONAME + _ZNK3Alf16AlfLayoutManager20getLayoutPreferencesEPNS_17CAlfWidgetControlE @ 512 NONAME + _ZNK3Alf16AlfLayoutManager5countEv @ 513 NONAME + _ZNK3Alf16AlfLayoutManager5ownerEv @ 514 NONAME + _ZNK3Alf16AlfLayoutManager9getLayoutEv @ 515 NONAME + _ZNK3Alf17AlfModelOperation10parentDataERNS_15IAlfVariantTypeE @ 516 NONAME + _ZNK3Alf17AlfModelOperation11newDataNameEv @ 517 NONAME + _ZNK3Alf17AlfModelOperation14containerIndexEi @ 518 NONAME + _ZNK3Alf17AlfModelOperation19numContainerIndicesEv @ 519 NONAME + _ZNK3Alf17AlfModelOperation5indexEv @ 520 NONAME + _ZNK3Alf17AlfModelOperation7newDataEv @ 521 NONAME + _ZNK3Alf17AlfModelOperation9operationEv @ 522 NONAME + _ZNK3Alf17AlfVisualTemplate10layoutTypeEv @ 523 NONAME + _ZNK3Alf17AlfVisualTemplate10numBrushesEv @ 524 NONAME + _ZNK3Alf17AlfVisualTemplate10visualTypeEv @ 525 NONAME + _ZNK3Alf17AlfVisualTemplate13childTemplateEi @ 526 NONAME + _ZNK3Alf17AlfVisualTemplate15attributeSetterEi @ 527 NONAME + _ZNK3Alf17AlfVisualTemplate17numChildTemplatesEv @ 528 NONAME + _ZNK3Alf17AlfVisualTemplate18attributeContainerEi @ 529 NONAME + _ZNK3Alf17AlfVisualTemplate19numAttributeSettersEv @ 530 NONAME + _ZNK3Alf17AlfVisualTemplate4nameEv @ 531 NONAME + _ZNK3Alf17AlfVisualTemplate5brushEi @ 532 NONAME + _ZNK3Alf17AlfVisualTemplate5ownerEv @ 533 NONAME + _ZNK3Alf17AlfVisualTemplate6parentEv @ 534 NONAME + _ZNK3Alf17CAlfWidgetControl10checkStateEj @ 535 NONAME + _ZNK3Alf17CAlfWidgetControl11isContainerEv @ 536 NONAME + _ZNK3Alf17CAlfWidgetControl11isFocusableEv @ 537 NONAME + _ZNK3Alf17CAlfWidgetControl11numElementsEv @ 538 NONAME + _ZNK3Alf17CAlfWidgetControl15ContainerLayoutEPK11CAlfControl @ 539 NONAME + _ZNK3Alf17CAlfWidgetControl16numEventHandlersEv @ 540 NONAME + _ZNK3Alf17CAlfWidgetControl17eventHandlerIndexERNS_22IAlfWidgetEventHandlerE @ 541 NONAME + _ZNK3Alf17CAlfWidgetControl5stateEv @ 542 NONAME + _ZNK3Alf21AlfAttributeContainer12getAttributeEj @ 543 NONAME + _ZNK3Alf21AlfAttributeContainer14attributeCountEv @ 544 NONAME + _ZNK3Alf21AlfAttributeContainer18getAttributeByNameEPKc @ 545 NONAME + _ZNK3Alf21AlfAttributeContainer4typeEv @ 546 NONAME + _ZNK3Alf21AlfAttributeContainer7getTimeEv @ 547 NONAME + _ZNK3Alf21AlfAttributeValueType11stringValueEv @ 548 NONAME + _ZNK3Alf21AlfAttributeValueType4typeEv @ 549 NONAME + _ZNK3Alf21AlfAttributeValueType4unitEv @ 550 NONAME + _ZNK3Alf21AlfAttributeValueType8intValueEv @ 551 NONAME + _ZNK3Alf21AlfAttributeValueType8rgbValueEv @ 552 NONAME + _ZNK3Alf21AlfAttributeValueType9enumValueEv @ 553 NONAME + _ZNK3Alf21AlfAttributeValueType9realValueEv @ 554 NONAME + _ZNK3Alf23AlfRecyclingGridElement6acceptERNS_17CAlfWidgetControlERK9TAlfEvent @ 555 NONAME + _ZNK3Alf6AlfMap4nameEj @ 556 NONAME + _ZNK3Alf6AlfMap4realEv @ 557 NONAME + _ZNK3Alf6AlfMap4typeEv @ 558 NONAME + _ZNK3Alf6AlfMap5countEv @ 559 NONAME + _ZNK3Alf6AlfMap6stringEv @ 560 NONAME + _ZNK3Alf6AlfMap7booleanEv @ 561 NONAME + _ZNK3Alf6AlfMap7integerEv @ 562 NONAME + _ZNK3Alf6AlfMap8uintegerEv @ 563 NONAME + _ZNK3Alf8AlfModel4dataEv @ 564 NONAME + _ZNK3Alf9AlfBranch4realEv @ 565 NONAME + _ZNK3Alf9AlfBranch4typeEv @ 566 NONAME + _ZNK3Alf9AlfBranch6stringEv @ 567 NONAME + _ZNK3Alf9AlfBranch7booleanEv @ 568 NONAME + _ZNK3Alf9AlfBranch7integerEv @ 569 NONAME + _ZNK3Alf9AlfBranch8uintegerEv @ 570 NONAME + _ZNK3Alf9AlfBrancheqERKNS_15IAlfVariantTypeE @ 571 NONAME + _ZNK3Alf9AlfWidget10widgetNameEv @ 572 NONAME + _ZNK3Alf9AlfWidget11widgetCountEv @ 573 NONAME + _ZNK3Alf9AlfWidget14getWidgetIndexERNS_10IAlfWidgetE @ 574 NONAME + _ZNK3Alf9AlfWidget6parentEv @ 575 NONAME + _ZNK3Alf9AlfWidget7controlEv @ 576 NONAME + _ZNK3Alf9AlfWidget9getWidgetEi @ 577 NONAME + _ZTIN3Alf10AlfElementE @ 578 NONAME ; ## + _ZTIN3Alf12AlfAttributeE @ 579 NONAME ; ## + _ZTIN3Alf12AlfContainerE @ 580 NONAME ; ## + _ZTIN3Alf12AlfEnumValueE @ 581 NONAME ; ## + _ZTIN3Alf12AlfRealValueE @ 582 NONAME ; ## + _ZTIN3Alf14AlfHostAPIImplE @ 583 NONAME ; ## + _ZTIN3Alf14AlfStringValueE @ 584 NONAME ; ## + _ZTIN3Alf14AlfVariantTypeE @ 585 NONAME ; ## + _ZTIN3Alf16AlfLayoutManagerE @ 586 NONAME ; ## + _ZTIN3Alf17AlfVisualTemplateE @ 587 NONAME ; ## + _ZTIN3Alf17CAlfWidgetControlE @ 588 NONAME ; ## + _ZTIN3Alf20AlfFlowLayoutManagerE @ 589 NONAME ; ## + _ZTIN3Alf20AlfGridLayoutManagerE @ 590 NONAME ; ## + _ZTIN3Alf20AlfLayoutManagerImplE @ 591 NONAME ; ## + _ZTIN3Alf21AlfAttributeValueTypeE @ 592 NONAME ; ## + _ZTIN3Alf22AlfAnchorLayoutManagerE @ 593 NONAME ; ## + _ZTIN3Alf23AlfFlowLayoutPolicyImplE @ 594 NONAME ; ## + _ZTIN3Alf23AlfGridLayoutPolicyImplE @ 595 NONAME ; ## + _ZTIN3Alf23AlfRecyclingGridElementE @ 596 NONAME ; ## + _ZTIN3Alf24AlfCommonAttributeSetterE @ 597 NONAME ; ## + _ZTIN3Alf24AlfGridLayoutManagerImplE @ 598 NONAME ; ## + _ZTIN3Alf26AlfAnchorLayoutManagerImplE @ 599 NONAME ; ## + _ZTIN3Alf26TAlfWidgetAttributeCommandE @ 600 NONAME ; ## + _ZTIN3Alf27AlfWidgetAttributeOwnerImplE @ 601 NONAME ; ## + _ZTIN3Alf27AlfWidgetControlEventFilterE @ 602 NONAME ; ## + _ZTIN3Alf28AlfDeckLayoutAttributeSetterE @ 603 NONAME ; ## + _ZTIN3Alf28AlfElementAttributeOwnerImplE @ 604 NONAME ; ## + _ZTIN3Alf28AlfFlowLayoutAttributeSetterE @ 605 NONAME ; ## + _ZTIN3Alf28AlfFlowLayoutPreferencesImplE @ 606 NONAME ; ## + _ZTIN3Alf28AlfGridLayoutAttributeSetterE @ 607 NONAME ; ## + _ZTIN3Alf28AlfLineVisualAttributeSetterE @ 608 NONAME ; ## + _ZTIN3Alf28AlfMeshVisualAttributeSetterE @ 609 NONAME ; ## + _ZTIN3Alf28AlfTextVisualAttributeSetterE @ 610 NONAME ; ## + _ZTIN3Alf29AlfImageVisualAttributeSetterE @ 611 NONAME ; ## + _ZTIN3Alf30AlfAnchorLayoutAttributeSetterE @ 612 NONAME ; ## + _ZTIN3Alf30AlfCommonLayoutAttributeSetterE @ 613 NONAME ; ## + _ZTIN3Alf30AlfCommonVisualAttributeSetterE @ 614 NONAME ; ## + _ZTIN3Alf32AlfViewportLayoutAttributeSetterE @ 615 NONAME ; ## + _ZTIN3Alf33AlfCurvePathLayoutAttributeSetterE @ 616 NONAME ; ## + _ZTIN3Alf6AlfMapE @ 617 NONAME ; ## + _ZTIN3Alf8AlfModelE @ 618 NONAME ; ## + _ZTIN3Alf9AlfBranchE @ 619 NONAME ; ## + _ZTIN3Alf9AlfWidgetE @ 620 NONAME ; ## + _ZTVN3Alf10AlfElementE @ 621 NONAME ; ## + _ZTVN3Alf12AlfAttributeE @ 622 NONAME ; ## + _ZTVN3Alf12AlfContainerE @ 623 NONAME ; ## + _ZTVN3Alf12AlfEnumValueE @ 624 NONAME ; ## + _ZTVN3Alf12AlfRealValueE @ 625 NONAME ; ## + _ZTVN3Alf14AlfHostAPIImplE @ 626 NONAME ; ## + _ZTVN3Alf14AlfStringValueE @ 627 NONAME ; ## + _ZTVN3Alf14AlfVariantTypeE @ 628 NONAME ; ## + _ZTVN3Alf16AlfLayoutManagerE @ 629 NONAME ; ## + _ZTVN3Alf17AlfVisualTemplateE @ 630 NONAME ; ## + _ZTVN3Alf17CAlfWidgetControlE @ 631 NONAME ; ## + _ZTVN3Alf20AlfFlowLayoutManagerE @ 632 NONAME ; ## + _ZTVN3Alf20AlfGridLayoutManagerE @ 633 NONAME ; ## + _ZTVN3Alf20AlfLayoutManagerImplE @ 634 NONAME ; ## + _ZTVN3Alf21AlfAttributeValueTypeE @ 635 NONAME ; ## + _ZTVN3Alf22AlfAnchorLayoutManagerE @ 636 NONAME ; ## + _ZTVN3Alf23AlfFlowLayoutPolicyImplE @ 637 NONAME ; ## + _ZTVN3Alf23AlfGridLayoutPolicyImplE @ 638 NONAME ; ## + _ZTVN3Alf23AlfRecyclingGridElementE @ 639 NONAME ; ## + _ZTVN3Alf24AlfCommonAttributeSetterE @ 640 NONAME ; ## + _ZTVN3Alf24AlfGridLayoutManagerImplE @ 641 NONAME ; ## + _ZTVN3Alf26AlfAnchorLayoutManagerImplE @ 642 NONAME ; ## + _ZTVN3Alf26TAlfWidgetAttributeCommandE @ 643 NONAME ; ## + _ZTVN3Alf27AlfWidgetAttributeOwnerImplE @ 644 NONAME ; ## + _ZTVN3Alf27AlfWidgetControlEventFilterE @ 645 NONAME ; ## + _ZTVN3Alf28AlfDeckLayoutAttributeSetterE @ 646 NONAME ; ## + _ZTVN3Alf28AlfElementAttributeOwnerImplE @ 647 NONAME ; ## + _ZTVN3Alf28AlfFlowLayoutAttributeSetterE @ 648 NONAME ; ## + _ZTVN3Alf28AlfFlowLayoutPreferencesImplE @ 649 NONAME ; ## + _ZTVN3Alf28AlfGridLayoutAttributeSetterE @ 650 NONAME ; ## + _ZTVN3Alf28AlfLineVisualAttributeSetterE @ 651 NONAME ; ## + _ZTVN3Alf28AlfMeshVisualAttributeSetterE @ 652 NONAME ; ## + _ZTVN3Alf28AlfTextVisualAttributeSetterE @ 653 NONAME ; ## + _ZTVN3Alf29AlfImageVisualAttributeSetterE @ 654 NONAME ; ## + _ZTVN3Alf30AlfAnchorLayoutAttributeSetterE @ 655 NONAME ; ## + _ZTVN3Alf30AlfCommonLayoutAttributeSetterE @ 656 NONAME ; ## + _ZTVN3Alf30AlfCommonVisualAttributeSetterE @ 657 NONAME ; ## + _ZTVN3Alf32AlfViewportLayoutAttributeSetterE @ 658 NONAME ; ## + _ZTVN3Alf33AlfCurvePathLayoutAttributeSetterE @ 659 NONAME ; ## + _ZTVN3Alf6AlfMapE @ 660 NONAME ; ## + _ZTVN3Alf8AlfModelE @ 661 NONAME ; ## + _ZTVN3Alf9AlfBranchE @ 662 NONAME ; ## + _ZTVN3Alf9AlfWidgetE @ 663 NONAME ; ## + _ZThn32_N3Alf17CAlfWidgetControl11OfferEventLERK9TAlfEvent @ 664 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControl11dataChangedEv @ 665 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControl12dataChangingERKN7osncore12AlfPtrVectorINS_17AlfModelOperationEEE @ 666 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControl12dataChangingERKNS_17AlfModelOperationE @ 667 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControl12modelChangedERNS_9IAlfModelE @ 668 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControlD0Ev @ 669 NONAME ; ## + _ZThn40_N3Alf17CAlfWidgetControlD1Ev @ 670 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl10addElementEPNS_11IAlfElementE @ 671 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl11dataIdRangeERKNS_11IAlfElementE @ 672 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl11elementDataERKNS_11IAlfElementEj @ 673 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl11enableStateEj @ 674 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl11findElementEPKc @ 675 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl11handleEventERK9TAlfEvent @ 676 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl12disableStateEj @ 677 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl12eventHandlerEi @ 678 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl13dataIdToIndexERKNS_11IAlfElementEj @ 679 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl13elementDataIdERKNS_11IAlfElementEjj @ 680 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl13makeInterfaceERKNS_4IfIdE @ 681 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl13removeElementERKNS_11IAlfElementE @ 682 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl14setDataIdRangeERKNS_11IAlfElementEj @ 683 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl15addEventHandlerEPNS_22IAlfWidgetEventHandlerEi @ 684 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl16findEventHandlerERK9TAlfEvent @ 685 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl18removeEventHandlerERNS_22IAlfWidgetEventHandlerE @ 686 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl18updatePresentationEv @ 687 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl19destroyPresentationEi @ 688 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl19parentElementDataIdERKNS_11IAlfElementEj @ 689 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl23removeAndDestroyElementERKNS_11IAlfElementE @ 690 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl25destroyVisualsAndElementsEi @ 691 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl28removeAndDestroyEventHandlerERKN7osncore7UStringE @ 692 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl28removeAndDestroyEventHandlerERNS_22IAlfWidgetEventHandlerE @ 693 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl31removePresentationEventHandlersEv @ 694 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl41removeAndDestroyPresentationEventHandlersEv @ 695 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl6widgetEv @ 696 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl7elementEi @ 697 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControl8setStateEj @ 698 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControlD0Ev @ 699 NONAME ; ## + _ZThn44_N3Alf17CAlfWidgetControlD1Ev @ 700 NONAME ; ## + _ZThn44_NK3Alf17CAlfWidgetControl10checkStateEj @ 701 NONAME ; ## + _ZThn44_NK3Alf17CAlfWidgetControl11numElementsEv @ 702 NONAME ; ## + _ZThn44_NK3Alf17CAlfWidgetControl16numEventHandlersEv @ 703 NONAME ; ## + _ZThn44_NK3Alf17CAlfWidgetControl17eventHandlerIndexERNS_22IAlfWidgetEventHandlerE @ 704 NONAME ; ## + _ZThn44_NK3Alf17CAlfWidgetControl5stateEv @ 705 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElement10offerEventERNS_17CAlfWidgetControlERK9TAlfEvent @ 706 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElement13makeInterfaceERKNS_4IfIdE @ 707 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElement15setActiveStatesEj @ 708 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElement16eventHandlerDataEv @ 709 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElement19setEventHandlerDataERKNS_29AlfWidgetEventHandlerInitDataE @ 710 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElementD0Ev @ 711 NONAME ; ## + _ZThn8_N3Alf23AlfRecyclingGridElementD1Ev @ 712 NONAME ; ## + _ZThn8_NK3Alf23AlfRecyclingGridElement6acceptERNS_17CAlfWidgetControlERK9TAlfEvent @ 713 NONAME ; ## + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/group/alfwidgetmodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/group/alfwidgetmodel.mmp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2002 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: +* Project definition file +* +*/ + + +#include +#include + +TARGET alfwidgetmodel.dll +TARGETTYPE DLL + + + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +#ifndef __WINSCW__ +EPOCALLOWDLLDATA +#endif + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// This is a SYSTEMINCLUDE macro containing the middleware +// layer specific include directories + +MW_LAYER_SYSTEMINCLUDE + + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE +OS_LAYER_BOOST_SYSTEMINCLUDE + + + +SOURCEPATH ../src +SOURCE alfwidgeteventhandler.cpp +SOURCE alfwidgeteventhandlerimpl.cpp +SOURCE alfwidget.cpp +SOURCE alfwidgetimpl.cpp +SOURCE alfwidgetcontrol.cpp +SOURCE alfelement.cpp +SOURCE alfvisualtemplate.cpp +SOURCE alfreferencetovisual.cpp +SOURCE alfanimationoutput.cpp + +SOURCE alfvarianttype.cpp +SOURCE alfmodel.cpp +SOURCE alfeventinput.cpp +SOURCE alfeventoutput.cpp +SOURCE alfrecyclinggridelement.cpp +SOURCE alfrecyclinggridelementimpl.cpp +SOURCE alfmodeloperation.cpp +SOURCE alfsort.cpp +SOURCE alfattribute.cpp +SOURCE alfattributevaluetype.cpp +SOURCE alfenumvalue.cpp +SOURCE alfrealvalue.cpp +SOURCE alfstringvalue.cpp +SOURCE alfattributecontainer.cpp +SOURCE alfhostapiimpl.cpp +SOURCE alflayoutmanager.cpp +SOURCE alflayoutmanagerimpl.cpp +SOURCE alfgridlayoutmanager.cpp +SOURCE alfgridlayoutmanagerimpl.cpp +SOURCE alfanchorlayoutmanager.cpp +SOURCE alfanchorlayoutmanagerimpl.cpp +SOURCE alfcommonattributesetter.cpp +SOURCE alfcommonvisualattributesetter.cpp +SOURCE alfimagevisualattributesetter.cpp +SOURCE alftextvisualattributesetter.cpp +SOURCE alfgridlayoutattributesetter.cpp +SOURCE alfflowlayoutattributesetter.cpp +SOURCE alfcommonlayoutattributesetter.cpp + +SOURCE alfanchorlayoutattributesetter.cpp + +SOURCE alflinevisualattributesetter.cpp +SOURCE alfcurvepathlayoutattributesetter.cpp +SOURCE alfmeshvisualattributesetter.cpp +SOURCE alfviewportlayoutattributesetter.cpp +SOURCE alfdecklayoutattributesetter.cpp + +SOURCE alfelementattributeownerimpl.cpp +SOURCE alfwidgetattributeownerimpl.cpp +SOURCE alfwidgetenvextension.cpp +SOURCE alfwidgetcommand.cpp +SOURCE alfflowlayoutmanager.cpp +SOURCE alfflowlayoutpolicyimpl.cpp +SOURCE alfflowlayoutpreferencesimpl.cpp +SOURCE alfgridlayoutpolicyimpl.cpp +SOURCE alfwidgetcontroleventfilter.cpp + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY charconv.lib + +LIBRARY libc.lib + +LIBRARY alfclient.lib + +LIBRARY osncore.lib + +LIBRARY alfwidgetutils.lib + +LIBRARY alfresourcepool.lib + LIBRARY libstdcpp.lib + +#define ALF_LINK_STDCPP_DLL +// following include must be after definition + +LIBRARY libpthread.lib +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif // RD_TACTILE_FEEDBACK + +#ifdef RD_ALF_IN_PLATFORM + +#endif +// End of file. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002 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: +* Build file +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +Alfwidgetmodel.mmp + +PRJ_TESTMMPFILES diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfanchorlayoutmanagerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfanchorlayoutmanagerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 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: anchor layoutmanager private implementation header. +* +*/ + + +#ifndef ALFANCHORLAYOUTMANAGERIMPL_H +#define ALFANCHORLAYOUTMANAGERIMPL_H + +#include +#include +#include + +using std::auto_ptr; +using Alf::AlfAnchorLayoutManager; + +class CAlfControl; +class CAlfAnchorLayout; + +namespace Alf + { + +class CAlfWidgetControl; +class AlfWidget; +class IAlfLayoutPreferences; + +/** + * layoutmanager implementation class + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfAnchorLayoutManagerImpl : public IAlfLayoutPreferences + { +public: + /** + * layout manager constructor + * + * @param aLayoutType type of layout used by the manager. + */ + AlfAnchorLayoutManagerImpl(AlfAnchorLayoutManager& aAnchorLayoutManager); + + /** + * destructor + */ + ~AlfAnchorLayoutManagerImpl(); + +public: +// from base class IAlfLayoutPreferences + + /** + * Returns the minimum size of the layout by combining the minimum sizes of the + * layed out visuals. + * + * @param aMinSize The minimum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about minimum size + */ + virtual bool getMinimumSize( TAlfXYMetric& aMinSize ) const; + + /** + * Returns the maximum size of the layout by combining the maximum sizes of the + * layed out visuals. + * + * @param aMaxSize The maximum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about maximum size + */ + virtual bool getMaximumSize( TAlfXYMetric& aMaxSize ) const; + + /** + * Returns the size combined by all preferred sizes of child UI elements in this layout + * when they are being layed out according to the layout manager rules. + * + * @param aPreferredSize Filled with the referred area occupied by child elements when + * layed out by layouting rules in this layout manager. + * @return False if none of the child components report their preferred size. True + * otherwise. + */ + virtual bool getPreferredSize(TAlfXYMetric& aPreferredSize) const; + + /** + * Set the preferred size into a presentation object. + * + * This is not supported on the layout manager. Users should set preferred sizes of the + * contained UI elements. + */ + virtual void setPreferredSize( const TAlfXYMetric& aPreferredSize ); + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: + /** + * returns the anchorlayout used by the layoutmanager. + */ + CAlfAnchorLayout& layout() const; +private: + + AlfAnchorLayoutManager & mAnchorLayoutManager; + + }; + + } // namespace Alf + +#endif // ALFANCHORLAYOUTMANAGERIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfanimationoutput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfanimationoutput.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2007 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: Animation class for alfred widget model. + This class creates the animation and commands. +* +* +*/ + + + + +#ifndef ALF_ANIMATIONOUTPUT_H +#define ALF_ANIMATIONOUTPUT_H + +#include +// FORWARD DECLARATIONS +class CAlfControl; +class CAlfVisual; +namespace Alf + { +// FORWARD DECLARATIONS +class IAlfAttributeSetter; +class AlfReferenceToVisual; +class AlfAttributeContainer; + +/** + * @class AlfAnimationOutput alfanimationoutput.h "alfanimationoutput.h" + * Class for creating a command for setting or animating + * visual attribute values. Animation sequences can be created + * by specifying delay parameters. The target attribute value + * can be specified relatively to a reference visual. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class AlfAnimationOutput + { +public: + /** + * Constructor. + * + * @since S60 ?S60_version + * + * @param aTargetVisual Reference to the animated visual. + * @param aReferenceVisual Reference to the visual with the reference value, + * or NULL if no reference value is used. + * @param aAttributeSetter The attribute setter for animating the attribute + * using Hitchcock commands. Ownership is transferred. + * + * @param aAttributeContainer The attribute container holding the attribute + * value(s) used by the attribute setter. Ownership is transferred, if the method does not + * throw an exception. The container can hold new values for multiple different + * attributes, in which case all of them are applied when the animation output + * is triggered. + * + * @param aAnimationTime The duration of the animation. Note that this parameter + * is used only if the transition time parameter is not defined in the + * corresponding attribute in the attribute container. + * + * @param aDelay The delay in microseconds before starting the animation. + * Note that this parameter is used only if the delay parameter is not defined in the + * corresponding attribute in the attribute container. + */ + OSN_IMPORT AlfAnimationOutput(AlfReferenceToVisual* aTargetVisual, + AlfReferenceToVisual* aReferenceVisual, + IAlfAttributeSetter* aAttributeSetter, + AlfAttributeContainer* aAttributeContainer, + unsigned int aAnimationTime, unsigned int aDelay); + + /** Destructor. No derived classes, therefore not virtual. */ + OSN_IMPORT ~AlfAnimationOutput(); + + + /** + * Create and send the animation command. + * @exception osncore::AlfVisualException Thrown with EInvalidVisual if reference visual or \n + * target visual is invalid . + * + * @since S60 ?S60_version + * @param aControl The control to find the animated visual and + * the reference visual. + * @param aDataID The data ID used to create the animated visual + * and the reference visual. The caller + * is responsible for determining what data ID + * is related to the visuals. The visual references + * may or may not use the given data ID. + * @return The visual, or NULL if the visual was not found. + */ + OSN_IMPORT void sendCommand(CAlfWidgetControl& aControl, unsigned int aDataID); + +private: + // Reference to the animated visual. Owned. + AlfReferenceToVisual* mTargetVisual; + // Reference to the visual with the reference value. Owned. + AlfReferenceToVisual* mReferenceVisual; + // The attribute setter. Owned. + IAlfAttributeSetter* mAttributeSetter; + // The attribute value container. Owned. + AlfAttributeContainer* mAttributeContainer; + // The duration of the animation. + unsigned int mAnimationTime; + // The delay before sending the animation command. + unsigned int mDelay; + }; + + } // namespace Alf + +#endif //ALF_ANIMATIONOUTPUT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfelementattributeownerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfelementattributeownerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2007 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: Implementation of the IAlfAttributeOwner interface +* for AlfElement. +* +*/ + + +#ifndef __ALFELEMENTATTRIBUTEOWNERIMPL_H__ +#define __ALFELEMENTATTRIBUTEOWNERIMPL_H__ + +#include "alf/ialfattributeowner.h" +#include + +namespace Alf + { + +class AlfElement; + +/** + * Implementation of the IAlfAttributeOwner interface for AlfElement. + */ +class AlfElementAttributeOwnerImpl : public IAlfAttributeOwner + { +public: + + /** + * Constructor. + * + * @param aElement Reference to owner element. + * @param aControl Reference to control + */ + AlfElementAttributeOwnerImpl(AlfElement& aElement, + CAlfWidgetControl& aControl); + + /** + * Destructor. + */ + virtual ~AlfElementAttributeOwnerImpl(); + +// from base class IAlfInterfaceBase + + /** + * Getter for interfaces provided by the element classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + +// from base class IAlfAttributeOwner + + /** + * Get the number of available attributes. + * + * @return The number of attributes. + */ + virtual int attributeCount() const; + + /** + * Gets the attribute with the given name. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aAttribName The name of the attribute. + * @return The attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute(const UString& aAttribName) const; + + /** + * Gets the attribute with the given name from specific target. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName The name of the attribute. + * @return A pointer to the attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute( const UString& aTargetId , + const UString& aAttribName ) const; + /** + * Set a value of an attribute. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute(const AlfAttribute& aAttribute); + + /** + * Sets a value of an attribute to a specific target. + * The target is identified by using aTargetId parameter. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId , + AlfAttribute& aAttribute ); + /** + * Set a value of an attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute(const UString& aAttribName, + AlfAttributeValueType* aValue); + + /** + * Sets a value of an static attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId, + const UString& aAttribName, + AlfAttributeValueType* aValue ); + + /** + * Sets values of each attribute in given container to a specific target. + * The target is identified by using aTargetId parameter. + * + * When the target attributeowner instance cannot handle an attribute in the container, + * an AlfAttributeException-exception is thrown with EInvalidAttribute parameter. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * @return True if all attributes were supported, false if not. + */ + virtual bool setAttributeContainer( const UString& aTargetId , + AlfAttributeContainer& aAttributeContainer ); + + /** + * Sets values of each attribute in given container + * + * When an attributeowner-instance (which can handle some of the attributes in the container) + * cannot handle an attribute in the container, + * an AlfAttributeException-exception is thrown with EInvalidAttribute parameter. + * + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * + * @return True if all attributes were supported, false if not. + */ + virtual bool setAttributeContainer( AlfAttributeContainer& aAttributeContainer ); + + +private: + + /** + * Handles the attribute, sets proper values. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + */ + void handleAttribute(AlfAttribute& aAttribute); + + /** + * Can attribute be handled with this widget. + * + * @param aAttributeName Name of the attribute. + * @return True if attribute is supported, false elsewhere. + */ + bool canHandleAttribute(const char* aAttributeName); + + /** + * Handles the Opacity Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handleOpacityAttribute(AlfAttribute& aAttribute); + + /** + * Handles the Position Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handlePositionAttribute(AlfAttribute& aAttribute); + + /** + * Handles the Tactile Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handleTactileAttribute(AlfAttribute& aAttributeEvent,AlfAttribute& aAttributeFeedback); + + /** + * Handles the Size Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handleSizeAttribute(AlfAttribute& aAttribute); + + /** + * Handles the Max Size Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handleMaxSizeAttribute(AlfAttribute& aAttribute); + + /** + * Handles the Min Size Attribute. + * + * @param aAttribute the attribute to be handled. + */ + void handleMinSizeAttribute(AlfAttribute& aAttribute); + + /** + * Handles setting of paired attributes: width & height, xpos & ypos etc. + * + * @param aAttribute the attribute to be handled. + * @param aAttributeNamePair name for the pair attribute of aAttribute. + */ + bool handleAttributePairs(AlfAttribute& aAttribute, + const char* aAttributeNamePair); + +private: + + /* + * Reference to owner element. Not own. + */ + AlfElement& mElement; + + /* + * Reference to control. + */ + CAlfWidgetControl& mControl; + + /* + * Array of attributes set through IAlfAttributeOwner interface. Own. + */ + AlfPtrVector mAttributeList; + }; + + } // namespace Alf + +#endif // __ALFELEMENTATTRIBUTEOWNERIMPL_H__ diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfenumvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfenumvalue.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2007 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: Class for enumValue for attributes.. +* +*/ + + +#ifndef ALFENUMVALUE_H +#define ALFENUMVALUE_H + +//INCLUDES +#include +#include +#include "alf/alfattributevaluetype.h" + +// FORWARD DECLARATIONS + +using std::auto_ptr; + +namespace Alf + { + +/** + * A class for enum value type. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfEnumValue : public AlfAttributeValueType + { + +public: + + /** + * Constructor. + * + * @since S60 ?S60_version + * @return New object. + */ + AlfEnumValue(int aValue, TAlfUnit aUnit = EAlfUnitPixel); + + /** + * Destructor. + */ + virtual ~AlfEnumValue(); + + /** + * Gets the enum value. + * + * @since S60 ?S60_version + * @return The enum value. + */ + int virtual enumValue() const; + + /** + * Gets the type of the atrribute value. + * + * @since S60 ?S60_version + * @return The type of the value. + */ + virtual Type type() const; + + /** + * Gets the unit. + * + * @since S60 ?S60_version + * @return The unit. + */ + virtual TAlfUnit unit() const; + +private: // data + + int mEnum; + TAlfUnit mUnit; + + }; + + } // namespace Alf + +#endif // ALFENUMVALUE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfeventinput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfeventinput.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2007 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: Class for various input events, including custom events. +* +*/ + + +#ifndef ALFEVENTINPUT_H +#define ALFEVENTINPUT_H + +#include +#include +#include +#include +class TAlfEvent; + +using namespace std; +using namespace osncore; + +namespace Alf + { + +class CAlfWidgetControl; +class AlfReferenceToVisual; +class AlfAttribute; + +// bit definitions in the received key events +enum + { + eventBitLeftAlt =0x00000004, + eventBitRightAlt =0x00000008, + eventBitAlt =0x00000010, + eventBitLeftCtrl =0x00000020, + eventBitRightCtrl =0x00000040, + eventBitCtrl =0x00000080, + eventBitLeftShift =0x00000100, + eventBitRightShift =0x00000200, + eventBitShift =0x00000400, + eventBitLeftFunc =0x00000800, + eventBitRightFunc =0x00001000, + eventBitFunc =0x00002000, + eventBitCapsLock =0x00004000, + eventBitNumLock =0x00008000, + eventBitScrollLock =0x00010000 + }; + +/** + * Event input, which may be either a custom event or a key event. + * Internal. + */ +OSN_NONSHARABLE_CLASS( AlfEventInput ) + { +public: +public: + /** + * accepts the event. + */ + bool accept( const TAlfEvent& aEvent ) const; + +public: // data + AlfEventInput(int, int, int, int); + // Event type flags, combination of EventTypeFlags values + int mEventTypeFlags; + // Key or custom event id + int mEventID; + // Custom event data, if used + int mEventData; + // Key event modifiers + int mKeyEventModifiers; + }; + +/** + * Pointer event input. + * Internal. + */ +OSN_NONSHARABLE_CLASS( AlfPointerEventInput ) //: public CBase + { +public: + /** + * constructor. + */ + AlfPointerEventInput(const char* aElementName, const char* aVisualName, + WidgetPointerEvent aEvent ); + + /** + * Destructor. + */ + virtual ~AlfPointerEventInput(); + +public: + /** + * accept the event. + */ + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + +private: + AlfPointerEventInput(); + +private: // data + + auto_ptr mVisualRef; + WidgetPointerEvent mEvent; + }; +OSN_NONSHARABLE_CLASS( AlfWidgetAttributeInput ) + { +public: + /** + * Constructor. + */ + AlfWidgetAttributeInput( AlfAttribute& aAttribute, + const char* aElementId ); + + ~AlfWidgetAttributeInput(); + +public: + /** + * Executes the event output. + */ + void execute( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + bool accept(const TAlfEvent& aEvent) const; + +private: + /** + * constructor + */ + AlfWidgetAttributeInput(); + +private: // data + AlfAttribute* mAttr; + // Reference to element + UString mElementId; + }; +OSN_NONSHARABLE_CLASS( AlfEventPasserInput ) + { +public: + /** + * Constructor. + */ + AlfEventPasserInput( int aEventId, int aEventData ); + + ~AlfEventPasserInput(); + +public: + + bool accept(const TAlfEvent& aEvent) const; + +private: + /** + * constructor + */ + AlfEventPasserInput(); + +private: // data + int mEventId; + int mEventData; + }; + } // namespace Alf + +#endif // ALFEVENTINPUT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfeventoutput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfeventoutput.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2007 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: Class for various output events, including custom events. +* +*/ + + +#ifndef ALFEVENTOUTPUT_H +#define ALFEVENTOUTPUT_H + + +#include +#include +#include + +#include +#include +using namespace osncore; + +#include +using namespace std; + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif // RD_TACTILE_FEEDBACK + +namespace Alf + { + +class CAlfWidgetControl; +class AlfReferenceToVisual; +class IAlfVariantType; +class AlfAttribute; +class IAlfEventOutputSignalSubscriber; +class IAlfAppEventListener; + +/** + * Event output. Internal. + */ +OSN_NONSHARABLE_CLASS( AlfEventOutput ) + { +public: + + /** + * If the event is to be broadcast, aTargetWidget is set to an empty string. + */ + AlfEventOutput(int aEventType, int aEventID, const char* aTargetWidget, unsigned int aDelay ); + + ~AlfEventOutput(); + +public: + /** + * Executes the event output. + */ + void execute( const CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + +private: + AlfEventOutput(); + +public: // data + + int mEventType; // either custom or key event + int mEventID; + UString mTargetWidget; // Empty string if the event is to be broadcast. + unsigned int mDelay; + }; + +/** + * Event cancel output. Internal. + */ +OSN_NONSHARABLE_CLASS( AlfEventCancelOutput ) + { +public: + /** + * constructor. + */ + AlfEventCancelOutput( const char* aTargetWidget, int aEventID, bool aCancelAll ); + + ~AlfEventCancelOutput(); + +public: + /** + * Executes the event output. + */ + void execute( const CAlfWidgetControl& aControl ); + /** + * returns target widget id. + */ + inline const UString& targetWidget() const + { + return mTargetWidget; + } + +private: + /** + * cancels the excecution. + */ + AlfEventCancelOutput(); + +private: // data + + UString mTargetWidget; + int mEventID; + bool mCancelAll; + }; + +/** + * Animation Event cancel output. Internal. + */ +OSN_NONSHARABLE_CLASS( AlfAnimationCancelOutput ) + { +public: + /** + * constructor. + */ + AlfAnimationCancelOutput(const char* aElementName,const char* aVisualName, TAlfOp aOperation, bool aCancelAll ); + /** + * destructor. + */ + ~AlfAnimationCancelOutput(); + +public: + /** + * excecutes the command. + */ + void execute( CAlfWidgetControl& aControl, int aDataID ); + +private: + /** + * constructor + */ + AlfAnimationCancelOutput(); + + +private: // data + + auto_ptr mVisualRef; + TAlfOp mOperation; + bool mCancelAll; + }; + + +OSN_NONSHARABLE_CLASS( AlfWidgetAttributeOutput ) + { +public: + /** + * Constructor. + */ + AlfWidgetAttributeOutput( AlfAttribute& aAttribute, + const char* aWidgetId ); + + ~AlfWidgetAttributeOutput(); + +public: + /** + * Executes the event output. + */ + void execute( CAlfWidgetControl& aControl ); + +private: + /** + * constructor + */ + AlfWidgetAttributeOutput(); + +private: // data + AlfAttribute* mAttr; + + // Reference to outside widget + UString mWidgetId; + }; + +/** + * State change output. Internal. + */ +OSN_NONSHARABLE_CLASS( AlfStateChangeOutput ) + { +public: + /** + * constructor. + * + * @exception Alf::AlfWidgetException value osncore::EInvalidWidget + * if aTaretWidget is NULL or empty + * @exception Alf::AlfWidgetException value osncore::EInvalidArgument + * if aDisableStates and aEnableStates have a common bit set + */ + AlfStateChangeOutput( const char* aTargetWidget, uint aEnableStates, uint aDisableStates ); + + ~AlfStateChangeOutput(); + +public: + /** + * Executes the event output. + */ + void execute( const CAlfWidgetControl& aControl ); + + /** + * returns target widget id. + */ + inline const UString& targetWidget() const + { + return mTargetWidget; + } + +private: // data + + UString mTargetWidget; + uint mEnableStates; + uint mDisableStates; + }; + + +#ifdef RD_TACTILE_FEEDBACK +OSN_NONSHARABLE_CLASS( AlfTactileOutput ) + { +public: + + /** + * Constructor. + */ + AlfTactileOutput( TTouchLogicalFeedback aFeedbackType ); + + /** + * Destructor. + */ + ~AlfTactileOutput(); + +public: + + /** + * Executes the event output. + */ + void execute(); + +private: + + /** + * Constructor. + */ + AlfTactileOutput(); + +private: // data + + TTouchLogicalFeedback mFeedbackType; + + }; + +#endif // RD_TACTILE_FEEDBACK + +/** + * Event output signal. + */ +OSN_NONSHARABLE_CLASS( AlfEventOutputSignal ) + { +public: + explicit AlfEventOutputSignal( IAlfEventOutputSignalSubscriber& aSubscriber ); + + ~AlfEventOutputSignal(); + + /** + * Executes the event output. + */ + void execute(); + +private: // data + IAlfEventOutputSignalSubscriber* mSubscriber; + }; + +OSN_NONSHARABLE_CLASS( AlfEventPasserOutput) + { +public: + + /** + * Constructor. + */ + AlfEventPasserOutput( const char* aSourceWidget , const char* aTargetWidget ); + + /** + * Constructor. Occurred event is mapped to a new event (specified by aNewEventId) + */ + AlfEventPasserOutput::AlfEventPasserOutput( const char* aSourceWidget , const char* aTargetWidget, + int aNewEventId , int aNewEventCustomData ); + /** + * Destructor. + */ + ~AlfEventPasserOutput(); + +public: + + /** + * Executes the event output. + */ + void execute( const CAlfWidgetControl* aControl , const TAlfEvent& aEvent ); + +private: + + /** + * Constructor. + */ + AlfEventPasserOutput(); + +private: // data + + const char* mSourceWidget; + const char* mTargetWidget; + bool mEventMappingData; + int mNewEventId; + int mNewEventCustomData; + }; + +/** + * Application Event output. + */ +OSN_NONSHARABLE_CLASS( AlfAppEventOutput ) + { +public: + explicit AlfAppEventOutput( const UString& aCmd, IAlfAppEventListener& aAppEvent ); + + ~AlfAppEventOutput(); + + /** + * Executes the event output. + */ + void execute(const TAlfEvent& aEvent); + +private: // data + IAlfAppEventListener* mAppEvent; + UString mCmd; + }; + + } // namespace Alf + +#endif // ALFEVENTOUTPUT_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfflowlayoutpolicyimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfflowlayoutpolicyimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2007 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: flow layout policy implementation. +* +*/ + + +#ifndef ALFFLOWLAYOUTPOLICYIMPL_H +#define ALFFLOWLAYOUTPOLICYIMPL_H + +#include +#include + +using std::auto_ptr; + +class CAlfFlowLayout; + +using namespace Alf; + +namespace Alf + { +class AlfFlowLayoutManager; + +/** + * flow layout policy implementation + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfFlowLayoutPolicyImpl : public IAlfFlowLayoutPolicy + { +public: + /** + * layout policy constructor + * + * @param aFlowLayoutManager flow layout manager instance + */ + AlfFlowLayoutPolicyImpl(AlfFlowLayoutManager& aFlowLayoutManager); + + /** + * destructor + */ + ~AlfFlowLayoutPolicyImpl(); + +public: +//from IAlfFlowLayoutPolicy + + /** + * Sets the direction of the flow. + * + * @param aDirection Flow direction. + */ + virtual void setFlowDirection(enum flowDirection aDirection); + + /** + * returns the flow direction + * + * @param aDirection Flow direction. + */ + virtual enum flowDirection flowDirection() const; + + /** + * Sets the mode of the flow. The mode flags determine how the flow layout + * behaves. + * + * @param aMode Mode flags (OR'd together). + * + * @see IAlfFlowLayoutPolicy::flowModeFlags + */ + virtual void setMode(int aMode); + + /** + * Returns the mode flags of the flow. + * + * @see IAlfFlowLayoutPolicy::flowModeFlags + * + * @return Returns the current mode flags. + */ + virtual int mode() const; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: + /** + * returns the native flowlayout used by the implementation. + */ + CAlfFlowLayout& layout() const; +private: + + AlfFlowLayoutManager &mFlowLayoutManager; + enum IAlfFlowLayoutPolicy::flowDirection mDirection; + + }; + + } // namespace Alf + +#endif // ALFFLOWLAYOUTPOLICYIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfflowlayoutpreferencesimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfflowlayoutpreferencesimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007 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: layoutpreferences implementation class for flowlayoutmanager +* +*/ + + +#ifndef ALFFLOWLAYOUTPREFERENCESIMPL_H +#define ALFFLOWLAYOUTPREFERENCESIMPL_H + +#include +#include + +using namespace Alf; + +namespace Alf + { +class AlfFlowLayoutManager; + +/** + * layout preferences implementation for flowlayoutmanager. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfFlowLayoutPreferencesImpl : public IAlfLayoutPreferences + { +public: + AlfFlowLayoutPreferencesImpl(AlfFlowLayoutManager& aFlowLayoutManager); +public: +// from base class IAlfLayoutPreferences + + /** + * Returns the minimum size of the layout by combining the minimum sizes of the + * layed out visuals. + * + * @param aMinSize The minimum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about minimum size + */ + virtual bool getMinimumSize( TAlfXYMetric& aMinSize ) const; + + /** + * Returns the maximum size of the layout by combining the maximum sizes of the + * layed out visuals. + * + * @param aMaxSize The maximum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about maximum size + */ + virtual bool getMaximumSize( TAlfXYMetric& aMaxSize ) const; + + /** + * Returns the size combined by all preferred sizes of child UI elements in this layout + * when they are being layed out according to the layout manager rules. + * + * @param aPreferredSize Filled with the referred area occupied by child elements when + * layed out by layouting rules in this layout manager. + * @return False if none of the child components report their preferred size. True + * otherwise. + */ + virtual bool getPreferredSize(TAlfXYMetric& aPreferredSize) const; + + /** + * Set the preferred size into a presentation object. + * + * This is not supported on the layout manager. Users should set preferred sizes of the + * contained UI elements. + */ + virtual void setPreferredSize( const TAlfXYMetric& aPreferredSize ); +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::makeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); +protected: + + /** size type to calculate @see calculateChildSizes */ + enum sizeType + { + ESizePreferred, + ESizeMin, + ESizeMax + }; + + /** + * calculate the min-, preferred-, or max- sizes from the children. + * + * @param aSize on return, contains the calculated size. + * @param aFlowDirection direction of flow. + * @param aSizeType specifies, whether the min-, preferred- or max-size of the + * IAlfLayoutPreferences is used for calculation. + */ + bool calculateChildSizes(TAlfXYMetric& aSize, + enum IAlfFlowLayoutPolicy::flowDirection aFlowDirection, + enum sizeType aSizeType) const; + + /** + * fetches the size from the IAlfLayoutPreferences-interface of the aControl. + * + * @param aControl control, which preferences-interface to query. + * @param aSize on return, contains the size. + * @param aSizeType specifies, whether the min-, preferred- or max-size of the + * IAlfLayoutPreferences is returned. + */ + bool getSize(CAlfWidgetControl* aControl, + TAlfXYMetric& aSize, + enum sizeType aSizeType) const; + + /** + * @return the flow layout policy-instance of the layoutmanager. + * + */ + const IAlfFlowLayoutPolicy& flowLayoutPolicy() const; + + /** + * converts size in metrics to size in pixels. Implementation missing. + * + * @param aSize size to convert + * @return size in pixels. + */ + static TAlfRealSize sizeInPixels(const TAlfXYMetric& aSize); + +private: + AlfFlowLayoutManager &mFlowLayoutManager; + TAlfXYMetric mPreferredSize; + }; + + } // namespace Alf + +#endif // ALFFLOWLAYOUTPREFERENCESIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfgridlayoutmanagerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfgridlayoutmanagerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 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: grid layoutmanager private implementation header. +* +*/ + + +#ifndef ALFGRIDLAYOUTMANAGERIMPL_H +#define ALFGRIDLAYOUTMANAGERIMPL_H + +#include +#include +#include + +using std::auto_ptr; +using Alf::AlfGridLayoutManager; + +class CAlfControl; +class CAlfGridLayout; + +namespace Alf + { + +class CAlfWidgetControl; +class AlfWidget; +class IAlfLayoutPreferences; + +/** + * layoutmanager implementation class + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfGridLayoutManagerImpl : public IAlfLayoutPreferences + { +public: + /** + * layout manager constructor + * + * @param aLayoutType type of layout used by the manager. + */ + AlfGridLayoutManagerImpl(AlfGridLayoutManager& aGridLayoutManager); + + /** + * destructor + */ + ~AlfGridLayoutManagerImpl(); + +public: +// from base class IAlfLayoutPreferences + + /** + * Returns the minimum size of the layout by combining the minimum sizes of the + * layed out visuals. + * + * @param aMinSize The minimum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about minimum size + */ + virtual bool getMinimumSize( TAlfXYMetric& aMinSize ) const; + + /** + * Returns the maximum size of the layout by combining the maximum sizes of the + * layed out visuals. + * + * @param aMaxSize The maximum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about maximum size + */ + virtual bool getMaximumSize( TAlfXYMetric& aMaxSize ) const; + + /** + * Returns the size combined by all preferred sizes of child UI elements in this layout + * when they are being layed out according to the layout manager rules. + * + * @param aPreferredSize Filled with the referred area occupied by child elements when + * layed out by layouting rules in this layout manager. + * @return False if none of the child components report their preferred size. True + * otherwise. + */ + virtual bool getPreferredSize(TAlfXYMetric& aPreferredSize) const; + + /** + * Set the preferred size into a presentation object. + * + * This is not supported on the layout manager. Users should set preferred sizes of the + * contained UI elements. + */ + virtual void setPreferredSize( const TAlfXYMetric& aPreferredSize ); + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: + /** + * returns the gridlayout used by the layoutmanager. + */ + CAlfGridLayout& layout() const; +private: + + AlfGridLayoutManager &mGridLayoutManager; + + }; + + } // namespace Alf + +#endif // ALFGRIDLAYOUTMANAGERIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfgridlayoutpolicyimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfgridlayoutpolicyimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2008 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: grid layoutpolicy private implementation header. +* +*/ + + +#ifndef ALFGRIDLAYOUTPOLICYIMPL_H +#define ALFGRIDLAYOUTPOLICYIMPL_H + +#include +#include +#include + +using std::auto_ptr; +using Alf::AlfGridLayoutManager; + +class CAlfControl; +class CAlfGridLayout; + +namespace Alf + { + +class CAlfWidgetControl; +class AlfWidget; +class IAlfGridLayoutPolicy; + +/** + * layoutmanager implementation class + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfGridLayoutPolicyImpl : public IAlfGridLayoutPolicy + { +public: + /** + * layout manager constructor + * + * @param aLayoutType type of layout used by the manager. + */ + AlfGridLayoutPolicyImpl(AlfGridLayoutManager& aGridLayoutManager); + + /** + * destructor + */ + ~AlfGridLayoutPolicyImpl(); + + + +public: + // from IAlfGridLayoutPolicy + + /** + * Sets the number and weights of blocks in this grid layout in the direction of the specified + * dimension. Each block's weight will be set to equal the supplied value, the result + * of which is that all blocks will be equally spaced, whatever the units. + * + * @see appendWeight; for more information on how weights are used to calculate layout positions. + * + * @note This API could be useful if then subsequent calls to @c replaceWeight are made to + * change specific values, depending on how many of the values are different. + * @note Calling this with aCount set to 0 will clear all of the existing weights in the direction + * of the specified dimension. + * @note this is the same as using metrics with unit type EAlfUnitWeight. + * + * @param aDim the dimension along which to fill + * @param aCount The number of lines of blocks to fill + * @param aWeight the weights to be used for all blocks + * @throw AlfVisualException(EInvalidArgument), if aPos is out of bounds + */ + virtual void fillWeights(IAlfGridLayoutPolicy::gridLayoutDimension aDim, int aCount, const TAlfMetric& aWeight); + + /** + * Add a new line of blocks to this grid layout at the last position in the direction of the + * specified dimension. It will have the supplied weight. Weights can be any metric value, + * hence different units can be used for each block. In particular, EAlfUnitWeight can be used + * to represent weight values in aribtrary proportional units. + * + * In the case of proportional weights, the effect of this will be to cause the other blocks to + * resize according to the new total weight. + * + * @note If non-relative coordinates are specified (e.g., real pixels), the combined blocks might not + * fill the entire layout area. However, weights will always stretch to fill all available space + * after the fixed units have been determined. Therefore, depending on circumstances it may + * be better to use EAlfUnitWeight + * @note For example [2 weights, 1 weight, 2 weights] in a layout of 100 pixels would result + * in [40 pixels, 20 pixels, 40 pixels]. + * @note For example [10 pixels, 1 weight, 15 pixels] in a layout of 100 pixels would result + * in [10 pixels, 75 pixels, 15 pixels]. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that block + * @throw AlfVisualException(ECommonError), if memory allocation error + */ + virtual void appendWeight(IAlfGridLayoutPolicy::gridLayoutDimension aDim, const TAlfMetric& aWeight); + + /** + * Add a new line of blocks to this grid layout at the specified position in the direciton of + * the specified dimension. It will have the supplied weight. In the case of proportional + * weights, the effect of this will be to cause the other blocks to resize according to the new + * total weight. It will also mean that many child visuals will now occupy different blocks within + * the grid according to how the blocks wrap. + * + * @note will leave if the specified position is greater than the number of objects currently in the array, + * so check first by calling @c preferredDimensionCount + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that block + * @param aPos the index of the block + * @throw AlfVisualException(EInvalidArrayIndex), if aPos is out of bounds + */ + virtual void insertWeight(IAlfGridLayoutPolicy::gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos); + + /** + * Sets the weight of a specific line of blocks in this grid layout, in the direction of the supplied dimension. + * In the case of proportional weights, the effect of this will be to cause the + * other blocks to resize according to the new total weight. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aWeight the weight to be used for the block in the specified dimension, + * replacing any previously existing weight for that cell + * @param aPos the index of the cell + * @throw AlfVisualException(EInvalidArrayIndex), if aPos is out of bounds + */ + virtual void replaceWeight(IAlfGridLayoutPolicy::gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos); + + /** + * Remove a line of blocks from this grid layout at the specified position in the + * specified dimension. In the case of proportional weights, the effect of this will + * be to cause the other blocks to resize according to the new total weight. It will also mean + * that many child visuals will now occupy different blocks within the grid according to how + * the blocks wrap. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aPos the index of the cell + * @throw AlfVisualException(EInvalidArrayIndex), if aPos is out of bounds + */ + virtual void removeWeight(IAlfGridLayoutPolicy::gridLayoutDimension aDim, int aPos); + + /** + * Returns the weight of a specific line of blocks in this grid layout, in the + * specified dimension. + * + * @see appendWeight for more information on how weights are used to calculate layout positions. + * + * @param aDim the dimension to which the weight corresponds + * @param aPos the index of the cell + * @return the weight being used for the cell in the specified dimension, will be 0 magnitude if not set + * @throw AlfVisualException(EInvalidArrayIndex), if aPos is out of bounds + */ + virtual TAlfMetric weight(IAlfGridLayoutPolicy::gridLayoutDimension aDim, int aPos) const; + + /** + * Return the number of lines of blocks in this grid, along the specified dimension + * + * @param aDim the dimension along which to count + * @return The number of lines of blocks in this grid. + */ + virtual int count(IAlfGridLayoutPolicy::gridLayoutDimension aDim) const; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: + /** + * returns the gridlayout used by the layoutmanager. + */ + CAlfGridLayout& layout() const; +private: + + AlfGridLayoutManager &mGridLayoutManager; + + }; + + } // namespace Alf + +#endif // ALFGRIDLAYOUTPOLICYIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfhostapiimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfhostapiimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2007 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: The private implementation of AlfHostAPI. +* +*/ + + +#ifndef ALFHOSTAPIIMPL_H +#define ALFHOSTAPIIMPL_H + +#include +#include +#include + +#include "ialfhostapi.h" + +namespace Alf + { + +class CAlfWidgetControl; +class AlfWidget; +/** + * The private implementation of CAlfHostAPIImpl. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfHostAPIImpl:public IAlfHostAPI + { +public: + + /** + * Constructor. + * + * @since S60 ?S60_version + */ + AlfHostAPIImpl(); + + /** + * Destructor. + * + * @since S60 ?S60_version + */ + virtual ~AlfHostAPIImpl(); + + /** + * Set the host control.Should be set before any IAlfHostAPI call is made + */ + void setHostControl(CAlfWidgetControl& aControl); + /** + * setConnection. + * + * @since S60 ?S60_version + */ + void setConnection(CAlfWidgetControl& aControl, AlfRole aRole); + /** + * getConnection. + * + * @since S60 ?S60_version + */ + CAlfWidgetControl* getConnection(int aIndex) const; + + /** + * gets the number of connections + * + * @since S60 ?S60_version + */ + int getConnectionCount() const; + + /** + * gets the connection index of aControl + * + * @since S60 ?S60_version + * @param aControl control, which index to return. + */ + int getConnectionIndex(CAlfWidgetControl& aControl) const; + + /** + * removeConnection. + * + * @since S60 ?S60_version + */ + void removeConnection(CAlfWidgetControl& aControl); + /** + * setBaseLayout. + * + * @since S60 ?S60_version + */ + void setBaseLayout(IAlfLayoutManager& aLayout); + /** + * getBaseLayout. + * + * @since S60 ?S60_version + */ + IAlfLayoutManager* getBaseLayout() const; + /** + * Template getter for interfaces provided by the control classes. + * The type of the queried interface is specified by the + * template parameter. + * + * @since S60 ?S60_version + * @param aControl The control to get the interface for. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + template + static T* makeInterface( AlfHostAPIImpl* aControl ); + /** + * From MAlfInterfaceBase. + * Getter for interfaces provided by the control classes. + * Derived classes should always call the base class method + * from the overridden makeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); +private: + /** + * Base layout of container widget. + */ + auto_ptr mBaseLayout; + /** + * Host control for IAlfHostAPIs. Not Owned. + */ + CAlfWidgetControl *mHostControl; + }; //class AlfHostAPIImpl + } // namespace Alf + +#endif // C_ALFHOSTAPIIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alflayoutmanagerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alflayoutmanagerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2007 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: layoutmanager implementation header. +* +*/ + + +#ifndef ALFLAYOUTMANAGERIMPL +#define ALFLAYOUTMANAGERIMPL + +#include +#include +#include + +using std::auto_ptr; + +namespace Alf + { + +class CAlfWidgetControl; +class IAlfWidget; +class IAlfLayoutPreferences; + +/** + * layoutmanager implementation class + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfLayoutManagerImpl : public IAlfLayoutPreferences + { +public: + /** + * layout manager constructor + * + * @param aLayoutType type of layout used by the manager. + */ + AlfLayoutManagerImpl(TAlfLayoutType aLayoutType); + + /** + * destructor + */ + ~AlfLayoutManagerImpl(); + + /** + * creates the layout used by the layoutmanager. + * + * @param aOwner, owner-control of the the created layout. + * @param aParentLayout parent for the created layout + * @param aLayoutIndex index, where created visual should be placed in the parent layout. + */ + void createLayout(CAlfWidgetControl& aOwner, CAlfLayout* aParentLayout, + int aLayoutIndex); + + /** + * returns the layout used by layoutmanager. + * + * @return layout used by this layoutmanager. + */ + CAlfLayout& getLayout() const; + + /** + * updates the main layout + */ + void updateMainLayout(); + + /** + * notifies the layout manager, that the control's has been + * removed from the layout. + * + * @param aControl control, which size has changed. + */ + void childRemoved(CAlfWidgetControl* aControl); + + /** + * notifies the layout manager, that the child control's layout + * must be updated. + * + * @param aControl control, which size or position has changed. + */ + void doUpdateChildLayout(CAlfWidgetControl* aControl); + + /** + * returns the rect of the control. + * + * @param aControl, control, which size is queried. + * @param aRect, will receive the rect of aControl. + */ + bool controlRect(CAlfWidgetControl& aControl, TAlfRealRect& aRect); + + /** + * sets the size and position to the widget. + * + * @param aWidget, widget, which size and position is being set. + * @param aRect, rect for aWidget + */ + void setWidgetRect(IAlfWidget& aWidget, const TAlfRealRect &aRect); + + /** + * sets the position to the widget. + * + * @param aWidget, widget, which position is being set. + * @param aPos, position for aWidget + */ + void setWidgetPosition(IAlfWidget& aWidget, const TAlfRealPoint &aPos); + + /** + * sets the size to widget. + * + * @param aWidget, widget, which size is being set. + * @param aSize, new size for aWidget. + */ + void setWidgetSize(IAlfWidget& aWidget, const TAlfRealPoint &aSize); + + /** + * updates widget size and position properties for all the children + * to correct sizes and positions of the root visuals. + */ + void updateAllWidgetRects(); + + /** + * @return the child visual count + */ + int count() const; + + /** + * returns the control at aIndex. + * + * @param aIndex index for the control. + * @return control at aIndex + */ + CAlfWidgetControl* getControl(int aIndex) const; + + /** + * @return the owner control of the layoutmanager. + */ + CAlfWidgetControl& owner() const ; + +public: +// from base class IAlfLayoutPreferences + + /** + * Returns the minimum size of the layout by combining the minimum sizes of the + * layed out visuals. + * + * @param aMinSize The minimum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about minimum size + */ + virtual bool getMinimumSize( TAlfXYMetric& aMinSize ) const; + + /** + * Returns the maximum size of the layout by combining the maximum sizes of the + * layed out visuals. + * + * @param aMaxSize The maximum size that the object would like to be laid out to + * @return false iff none of the layed out UI elements do not care about maximum size + */ + virtual bool getMaximumSize( TAlfXYMetric& aMaxSize ) const; + + /** + * Returns the size combined by all preferred sizes of child UI elements in this layout + * when they are being layed out according to the layout manager rules. + * + * @param aPreferredSize Filled with the referred area occupied by child elements when + * layed out by layouting rules in this layout manager. + * @return False if none of the child components report their preferred size. True + * otherwise. + */ + virtual bool getPreferredSize(TAlfXYMetric& aPreferredSize) const; + + /** + * Set the preferred size into a presentation object. + * + * This is not supported on the layout manager. Users should set preferred sizes of the + * contained UI elements. + */ + virtual void setPreferredSize( const TAlfXYMetric& aPreferredSize ); + + /** + * returns the layout preferences for a control + * + * @param aControl control instance + * @return layout preferences for a control. + */ + const IAlfLayoutPreferences* getLayoutPreferences(CAlfWidgetControl* aControl) const; + +public: +// from base class IAlfInterfaceBase + + /** + * Interface getter. + * @see IAlfInterfaceBase::MakeInterface + * + * @since S60 ?S60_version + * @param aType The type id of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface( const IfId& aType ); + +private: + + /** + * returns the control, which owns the visual + * + * @param aVisual visual, which the control owns. + * @return control, which owns the visual at aIndex. + */ + CAlfWidgetControl* getControl(CAlfVisual& aVisual) const; + + /** + * finds the root visual for a control + * + * @param aControl control, which rootvisual is searched + * @return root visual + */ + CAlfVisual* findRootVisual(CAlfWidgetControl* aControl) const; + + /** + * checks, that layout is created. If not, throws an exception. + */ + void checkLayout() const; + +private: + + /** + * the layout created and used by the layout manager. + * Destroyed along with instance of this class. + */ + auto_ptr mLayout; + + /** + * the layout type of mLayout + */ + TAlfLayoutType mLayoutType; + }; + + } // namespace Alf + +#endif // ALFLAYOUTMANAGERIMPL diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alflctattributesetterutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alflctattributesetterutils.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2007 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: TThe attribute setter utility for lct attributesetters +* +*/ + + +#ifndef ALFCTATTRIBUTESETTERUTILS_H +#define ALFCTATTRIBUTESETTERUTILS_H + +#ifdef RD_ALF_IN_PLATFORM +#include +#endif + +namespace Alf + { + +class AlfAttributeContainer; +class IAlfMap; + +/** + * The implementation of the attribute setter utility for lct attributesetters. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfLctAttributeSetterUtils + { + +public: + + /** + * Gets common lct attributes. + * + * @param aContainer The container holding the new value of the attribute. + * Ownership of the object is not transferred. + * @ret Component handle + */ + static TAknLayoutHierarchyComponentHandle getCommonLctAttributes( + AlfAttributeContainer* aContainer); + + /** + * Gets lct size. + * + * @param aComponentHandle Component handle + * @param aWidth returned width. + * @param aHeight returned height. + * @return true if size is found. + */ + static bool itemSize(const TAknLayoutHierarchyComponentHandle& aComponentHandle, + int& aWidth, int& aHeight); + +private: // data + }; + + } // namespace Alf + +#endif // ALFCTATTRIBUTESETTERUTILS_H + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfrealvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfrealvalue.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2007 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: Defines RealValue for attributeTypes.. +* +*/ + + +#ifndef ALFREALVALUE_H +#define ALFREALVALUE_H + +//INCLUDES +#include +#include +#include "alf/alfattributevaluetype.h" + +// FORWARD DECLARATIONS + +using std::auto_ptr; + +namespace Alf + { + +/** + * A class for a real value type. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfRealValue : public AlfAttributeValueType + { +public: + + /** + * Constructor. + * + * @since S60 ?S60_version + * @param aValue The value of the attribute. Makes a copy of the attribute. + * @return New object. + */ + AlfRealValue( float aValue, TAlfUnit aUnit = EAlfUnitNormalized ); + + /** + * Destructor. + */ + virtual ~AlfRealValue(); + + /** + * Gets the real value. + * + * @since S60 ?S60_version + * @return The real value. + */ + float virtual realValue() const; + + /** + * Gets the type of the attribute value. + * + * @since S60 ?S60_version + * @return The type of the value. + */ + virtual Type type() const; + + /** + * Gets the unit. + * + * @since S60 ?S60_version + * @return The unit. + */ + virtual TAlfUnit unit() const; + +private: // data + + float mReal; + TAlfUnit mUnit; + + }; + + } // namespace Alf + +#endif // ALFREALVALUE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfrecyclinggridelementimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfrecyclinggridelementimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2007 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: Class for private implementation for AlfRecyclingGridElement. +* +*/ + + +#ifndef ALFRECYCLINGGRIDELEMENTIMPL_H +#define ALFRECYCLINGGRIDELEMENTIMPL_H + +#include "alf/alfrecyclinggridelement.h" +#include + +class CAlfVisual; +class CAlfLayout; +class TAlfEvent; + +namespace Alf + { +class CAlfWidgetControl; +class IAlfVariantType; +class IAlfBranch; +class IAlfElement; + +/** + * Implementation class used with the implPtr paradigm. + */ +OSN_NONSHARABLE_CLASS( AlfRecyclingGridElementImpl ) + { +public: + /** + * Gets the unit. + * + * @since S60 ?S60_version + * @return The unit. + */ + AlfRecyclingGridElementImpl( + AlfRecyclingGridElement& aOwner, + int aNumColumns, + int aNumRows); + /** + * Gets the unit. + * + * @since S60 ?S60_version + * @return The unit. + */ + ~AlfRecyclingGridElementImpl(); + /** + * setFillStyle. + * + * @since S60 ?S60_version + * @return The unit. + */ + void setFillStyle(AlfRecyclingGridElement::FillStyle aFillStyle, int aFillStyleParam); + + /** + * setAnimationTimes. + * + * @since S60 ?S60_version + * @return The unit. + */ + void setAnimationTimes( int aScrollingTime, + int aFadeInTime, int aFadeInDelay, + int aFadeOutTime, int aFadeOutDelay ); + /** + * createVisualTree. + * + * @since S60 ?S60_version + * @return The unit. + */ + CAlfVisual* createVisualTree( + IAlfVariantType& aData, uint aDataID, + CAlfLayout* aParentLayout, int aLayoutIndex ); + /** + * accept. + * + * @since S60 ?S60_version + * @return The unit. + */ + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + /** + * offerEvent. + * + * @since S60 ?S60_version + * @return The unit. + */ + bool offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + /** + * setActiveStates. + * + * @since S60 ?S60_version + * @return The unit. + */ + void setActiveStates( unsigned int aStates ); + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * + * @param aData A data structure which contains for example id of the event + * handler. + */ + void setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ) { } + + /** + * Returns AlfWidgetEventHandlerInitData. + * + * @return A pointer to AlfWidgetEventHandlerInitData structure which contains + * for example id of the event handler. + */ + AlfWidgetEventHandlerInitData* eventHandlerData() { return NULL; } + /** + * createChildVisualTree. + * + * @since S60 ?S60_version + * @return The unit. + */ + void createChildVisualTree( IAlfElement* aElement, + IAlfVariantType& aChildData, + IAlfBranch& aData, + int aIndex, uint aDataID ); + /** + * removeChildVisualTree. + * + * @since S60 ?S60_version + * @return The unit. + */ + void removeChildVisualTree( IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ); + /** + * removeAndDestroyVisuals. + * + * @since S60 ?S60_version + * @return The unit. + */ + void removeAndDestroyVisuals( int aTimeMilliseconds ); + +private: + + /** + * Api to naviagte by a single row or column. + * @since S60 ?S60_version + * @param aControl - Widget Control + * @param aPageUp - indicates the direction either a page up or page down + */ + bool moveSingleRowOrColumn( CAlfWidgetControl& aControl, bool aPageUp); + + /** + * APi to find the point in the grid for a given index in the visual array on the recycle grid . + * @since S60 ?S60_version + * @param aInd - index of the element + * @return TPoint - Point or cordinates + */ + TPoint calculateChildPos(int aInd) const; + + /** + * APi to find the index for a given point + * @since S60 ?S60_version + * @param aPos- position for whom the index needs to be found out + * @return int - Index of the cordinate + */ + int calculateChildInd(TPoint aPos) const; + + /** + * Internal APi to do the index calcuation for navigation and recycling + */ + void doPositioningAndScrolling( CAlfWidgetControl& aControl,uint aEventID); + +private: + + AlfRecyclingGridElement& mOwner; + + //class Data + /** + * The number of visible rows and columns. + */ + int mNumVisibleColumns, mNumVisibleRows; + + /** + * The number of rows and columns in the grid layout. + */ + int mNumColumns, mNumRows; + + /** + * The strategy for adding new items to the grid + */ + AlfRecyclingGridElement::FillStyle mFillStyle; + + /** + * The maximum number of items used with EColumnsFirst and ERowsFirst fill styles + */ + int mFillStyleParam; + + + /** + * Duration of the scrolling animation + */ + int mScrollingTime; + + /** + * Duration of the fade in animation + */ + int mFadeInTime; + + /** + * Delay before the fade in animation + */ + int mFadeInDelay; + + /** + * Duration of the fade out animation + */ + int mFadeOutTime; + + /** + * Delay before the fade out animation + */ + int mFadeOutDelay; + + /** + * The logical scrolling offset. + */ + TPoint mScrollOffset; + + bool mHorizontalOffset; + bool mVerticalOffset; + unsigned int mActiveStates; + }; + + } // namespace Alf + +#endif // C_ALFWIDGETEVENTHANDLERIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfsort.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfsort.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2004 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: contains sorting routine +* +*/ + + + +#ifndef ALFSORT_H +#define ALFSORT_H + +// INCLUDES +#include + +namespace Alf + { + +class IAlfVariantType; +class IAlfSortFunction; + } + +namespace Alf + { +/** +* class containig sort routine. +* @since S60 ?S60_version +*/ +class AlfSort + { +public: + /** + * sorts the array + * + * @since S60 ?S60_version + * @param aArr array to sort + * @param aCount count of items in aArr. + * @param aSortFunction. Callback interface, specifies how the items are sorted. + */ + static void sort(IAlfVariantType** aArr, uint aCount, const IAlfSortFunction& aSortFunction ); + }; + + } + + +#endif diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfstringvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfstringvalue.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007 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: Declares StringType attribute Value. +* +*/ + + +#ifndef ALFSTRINGVALUE_H +#define ALFSTRINGVALUE_H + +//INCLUDES +#include +#include +#include +#include "alf/alfattributevaluetype.h" + +// FORWARD DECLARATIONS + +namespace osncore + { +class UString; + } +using namespace osncore; +using std::auto_ptr; + +namespace Alf + { + +/** + * A class for a string value type. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfStringValue : public AlfAttributeValueType + { +public: + + /** + * Constructor. + * + * @since S60 ?S60_version + * @return New object. + */ + AlfStringValue( const UString& aValue ); + + /** + * Destructor. + */ + virtual ~AlfStringValue(); + + /** + * Gets the string value. + * + * @since S60 ?S60_version + * @return The string value. + */ + const virtual UString& stringValue() const; + + /** + * Gets the type of the atrribute value. + * + * @since S60 ?S60_version + * @return The type of the value. + */ + virtual Type type() const; + + /** + * Gets the unit. + * + * @since S60 ?S60_version + * @return The unit. + */ + virtual TAlfUnit unit() const; + +private: // data + + UString mString; + }; + + } // namespace Alf + +#endif // ALFSTRINGVALUE_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfwidgetattributeownerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfwidgetattributeownerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007 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: Implementation of the IAlfAttributeOwner interface +* for AlfWidget. +* +*/ + + +#ifndef __ALFELEMENTATTRIBUTEOWNERIMPL_H__ +#define __ALFELEMENTATTRIBUTEOWNERIMPL_H__ + +#include "alf/ialfattributeowner.h" +#include + +namespace Alf + { + +class CAlfWidgetControl; + +/** + * Implementation of the IAlfAttributeOwner interface for AlfWidget. + */ +class AlfWidgetAttributeOwnerImpl : public IAlfAttributeOwner + { +public: + + /** + * Constructor. + * + * @param aWidget Reference to owner widget. + */ + AlfWidgetAttributeOwnerImpl(CAlfWidgetControl* aControl); + + /** + * Destructor. + */ + virtual ~AlfWidgetAttributeOwnerImpl(); + +// from base class IAlfInterfaceBase + + /** + * Getter for interfaces provided by the widget classes. + * Derived classes should always call the base class method + * from the overridden MakeInterface. + * + * @since S60 ?S60_version + * @param aType A descriptor to identify the type of the queried interface. + * @return The queried interface, or NULL if the interface is not + * supported or available. + */ + virtual IAlfInterfaceBase* makeInterface(const IfId& aType); + +// from base class IAlfAttributeOwner + + /** + * Get the number of available attributes. + * + * @return The number of attributes. + */ + virtual int attributeCount() const; + + /** + * Gets the attribute with the given name. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aAttribName The name of the attribute. + * @return The attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute(const UString& aAttribName) const; + + /** + * Set a value of an attribute. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute(const AlfAttribute& aAttribute); + + /** + * Set a value of an attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute(const UString& aAttribName, + AlfAttributeValueType* aValue); + + /** + * Sets a value of an attribute to a specific target. + * The target is identified by using aTargetId parameter. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId , + AlfAttribute& aAttribute ); + + + /** + * Sets values of each attribute in given container to a specific target. + * The target is identified by using aTargetId parameter. + * + * @param aTargetId Name of the target widget part, e.g element class tag. + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * @return True if some attributes were supported, false if not. + */ + virtual bool setAttributeContainer( const UString& aTargetId , + AlfAttributeContainer& aAttributeContainer ); + + /** + * Sets a value of an static attribute. + * This SetAttribute variant is for simple non animated attributes + * that only have name and value. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName Name of the attribute. + * @param aValue Value of the attribute. Ownership is transferred + * @return True if the attribute was supported, false if not. + */ + virtual bool setAttribute( const UString& aTargetId, + const UString& aAttribName, + AlfAttributeValueType* aValue ); + + /** + * Sets values of each attribute in given container + * + * @param aAttributeContainer Reference attributeContainer, All attributes + * in the container are handled. The ownership is not transferred. + * + * @return True if some attributes were supported, false if not. + */ + virtual bool setAttributeContainer( AlfAttributeContainer& aAttributeContainer ); + + /** + * Gets the attribute with the given name from specific target. + * The returned attribute instance is owned by the widget and + * should not be deleted. + * Also the returned attribute instance should not be modified. + * Use SetAttribute for that. + * + * @param aTargetId The name of the target widget part, e.g. element class + * @param aAttribName The name of the attribute. + * @return A pointer to the attribute, or 0 if the attribute was not found. + */ + virtual const AlfAttribute* getAttribute( const UString& aTargetId , + const UString& aAttribName ) const; +private: + + /** + * Lets elements to try handle attribute. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + * @return True if the attribute was supported, false if not. + */ + bool handleElementAttribute(const AlfAttribute& aAttribute); + + /** + * Handles the attribute, sets proper values. + * + * @param aAttribute Reference attribute, the data is copied from it. + * The ownership is not transferred. + */ + void handleAttribute(const AlfAttribute& aAttribute); + + /** + * Can attribute be handled with this widget. + * + * @param aAttributeName Name of the attribute. + * @return True if attribute is supported, false elsewhere. + */ + bool canHandleAttribute(const char* aAttributeName); + +private: + + /** + * The control. Not own. + */ + CAlfWidgetControl* mControl; + + /* + * Array of attributes set through IAlfAttributeOwner interface. Own. + */ + AlfPtrVector mAttributeList; + }; + + } // namespace Alf + +#endif // __ALFELEMENTATTRIBUTEOWNERIMPL_H__ diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfwidgetcontroleventfilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfwidgetcontroleventfilter.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2007 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: Event Filter Header. +* +*/ + +#ifndef __ALFWIDGETCONTROLEVENTFILTER_H__ +#define __ALFWIDGETCONTROLEVENTFILTER_H__ +#include + + +#include +#include +#include +#include +#include + +#include +#include + +using namespace osncore; +using namespace Alf; +namespace Alf +{ +/** +* AlfWidgetControlEventFilter delivers the Missed PointerUp event as a custom +* event .If AfWidgetControl gets a stray pointerUp event, the +* AlfWidgetControlEventFilter will consume the Stray pointerup event and send a +* EEventMissedPointerUp custom event. +* +*/ +class AlfWidgetControlEventFilter: public IAlfWidgetEventHandler + { + public: + + /** + * Constructor + * + */ + AlfWidgetControlEventFilter(); + + /** + * Destructor + * + */ + ~AlfWidgetControlEventFilter(); + + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. Pointer event handlers cannot be + * identified directly, since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * + * @since S60 ?S60_version + * @param aEvent The event. + * @return ETrue if the event can be processed. Otherwise EFalse. + */ + bool accept ( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventStatus offerEvent ( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + /** + * Returns the type of EventHandler. + * @see IAlfWidgetEventHandler::AlfEventHandlerType + * + * @return The type of event handler. + */ + AlfEventHandlerType eventHandlerType(); + + /** + * Returns information about the phase in the event handling cycle in + * which the event hadler will be executed. + * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + * + * @return Event handler execution phase. + */ + + AlfEventHandlerExecutionPhase eventExecutionPhase(); + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in <: add reference>. The high 16 bits are + * available for states defined by the client code. + */ + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + + /** + * Returns AlfWidgetEventHandlerInitData. + * + * @return A pointer to AlfWidgetEventHandlerInitData structure which contains + * for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + + void setActiveStates ( unsigned int aStates ); + + IAlfInterfaceBase* makeInterface ( const IfId& aType ); + // Stores Button Down State + bool mButtonDown ; + + }; +} + + +#endif // __ALFWIDGETCONTROLEVENTFILTER_H__ + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfwidgeteventhandlerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfwidgeteventhandlerimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 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: Class for private implementation for AlfWidgetEventHandler. +* +*/ + + +#ifndef ALFWIDGETEVENTHANDLERIMPL_H +#define ALFWIDGETEVENTHANDLERIMPL_H + +#include +#include +#include +#include "alfeventinput.h" +#include "alfeventoutput.h" +#include "alfanimationoutput.h" + +using namespace osncore; + +namespace Alf + { + +/** + * Widget event handler internal implementation. + */ +OSN_NONSHARABLE_CLASS( AlfWidgetEventHandlerImpl ) + { +public: + + /** + * constructor. + * + * @param aEventHandlerType Event handler type. + * It can be presentaion related or logical. + * @param aEventHandlerExecutionPhase Event handler exceution phase. + * It can be tunneling phase/bubbling phase/both. + */ + AlfWidgetEventHandlerImpl(IAlfWidgetEventHandler::AlfEventHandlerType aEventHandlerType, + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase aEventHandlerExecutionPhase); + + /** + * Destructor. + */ + virtual ~AlfWidgetEventHandlerImpl(); + +private: + /** + * Destructor. + */ + void construct(); + +public: // data + + AlfPtrVectormInputs; + AlfPtrVector mPointerInputs; + AlfPtrVector mOutputs; + AlfPtrVector mAnimationOutputs; + AlfPtrVector mWidgetAttributeOutputs; + AlfPtrVector mWidgetAttributeInputs; + AlfPtrVector mCancelOutputs; + AlfPtrVector mAnimationCancelOutputs; + AlfPtrVector mStateChangeOutputs; + AlfPtrVector mEventPasserInputs; + AlfPtrVector mEventPasserOutputs; + +#ifdef RD_TACTILE_FEEDBACK + AlfPtrVector mTactileOutputs; +#endif // RD_TACTILE_FEEDBACK + AlfPtrVector mWidgetEventOutputSignals; + AlfPtrVector mAppEventOutputs; + + unsigned int mActiveStates; + bool mCapturing; + /** + * Event handler init data + */ + AlfWidgetEventHandlerInitData mEhData; + + /* + * Type of event handler. It can be presentaion related or logical. + */ + IAlfWidgetEventHandler::AlfEventHandlerType mEventHandlerType; + + /* + * Event handler exceution phase. It can be tunneling phase/bubbling phase/both. + */ + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase mEventHandlerExecutionPhase; + }; + + } // namespace Alf + +#endif // C_ALFWIDGETEVENTHANDLERIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/alfwidgetimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/alfwidgetimpl.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2007 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: The private implementation of CAlfWidget. +* +*/ + + +#ifndef ALFWIDGETIMPL_H +#define ALFWIDGETIMPL_H + +#include +#include +using osncore::UString; +using osncore::AlfPtrVector; + +namespace Alf + { + +class CAlfWidgetControl; +class IAlfModel; +class AlfWidget; +class AlfAttribute; +class AlfAttributeValueType; +class AlfWidgetAttributeOwnerImpl; + +/** + * The private implementation of AlfWidget. + * The methods are documented in the class AlfWidget. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + */ +class AlfWidgetImpl + { +public: + + /** + * Constructor. + * + * @since S60 ?S60_version + */ + AlfWidgetImpl(); + + /** + * Destructor. + * + * @since S60 ?S60_version + */ + ~AlfWidgetImpl(); + /** + * control. + * + * @since S60 ?S60_version + */ + CAlfWidgetControl* control(); + /** + * setControl. + * + * @since S60 ?S60_version + */ + void setControl( CAlfWidgetControl* aControl,bool aDeletePreviousControl); + /** + * model. + * + * @since S60 ?S60_version + */ + IAlfModel* model(); + /** + * setModel. + * + * @since S60 ?S60_version + */ + void setModel( IAlfModel* aModel ,bool aTakeOwnership); + + /** + * Set the id of the widget. + * + * @since S60 ?S60_version + * @param aWidgetName The name of the widget instance. + */ + void setWidgetName( const UString& aWidgetName ); + /** + * widgetName. + * + * @since S60 ?S60_version + */ + const UString& widgetName() const; + + /** + * Add a widget to the widgets array. + * + * @param aWidget The widget to be appended to the array of widgets. + */ + void addWidget(AlfWidget *aWidget); + + /** + * Return total number of widgets in the list. + */ + int widgetCount(); + + /** + * Return widget at the index + */ + AlfWidget* getWidget(int aIndex); + + /** + * Returns the index of the widget in this array. + * If the given widget is not found from the array -1 + * is returned. + * + * @param aWidget Widget to be searched from the array. + * @return Index of the widget in the internal array or -1 if the widget + * is not found. + */ + int findWidget(AlfWidget* aWidget); + + /* + *Removes a widget at given index + */ + void removeWidget(int aIndex); + + /* + * Returns attribute owner interface.Ownership is not transferred. + * + * @return attribute owner interface. + */ + AlfWidgetAttributeOwnerImpl* getAttributeOwner(); + +private: // data + + /** + * The control. Not own. + */ + CAlfWidgetControl* mControl; + + /** + * The model. Own. + */ + IAlfModel* mModel; + + /** + * The widget id. Own. + */ + UString mWidgetName; + + AlfPtrVector mAttributeList; + + AlfPtrVector mWidgets; + bool mTakesModelOwnership; + + /* + * IAlfAttributeOwner implementation. Own. + */ + auto_ptr mAttributeOwnerImpl; + +private: + + friend class AlfWidget; + }; + + } // namespace Alf + +#endif // C_ALFWIDGETIMPL_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/autoarrayptr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/autoarrayptr.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,226 @@ +/* +* 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: AutoPtr class for array. +* +*/ + + +/** + * Holds reference to an auto_arrayptr. Prevents unsafe copying + * + * ?more_complete_description + * + * @lib ?library + * @since S60 ?S60_version *** for example, S60 v3.0 + */ + + template + struct auto_arrayptr_ref + { + Y* iPtr; + + explicit + auto_arrayptr_ref(Y* aPtr): iPtr(aPtr) { } + }; + +/** + * Auto pointer template implementation for C++ arrays + * + * ?more_complete_description + * + * @lib ?library + * @since S60 ?S60_version *** for example, S60 v3.0 + */ + template + class auto_arrayptr + { + private: + X* iPtr; + + public: + + typedef X element_type; + + /** + * Constructor. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + explicit + auto_arrayptr(X* p = 0) throw() : iPtr(p) { } + /** + * Copy argument a to this object. Owned pointer ownership is transferred to this. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + + auto_arrayptr(auto_arrayptr& a) throw() : iPtr(a.release()) { } + /** + * Copy argument a to this object. Owned pointer ownership is transferred to this. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + + template + auto_arrayptr(auto_arrayptr& a) throw() : iPtr(a.release()) { } + + /** + * Assign argument a to this object. If this already owned pointer that pointer is deleted. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + auto_arrayptr& operator=(auto_arrayptr& a) throw() + { + reset(a.release()); + return *this; + } + /** + * Assign argument a to this object. If this already owned pointer that pointer is deleted. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + + template + auto_arrayptr& operator=(auto_arrayptr& a) throw() + { + reset(a.release()); + return *this; + } + /** + * Deletes the underlying pointer. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + ~auto_arrayptr() { delete [] iPtr; } + + /** + * Return owned pointer + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + + X* get() const throw() { return iPtr; } + /** + * Releases ownership of the managed pointer and returns that pointer. + * The *this object is left holding a null pointer. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + + X* release() throw() + { + X* tmp = iPtr; + iPtr = 0; + return tmp; + } + + /** + * Reset managed pointer. Deletes previously owned pointer. + * The *this object is holding given pointer. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + void reset(X* aPtr = 0) throw() + { + if (aPtr != iPtr) + { + delete [] iPtr; + iPtr = aPtr; + } + } + + + /** + * Constructor for value object.Uses type conversion function. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + auto_arrayptr(auto_arrayptr_ref aRef) throw() + : iPtr(aRef.iPtr) { } + + /** + * Assign argument a (value object) to this object. If this already owned pointer that pointer is deleted. + * Uses type conversion function. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + auto_arrayptr& operator=(auto_arrayptr_ref aRef) throw() + { + if (aRef.iPtr != this->get()) + { + delete [] iPtr; + iPtr = aRef.iPtr; + } + return *this; + } + + /** + * Type conversion. Constructs an auto_arrayptr_ref from *this and returns it. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + template + operator auto_arrayptr_ref() throw() + { return auto_arrayptr_ref(this->release()); } + + /** + * Type conversion. Constructs a new auto_arrayptr using the underlying pointer held by *this. + * Calls release() on *this, so *this no longer possesses the pointer. + * Returns the new auto_arrayptr. + * + * @since S60 ?S60_version + * @param ?arg1 ?description + * @param ?arg2 ?description + * @return ?description + */ + template + operator auto_arrayptr() throw() + { return auto_arrayptr(this->release()); } + }; \ No newline at end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/inc/ialfhostapi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/inc/ialfhostapi.h Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2007 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: Interface implements by CAlfWidgetControl to provide containment +* +*/ + + +#ifndef I_ALFHOSTAPI_H +#define I_ALFHOSTAPI_H + +#include +#include +#include + +namespace Alf + { + +class IAlfLayoutManager; +class CAlfWidgetControl; + +enum AlfRole + { + EChild, + EParent + }; + +namespace alfhostapi + { +static const IfId ident = + { + 0, "alfhostapi" + }; + } +/** + * The interface for host appis used by widget controls. + * + * @lib alfwidgetmodel.lib + * @since S60 ?S60_version + * @status Draft + */ +class IAlfHostAPI : public IAlfInterfaceBase + { +public: + + static inline const IfId& type() + { + return alfhostapi::ident; + } + + virtual inline ~IAlfHostAPI() {} + + /** + * Sets a connection from this host to a given control. + * + * A control can never have more than one host control. If the connected + * control has a host control the connection from old host control + * to connected control will be removed. + * + * @param aControl Control to be connected. + * @param aRole Relationship with connected control. + */ + virtual void setConnection(CAlfWidgetControl& aControl, AlfRole aRole) = 0; + + /** + * Get the connected control at given index. + * + * @param aIndex Index of connected control. + * @return Connected control at given index. If index is not found returns null. + */ + virtual CAlfWidgetControl* getConnection(int aIndex) const = 0; + + /** + * gets the number of connections + * + * @since S60 ?S60_version + */ + virtual int getConnectionCount() const = 0; + + /** + * gets the connection index of aControl + * + * @since S60 ?S60_version + * @param aControl control, which index to return. + */ + virtual int getConnectionIndex(CAlfWidgetControl& aControl) const = 0; + + /** + * Removes connection with the given control. + * + * If the connected control is in the same control group with host control, + * it will be removed from the host control's control group. + * + * If the connected control is in a separate control group or if the + * host control is not in a control group, the connected control's control + * group relation will not be affected. + * + * @see setConnection() + * + * @param aControl Control with which connection is to be removed. + */ + virtual void removeConnection(CAlfWidgetControl& aControl) = 0; + + /** + * Sets the base layout of control. + * + * @param aLayout Base layout. + */ + virtual void setBaseLayout(IAlfLayoutManager& aLayout) = 0; + + /** + * Returns the base layout of control. + * + * @return Base layout of control.Returns null id there is no base layout. + */ + virtual IAlfLayoutManager* getBaseLayout() const = 0; + + + }; + + } // namespace Alf + +#endif // I_ALFHOSTAPI_H diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfanchorlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfanchorlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,457 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for anchorlayout. +* +*/ + + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alfanchorlayoutattributesetter.h" +#include +#include +#include + + +//osn includes +#include + +//alf includes +#include +#include +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include +#include + + + +//namespaces + +using namespace osncore; + +using namespace duiuimodel::anchorlayoutinput; + +using namespace duiuimodel::layoutattributes; + +using namespace duiuimodel::anchor; + +using namespace duiuimodel::metric; + +namespace Alf + { + +bool isMultivalueDataAchment ( TAlfAnchorAttachmentOrigin val ) + { + return ( val == EAlfAnchorAttachmentOriginNone|| + val == EAlfAnchorAttachmentOriginTopLeft || + val == EAlfAnchorAttachmentOriginTopCenter || + val == EAlfAnchorAttachmentOriginTopRight || + val == EAlfAnchorAttachmentOriginCenterLeft || + val == EAlfAnchorAttachmentOriginCenter || + val == EAlfAnchorAttachmentOriginCenterRight || + val == EAlfAnchorAttachmentOriginBottomLeft || + val == EAlfAnchorAttachmentOriginBottomCenter || + val == EAlfAnchorAttachmentOriginBottomRight ); + } + +typedef void ( *pFunc ) ( AlfContainer* aCont, AlfAttribute* aAttrib, IAlfMap* aData ); + +void addToAnchortypecont ( AlfContainer* aCont, AlfAttribute* aAttrib, IAlfMap* aData ) + { + + if ( aData ) + { + IAlfVariantType* dataX = aData->item ( UString(aAttrib->getDataField() )); + + if ( dataX && dataX->type() == IAlfVariantType::EInt ) + { + aCont->addItem ( new ( EMM ) AlfVariantType ( dataX->integer() ) ); + } + } + else + { + aCont->addItem ( new ( EMM ) AlfVariantType ( aAttrib->intValue() ) ); + } + + } + +void addToAttachmentcont ( AlfContainer* aCont, AlfAttribute* aAttrib, IAlfMap* aData ) + { + + if ( aData ) + { + IAlfVariantType* dataX = aData->item ( UString(aAttrib->getDataField())); + + if ( dataX && dataX->type() == IAlfVariantType::EInt ) + { + aCont->addItem ( new ( EMM ) AlfVariantType ( dataX->integer() ) ); + } + } + else + { + aCont->addItem ( new ( EMM ) AlfVariantType ( aAttrib->intValue() ) ); + } + } + +void addToMagnitudecont ( AlfContainer* aCont, AlfAttribute* aAttrib, IAlfMap* aData ) + { + + if ( aData ) + { + IAlfVariantType* dataX = aData->item ( UString(aAttrib->getDataField()) ); + + if ( dataX != NULL && dataX->type() == IAlfVariantType::EMap ) + { + IAlfVariantType* valueX = dataX->map()->item ( UString("value")); + IAlfVariantType* unitX = dataX->map()->item ( UString("unit")); + auto_ptr value ( new ( EMM ) AlfContainer() ); + auto_ptr vtype1(new ( EMM ) AlfVariantType ( valueX->real() )); + value->addItem ( vtype1.get() ); + vtype1.release(); + auto_ptr vtype2(new ( EMM ) AlfVariantType ( unitX->integer() )); + value->addItem ( vtype2.get() ); + vtype2.release(); + aCont->addItem ( value.release() ); + + } + else if ( dataX != NULL && dataX->type() == IAlfVariantType::EReal ) + { + auto_ptr value ( new ( EMM ) AlfContainer() ); + auto_ptr vtype1(new ( EMM ) AlfVariantType ( dataX->real() )); + value->addItem ( vtype1.get() ); + vtype1.release(); + auto_ptr vtype2( new ( EMM ) AlfVariantType ( aAttrib->unit() ) ); + + value->addItem (vtype2.get()); + vtype2.release(); + aCont->addItem ( value.release() ); + } + } + else + { + auto_ptr value ( new ( EMM ) AlfContainer() ); + auto_ptr vtype1( new ( EMM ) AlfVariantType ( aAttrib->realValue() ) ); + value->addItem (vtype1.get()); + vtype1.release(); + auto_ptr vtype2( new ( EMM ) AlfVariantType ( aAttrib->unit() ) ); + + value->addItem (vtype2.get()); + vtype2.release(); + aCont->addItem ( value.release() ); + + } + + } + +void addToTextstylecont ( AlfContainer* /*aCont*/, AlfAttribute* /*aAttrib*/, IAlfMap* /*aData*/ ) + { + } + +struct anchormap + { + const char* name; + pFunc addToContainer; + AlfContainer* pData; + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnchorLayoutAttributeSetter::AlfAnchorLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnchorLayoutAttributeSetter::~AlfAnchorLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnchorLayoutAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + + CAlfAnchorLayout* layout = dynamic_cast ( &aVisual ); + + if ( !layout ) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, + "AlfAnchorLayoutAttributeSetter" ) + } + + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfAnchorLayoutAttributeSetter::createCommand ( CAlfVisual& /*aVisual*/, + AlfAttributeContainer* /*aContainer*/, IAlfMap* /*aData*/, + int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = NULL; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnchorLayoutAttributeSetter::createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + //no animatable attributes in grid layout. + AlfCommonLayoutAttributeSetter::createAndSendCommands ( aVisual, aContainer, aRefVisual ); + } + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfAnchorLayoutAttributeSetter::handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer ) + { + //no dynamic attributes in anchor layout. + AlfCommonLayoutAttributeSetter::handleDynamicAttribute(aVisual, aAttr, aContainer); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfAnchorLayoutAttributeSetter::handleStaticAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer ) + { + if (!doHandleStaticAttribute(aVisual, aAttr, aContainer, NULL)) + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute(aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +bool AlfAnchorLayoutAttributeSetter::doHandleStaticAttribute( CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + bool handled = true; + const char* attrName = aAttr.name(); + CAlfAnchorLayout* layout = dynamic_cast ( &aVisual ); + if(!layout) + { + return false; + } + + if ( !strcmp ( attrName, KChildOrdinal )||!strcmp ( attrName, KAttachmentOrdinal ) + || !strcmp ( attrName, KAnchorType )||!strcmp ( attrName, KAttachmentOrigin ) + ||!strcmp ( attrName, KMagnitude )||!strcmp ( attrName, KTextStyleId ) ) + { + AlfAttribute& attachmentordinal = aContainer.getAttributeByName ( KAttachmentOrdinal ); + AlfAttribute& aAttrChildOrdinal = aContainer.getAttributeByName ( KChildOrdinal ); + float ordianal=0; + float attachordinalval=-1; + if(aData) + { + IAlfVariantType* data = aData->item ( UString(aAttrChildOrdinal.getDataField()) ); + + if ( data && data->type() == IAlfVariantType::EReal ) + { + ordianal=data->real(); + } + data = aData->item ( UString(attachmentordinal.getDataField()) ); + if ( data && data->type() == IAlfVariantType::EReal ) + { + attachordinalval=data->real(); + } + } + else + { + ordianal=aAttrChildOrdinal.realValue(); + attachordinalval=attachmentordinal.realValue(); + } + auto_ptr anchortypecont ( new ( EMM ) AlfContainer() ); + auto_ptr attachmentorigincont ( new ( EMM ) AlfContainer() ); + auto_ptr magnitudecont ( new ( EMM ) AlfContainer() ); + auto_ptr textstyleidcont ( new ( EMM ) AlfContainer() ); + + anchormap maptable[] = + { + {KAnchorType, addToAnchortypecont, NULL}, + {KAttachmentOrigin, addToAttachmentcont, NULL}, + {KMagnitude, addToMagnitudecont, NULL}, + {KTextStyleId, addToTextstylecont, NULL} + }; + unsigned int tableCount = sizeof ( maptable ) / sizeof ( anchormap ); + maptable[0].pData = anchortypecont.get(); + maptable[1].pData = attachmentorigincont.get(); + maptable[2].pData = magnitudecont.get(); + maptable[3].pData = textstyleidcont.get(); + + unsigned int attrCount = aContainer.attributeCount(); + + for ( int i = 0;i < attrCount;i++ ) + { + for ( int j = 0;j < tableCount;j++ ) + { + if ( !strcmp ( maptable[j].name, aContainer.getAttribute ( i ).name() ) ) + { + maptable[j].addToContainer ( maptable[j].pData, &aContainer.getAttribute ( i ), aData ); + aContainer.getAttribute ( i ).setDirty(false); + } + } + } + + unsigned int totalApitocall = attachmentorigincont->count(); + + unsigned int magnitudeindex = 0; + + for ( int counter = 0;counter < totalApitocall;counter++ ) + { + IAlfVariantType* Origin = attachmentorigincont->item ( counter ); + TAlfAnchorAttachmentOrigin value = static_cast ( Origin->integer() ); + + if ( isMultivalueDataAchment ( value ) ) + { + IAlfVariantType* aType = anchortypecont->item ( counter ); + TAlfAnchorType type = static_cast ( aType->integer() ); + + if ( type == EAlfAnchorTypeNone ) + { + IAlfContainer* magCont1 = static_cast ( magnitudecont->item ( magnitudeindex ) ); + IAlfContainer* magCont2 = static_cast ( magnitudecont->item ( magnitudeindex + 1 ) ); + IAlfContainer* magCont3 = static_cast ( magnitudecont->item ( magnitudeindex + 2 ) ); + IAlfContainer* magCont4 = static_cast ( magnitudecont->item ( magnitudeindex + 3 ) ); + + TAlfMetric metric1 ( magCont1->item ( 0 )->real(), magCont1->item ( 1 )->integer() ); + TAlfMetric metric2 ( magCont2->item ( 0 )->real(), magCont2->item ( 1 )->integer() ); + TAlfMetric metric3 ( magCont3->item ( 0 )->real(), magCont3->item ( 1 )->integer() ); + TAlfMetric metric4 ( magCont4->item ( 0 )->real(), magCont4->item ( 1 )->integer() ); + TAlfBoxMetric boxmetric ( metric1, metric2, metric3, metric4 ); + int err=layout->Attach ( ordianal, boxmetric, value, attachordinalval ); + if(err!=KErrNone) + { + ALF_THROW ( AlfVisualException, err, "Anchor Attach Failed" ) + } + magnitudeindex += 4; + } + else + { + IAlfContainer* magCont1 = static_cast ( magnitudecont->item ( magnitudeindex ) ); + IAlfContainer* magCont2 = static_cast ( magnitudecont->item ( magnitudeindex + 1 ) ); + + TAlfMetric metric1 ( magCont1->item ( 0 )->real(), magCont1->item ( 1 )->integer() ); + TAlfMetric metric2 ( magCont2->item ( 0 )->real(), magCont2->item ( 1 )->integer() ); + + + + TAlfXYMetric xymetric ( metric1, metric2 ); + + int err=layout->Attach ( ordianal, type, xymetric, value, attachordinalval ); + if(err!=KErrNone) + { + ALF_THROW ( AlfVisualException, err, "Anchor Attach Failed" ) + } + + magnitudeindex += 2; + } + } + else + { + IAlfVariantType* typeVar = anchortypecont->item ( counter ); + TAlfAnchorType type = static_cast ( typeVar->integer() ); + IAlfContainer* magCont1 = static_cast ( magnitudecont->item ( magnitudeindex ) ); + + TAlfMetric metric ( magCont1->item ( 0 )->real(), magCont1->item ( 1 )->integer() ); + + + int err=layout->Attach ( ordianal, type, metric, value, attachordinalval ); + if(err!=KErrNone) + { + ALF_THROW ( AlfVisualException, err, "Anchor Attach Failed" ) + } + + magnitudeindex++; + } + } + + attachmentordinal.setDirty(false); + aAttrChildOrdinal.setDirty(false); + } + else + { + handled = false; + } + + return handled; + } + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfAnchorLayoutAttributeSetter::handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute ( aVisual, aAttr, aContainer, aData ); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfAnchorLayoutAttributeSetter::handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + if (!doHandleStaticAttribute(aVisual, aAttr, aContainer, aData)) + { + AlfCommonLayoutAttributeSetter::handleStaticDataAttribute(aVisual, aAttr, aContainer, aData); + } + } + + } // namespace Alf + +// End of file + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfanchorlayoutmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfanchorlayoutmanager.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2007 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: anchorlayoutmanager with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include +#include + +#include "alfanchorlayoutmanagerimpl.h" + +using osncore::UString; + +using namespace Alf; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layout manager constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnchorLayoutManager::AlfAnchorLayoutManager() + : AlfLayoutManager(EAlfLayoutTypeAnchor) + { + mData.reset(new (EMM) AlfAnchorLayoutManagerImpl(*this)); + } + +// --------------------------------------------------------------------------- +// virtual destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnchorLayoutManager::~AlfAnchorLayoutManager() + { + } + +// --------------------------------------------------------------------------- +// from AlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnchorLayoutManager::updateChildLayout( + CAlfWidgetControl* aControl) + { + CAlfLayout& layout = getLayout(); + doUpdateChildLayout(aControl); + layout.UpdateChildrenLayout(); + + //doUpdateChildLayout changes the visual size and position. + //need to notify the widget that size and position has changed. + + //set the size and postion for aControl + TAlfRealRect rect; + if (controlRect(*aControl, rect)) //returns the real rect (of the root visual) + { + setControlRect(*aControl, rect); + } + + // Inform parent layout manager about the changed presentation size + owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// notifies the layout manager, that the control's has been +// removed from the layout. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnchorLayoutManager::childRemoved(CAlfWidgetControl* aControl) + { + //when control is removed from layout, no change to other widget rects, + // just call the base class + AlfLayoutManager::childRemoved(aControl); + } + +// --------------------------------------------------------------------------- +// from AlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnchorLayoutManager::doUpdateChildLayout( + CAlfWidgetControl* /*aControl*/) + { + //anchorlayout changes the position and size, nothing to do here. + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfAnchorLayoutManager::makeInterface( + const IfId& aType ) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutManager::type().mImplementationId) + { + return this; + } + + // Let the implementation class try the interface creation + IAlfInterfaceBase* pInterface = mData->makeInterface(aType); + return pInterface; + } + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfanchorlayoutmanagerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfanchorlayoutmanagerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 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: layoutmanager implementation class with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include + +//stl +#include //for min & max + +#include "alfanchorlayoutmanagerimpl.h" + +using namespace Alf; + +namespace Alf + { +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layoutmanagerimpl constructor +// --------------------------------------------------------------------------- +// +AlfAnchorLayoutManagerImpl::AlfAnchorLayoutManagerImpl( + AlfAnchorLayoutManager& aAnchorLayoutManager) : + mAnchorLayoutManager(aAnchorLayoutManager) + { + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +AlfAnchorLayoutManagerImpl::~AlfAnchorLayoutManagerImpl() + { + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the minimum area that this layout manager can occupy by observing +// the minimum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfAnchorLayoutManagerImpl::getMinimumSize( TAlfXYMetric& /*aMinSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the maximum area that this layout manager can occupy by observing +// the maximum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfAnchorLayoutManagerImpl::getMaximumSize( TAlfXYMetric& /*aMaxSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// Combines and returns the preferred sizes of all child UI elements according +// to the layouting rules. +// --------------------------------------------------------------------------- +// +bool AlfAnchorLayoutManagerImpl::getPreferredSize(TAlfXYMetric& /*aPreferredSize*/) const + { + return false; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// At the moment doesn't do anything since preferred size is being queried +// from the child UI elements added to this layout manager. +// --------------------------------------------------------------------------- +// +void AlfAnchorLayoutManagerImpl::setPreferredSize( const TAlfXYMetric& aPreferredSize) + { + TAlfTimedPoint size((float)aPreferredSize.iX.iMagnitude,(float)aPreferredSize.iY.iMagnitude); + layout().SetSize(size); + mAnchorLayoutManager.owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfAnchorLayoutManagerImpl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutPreferences::type().mImplementationId) + { + return this; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// returns the anchorlayout used by the layoutmanager +// --------------------------------------------------------------------------- +// +CAlfAnchorLayout& AlfAnchorLayoutManagerImpl::layout() const + { + return dynamic_cast(mAnchorLayoutManager.getLayout()); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfanimationoutput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfanimationoutput.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007 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: Animation class for alfred widget model. + This class creates the animation and commands. +* +* +*/ + + + + +//INCLUDES +#include "alf/alfreferencetovisual.h" +#include "alf/ialfattributesetter.h" +#include "alf/alfattributecontainer.h" +#include +#include +#include +#include +//#include "alf/alfperf.h" +#include "alfanimationoutput.h" + +namespace Alf + { + +////////////////////// AlfAnimationOutput ////////////////////// + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Description : Constructor +// ----------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnimationOutput::AlfAnimationOutput( + AlfReferenceToVisual* aTargetVisual, + AlfReferenceToVisual* aReferenceVisual, + IAlfAttributeSetter* aAttributeSetter, + AlfAttributeContainer* aAttributeContainer, + unsigned int aAnimationTime, + unsigned int aDelay) + { + if (!aTargetVisual || !aAttributeSetter || !aAttributeContainer ) + { + ALF_THROW( AlfException, EInvalidArgument, "AlfAnimationOutput" ) + } + + mTargetVisual = aTargetVisual; + mReferenceVisual = aReferenceVisual; + mAttributeSetter = aAttributeSetter; + mAttributeContainer = aAttributeContainer; + mAnimationTime = aAnimationTime; + mDelay = aDelay; + } + +// ----------------------------------------------------------------------------- +// Description : Destructor +// ----------------------------------------------------------------------------- +// +OSN_EXPORT AlfAnimationOutput::~AlfAnimationOutput() + { + delete mTargetVisual; + delete mReferenceVisual; + delete mAttributeSetter; + delete mAttributeContainer; + } + +// ----------------------------------------------------------------------------- +// Description : Create and send the animation command +// ----------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAnimationOutput::sendCommand( + CAlfWidgetControl& aControl, unsigned int aDataID ) + { + CAlfVisual* ref = 0; + + if ( mReferenceVisual ) + { + // Find the reference visual + ref = mReferenceVisual->resolve( aControl, aDataID ); + } + // Find the animated visual + CAlfVisual* visual = NULL; + visual = mTargetVisual->resolve( aControl, aDataID ); + if ( visual ) + { + // Create the animation command(s) and send them through the env. + //ALF_PERF_START( perfdata, "AlfAnimationOutput-sendCommand-createAndSendCommands" ) + // reference visual is optional, it may be 0. + mAttributeSetter->createAndSendCommands( *visual, mAttributeContainer, ref ); + //ALF_PERF_STOP( perfdata, "AlfAnimationOutput-sendCommand-createAndSendCommands" ) + } + } + + } // namespace Alf + +// end of file diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfattribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfattribute.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,564 @@ +/* +* Copyright (c) 2007 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: Implementation for creating different types of attributes. +* +*/ + + +#include +#include +#include +#include "alf/alfattribute.h" +#include +#include +#include +#include + +using namespace osncore; + +namespace Alf + { + + +class AlfAttributeImpl + { +public: + AlfAttributeImpl():mCategory(AlfAttribute::EStatic), + mInterpolationStyle(EAlfTimedValueStyleUseSystemDefault), + mTime(0), + mDelay(0), + mMappingFunctionId(0), + mDirtyFlag(true) + { + } + + ~AlfAttributeImpl() + { + } + + UString mName; + AlfAttribute::attributecategory mCategory; + TAlfInterpolationStyle mInterpolationStyle; + int mTime; + int mDelay; + int mMappingFunctionId; + UString mDataField; + AlfPtrVector mTargetValueContainer; + AlfPtrVector mSourceValueContainer; + bool mDirtyFlag; + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::AlfAttribute() + { + reset("", 0, attributecategory(0)); + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::AlfAttribute(const char* aName, + attributecategory aCategory) + { + reset(aName, 0, aCategory); + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::AlfAttribute(const char* aName, int aValue, + TAlfUnit aUnit, attributecategory aCategory) + { + auto_ptr value(new (EMM) + AlfAttributeValueType(aValue, aUnit)); + reset(aName, value.get(), aCategory); + value.release(); + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::AlfAttribute(const char* aName, float aValue, + TAlfUnit aUnit, attributecategory aCategory) + { + auto_ptr value( + new( EMM ) AlfAttributeValueType( aValue, aUnit ) ); + reset(aName, value.get(), aCategory); + value.release(); + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::AlfAttribute(const char* aName, + const UString& aValue, attributecategory aCategory) + { + if (aCategory == EStaticData) + { + reset(aName, 0, aCategory); + setDataField(aValue.getUtf8()); + } + else + { + auto_ptr value( + new( EMM ) AlfAttributeValueType( aValue ) ); + reset(aName, value.get(), aCategory); + value.release(); + } + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::~AlfAttribute() + { + } + +// --------------------------------------------------------------------------- +// Assigment operation. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute& AlfAttribute::operator=(const AlfAttribute& aAttribute) + { + if ( this == &aAttribute ) + { + return *this; + } + + mData.reset( new( EMM ) AlfAttributeImpl() ); + + mData->mCategory = aAttribute.mData->mCategory; + mData->mName = UString(aAttribute.name()); + mData->mInterpolationStyle = aAttribute.mData->mInterpolationStyle; + + mData->mTime = aAttribute.mData->mTime; + mData->mDelay = aAttribute.mData->mDelay; + mData->mMappingFunctionId = aAttribute.mData->mMappingFunctionId; + mData->mDataField = UString(aAttribute.getDataField()); + + int count = aAttribute.mData->mTargetValueContainer.count(); + mData->mTargetValueContainer.resize( count ); + for ( int i = 0 ; i < count ; i++ ) + { + mData->mTargetValueContainer.insert( + i, cloneValueType( aAttribute.mData->mTargetValueContainer[i] ) ); + } + + count = aAttribute.mData->mSourceValueContainer.count(); + mData->mSourceValueContainer.resize( count ); + for ( int i = 0 ; i < count ; i++ ) + { + mData->mSourceValueContainer.insert( + i, cloneValueType( aAttribute.mData->mSourceValueContainer[i] ) ); + } + + return *this; + } + +// --------------------------------------------------------------------------- +// Clones the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute* AlfAttribute::clone() + { + auto_ptr clone( new( EMM ) AlfAttribute() ); + *clone.get() = *this; + return clone.release(); + } + +// --------------------------------------------------------------------------- +// Gets the name of the Attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfAttribute::name() const + { + return mData->mName.getUtf8(); + } + +// --------------------------------------------------------------------------- +// Gets the category of the atrribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute::attributecategory AlfAttribute::category() const + { + return mData->mCategory; + } + +// --------------------------------------------------------------------------- +// Gets the type of the target atrribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::Type AlfAttribute::type( + unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]->type(); + } + +// --------------------------------------------------------------------------- +// Gets the int value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttribute::intValue(unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]->intValue(); + } + +// --------------------------------------------------------------------------- +// Gets the real value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT float AlfAttribute::realValue(unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]->realValue(); + } + +// --------------------------------------------------------------------------- +// Gets the string value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfAttribute::stringValue(unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]->stringValue(); + } + +// --------------------------------------------------------------------------- +// Returns true if attribute is set. +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfAttribute::isValueSet() const + { + return mData->mTargetValueContainer.count() > 0; + } + +// --------------------------------------------------------------------------- +// Gets the unit of the value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfUnit AlfAttribute::unit(unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]->unit(); + } + +// --------------------------------------------------------------------------- +// Adds a new target value to the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::addTargetValue(AlfAttributeValueType* aValue) + { + mData->mTargetValueContainer.resize(mData->mTargetValueContainer.count() +1 ); + mData->mTargetValueContainer.insert(mData->mTargetValueContainer.count(), aValue); + } + +// --------------------------------------------------------------------------- +// Gets target value count. +// --------------------------------------------------------------------------- +// +OSN_EXPORT unsigned int AlfAttribute::getTargetValueCount() const + { + return mData->mTargetValueContainer.count(); + } + +// --------------------------------------------------------------------------- +// Sets the target value of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setTargetValue(AlfAttributeValueType* aValue, + unsigned int aIndex) + { + if (aIndex < mData->mTargetValueContainer.count()) + { + mData->mTargetValueContainer.remove(aIndex); + } + mData->mTargetValueContainer.insert(aIndex, aValue); + mData->mDirtyFlag=true; + } + +// --------------------------------------------------------------------------- +// Gets the target value of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType* AlfAttribute::getTargetValue( + unsigned int aIndex) const + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mTargetValueContainer[aIndex]; + } + +// --------------------------------------------------------------------------- +// Removes the target value of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::removeTargetValue(unsigned int aIndex) + { + if (aIndex >= mData->mTargetValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + mData->mTargetValueContainer.remove(aIndex); + } + +// --------------------------------------------------------------------------- +// Adds a new source value to the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::addSourceValue(AlfAttributeValueType* aValue) + { + mData->mSourceValueContainer.resize(mData->mSourceValueContainer.count() +1 ); + mData->mSourceValueContainer.insert(mData->mSourceValueContainer.count(), aValue); + } + +// --------------------------------------------------------------------------- +// Gets source value count. +// --------------------------------------------------------------------------- +// +OSN_EXPORT unsigned int AlfAttribute::getSourceValueCount() const + { + return mData->mSourceValueContainer.count(); + } + +// --------------------------------------------------------------------------- +// Adds a new source value to the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setSourceValue(AlfAttributeValueType* aValue, + unsigned int aIndex) + { + if (aIndex < mData->mSourceValueContainer.count()) + { + mData->mSourceValueContainer.remove(aIndex); + } + mData->mSourceValueContainer.insert(aIndex, aValue); + mData->mDirtyFlag=true; + } + +// --------------------------------------------------------------------------- +// Gets the source value of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType* AlfAttribute::getSourceValue( + unsigned int aIndex) const + { + if (aIndex >= mData->mSourceValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + return mData->mSourceValueContainer[aIndex]; + } + +// --------------------------------------------------------------------------- +// Removes the source value of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::removeSourceValue(unsigned int aIndex) + { + if (aIndex >= mData->mSourceValueContainer.count()) + { + ALF_THROW(AlfAttributeException,EInvalidAttribute,"AlfAttribute") + } + mData->mSourceValueContainer.remove(aIndex); + } + +// --------------------------------------------------------------------------- +// Sets the interpolation style of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setInterpolationStyle( + TAlfInterpolationStyle aInterpolationStyle) + { + mData->mInterpolationStyle = aInterpolationStyle; + mData->mDirtyFlag=true; + } + +// --------------------------------------------------------------------------- +// Gets the interpolation style of the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfInterpolationStyle AlfAttribute::getInterpolationStyle()const + { + return mData->mInterpolationStyle; + } + +// --------------------------------------------------------------------------- +// Sets the transition time for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setTime(int aTime) + { + mData->mTime = aTime; + mData->mDirtyFlag=true; + } + +// --------------------------------------------------------------------------- +// Gets the transition time for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttribute::getTime()const + { + return mData->mTime; + } + +// --------------------------------------------------------------------------- +// Sets the mapping function id for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setMappingFunctionId(int aId) + { + mData->mMappingFunctionId = aId; + mData->mDirtyFlag=true; + } + +// --------------------------------------------------------------------------- +// Gets the mapping function id for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttribute::getMappingFunctionId()const + { + return mData->mMappingFunctionId; + } + +// --------------------------------------------------------------------------- +// Sets the datafield for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setDataField(const char* aDataField) + { + mData->mDataField = UString(aDataField); + mData->mDirtyFlag = true; + } + +// --------------------------------------------------------------------------- +// Gets the datafield for the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const char* AlfAttribute::getDataField() const + { + return mData->mDataField.getUtf8(); + } + +// --------------------------------------------------------------------------- +// Sets the delay before the transition. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttribute::setDelay(int aDelay) + { + mData->mDelay = aDelay; + mData->mDirtyFlag = true; + } + +// --------------------------------------------------------------------------- +// Gets the delay before the transition. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttribute::getDelay() const + { + return mData->mDelay; + } + +// --------------------------------------------------------------------------- +// Resets the data. +// --------------------------------------------------------------------------- +// +void AlfAttribute::reset( const char* aName, AlfAttributeValueType* aValue, + attributecategory aCategory) + { + mData.reset(new (EMM) AlfAttributeImpl()); + + mData->mCategory = aCategory; + mData->mName = UString(aName); + mData->mTargetValueContainer.remove(0); + mData->mTargetValueContainer.insert(0, aValue); + } + +// --------------------------------------------------------------------------- +// Helper function for cloning value type. +// --------------------------------------------------------------------------- +// +AlfAttributeValueType* AlfAttribute::cloneValueType( + AlfAttributeValueType* aValue) const + { + AlfAttributeValueType* ret = 0; + + if (aValue) + { + switch (aValue->type()) + { + case AlfAttributeValueType::EInt: + { + ret = new (EMM) AlfAttributeValueType( + aValue->intValue(), aValue->unit()); + break; + } + case AlfAttributeValueType::EFloat: + { + ret = new (EMM) AlfAttributeValueType( + aValue->realValue(), aValue->unit()); + break; + } + case AlfAttributeValueType::EString: + { + ret = new (EMM) AlfAttributeValueType( + aValue->stringValue()); + break; + } + default: + break; + } + } + + return ret; + } +OSN_EXPORT bool AlfAttribute::isDirty( ) const + { + return mData->mDirtyFlag; + } + +OSN_EXPORT void AlfAttribute::setDirty(bool aFlag ) + { + mData->mDirtyFlag = aFlag; + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfattributecontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfattributecontainer.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2007 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: Implements the Container class for atrributes. +* +*/ + + +#include +#include +#include +#include "alf/alfattribute.h" +#include "alf/alfattributecontainer.h" +#include +#include +#include // from libc + +namespace Alf + { + + +/** + * Attribute container implementation. + */ +class AlfAttributeContainerImpl + { +public: + osncore::AlfPtrVector mAttributes; + AlfAttributeContainer::Type mType; + uint mTime; + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// + +OSN_EXPORT AlfAttributeContainer::AlfAttributeContainer(Type aType) : + mData(new (EMM) AlfAttributeContainerImpl()) + { + mData->mType = aType; + mData->mTime = 0; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeContainer::~AlfAttributeContainer() + { + + } + +// --------------------------------------------------------------------------- +// Gets the type of the container. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeContainer::Type AlfAttributeContainer::type() const + { + return mData->mType; + } + +// --------------------------------------------------------------------------- +// Adds a new attribute to the container. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttributeContainer::addAttribute(AlfAttribute* aAttribute) + { + mData->mAttributes.resize(mData->mAttributes.count() +1 ); + mData->mAttributes.insert(mData->mAttributes.count(), aAttribute); + } + +// --------------------------------------------------------------------------- +// Returns the attribute count. +// --------------------------------------------------------------------------- +// +OSN_EXPORT unsigned int AlfAttributeContainer::attributeCount()const + { + return mData->mAttributes.count(); + } + +// --------------------------------------------------------------------------- +// Returns the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute& AlfAttributeContainer::getAttribute( + unsigned int aIndex) const + { + // invariant + assert(aIndex < mData->mAttributes.count()); + if (aIndex >= mData->mAttributes.count()) + { + ALF_THROW(AlfDataException,EInvalidAttribute,"AlfAttributeContainer") + } + + return *(mData->mAttributes[aIndex]); + } + +// --------------------------------------------------------------------------- +// Returns the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttribute& AlfAttributeContainer::getAttributeByName( + const char * aName) const + { + for (TInt i=0; i < mData->mAttributes.count(); i++) + { + if (!strcmp(mData->mAttributes[i]->name(), aName)) + { + return *(mData->mAttributes[i]); + } + } + ALF_THROW(AlfDataException,EInvalidAttribute,"AlfAttributeContainer") + } + +// --------------------------------------------------------------------------- +// Removes the attribute. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttributeContainer::removeAttribute(unsigned int aIndex) + { + assert(aIndex < mData->mAttributes.count()); + if (aIndex >= mData->mAttributes.count()) + { + ALF_THROW(AlfDataException,EInvalidAttribute,"AlfAttributeContainer") + } + + mData->mAttributes.remove(aIndex); + } + +// --------------------------------------------------------------------------- +// Sets the animation time of the attribute container. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfAttributeContainer::setTime(unsigned int aTime) + { + mData->mTime = aTime; + } + +// --------------------------------------------------------------------------- +// Returns the animation time of the attribute container. +// --------------------------------------------------------------------------- +// +OSN_EXPORT unsigned int AlfAttributeContainer::getTime()const + { + return mData->mTime; + } + + } // Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfattributevaluetype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfattributevaluetype.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2007 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: Implementation to know the type of attribute. +* +*/ + + +#include +#include +#include +#include +#include "alf/alfattributevaluetype.h" + +#include "alfenumvalue.h" +#include "alfrealvalue.h" +#include "alfstringvalue.h" + +namespace Alf + { + +class AlfAttributeValueTypeImpl + { +public: + AlfAttributeValueTypeImpl() + { + mValueType = NULL; + } + + ~AlfAttributeValueTypeImpl() + { + delete mValueType; + } + + AlfAttributeValueType* mValueType; + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfAttributeValueType::AlfAttributeValueType() + { + + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::AlfAttributeValueType(int aValue, + TAlfUnit aUnit) + { + auto_ptr value(new (EMM) AlfEnumValue(aValue, aUnit)); + auto_ptr valueType( + new (EMM) AlfAttributeValueTypeImpl()); + + mData.reset(valueType.release()); // ownership transferred + mData->mValueType = value.release(); // ownership transferred + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::AlfAttributeValueType(float aValue, + TAlfUnit aUnit) + { + auto_ptr value(new (EMM) AlfRealValue(aValue, aUnit)); + auto_ptr valueType( + new (EMM) AlfAttributeValueTypeImpl()); + + mData.reset(valueType.release()); // ownership transferred + mData->mValueType = value.release(); // ownership transferred + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::AlfAttributeValueType(const UString& aValue) + { + auto_ptr value(new (EMM) AlfStringValue(aValue)); + auto_ptr valueType( + new (EMM) AlfAttributeValueTypeImpl()); + + mData.reset(valueType.release()); // ownership transferred + mData->mValueType = value.release(); // ownership transferred + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::~AlfAttributeValueType() + { + + } + +// --------------------------------------------------------------------------- +// Gets the enum value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttributeValueType::enumValue() const + { + return intValue(); + } + +// --------------------------------------------------------------------------- +// Gets the string value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfAttributeValueType::stringValue() const + { + if (type() != EString) + { + ALF_THROW(AlfDataException,EInvalidAttributeValue,"AlfAttributeValueType") + } + return mData->mValueType->stringValue(); + } + +// --------------------------------------------------------------------------- +// Gets the int value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfAttributeValueType::intValue() const + { + if (type() != EInt) + { + ALF_THROW(AlfDataException,EInvalidAttributeValue,"AlfAttributeValueType") + } + return mData->mValueType->enumValue(); + } + +// --------------------------------------------------------------------------- +// Gets the real value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT float AlfAttributeValueType::realValue() const + { + if (type() != EFloat) + { + ALF_THROW(AlfDataException,EInvalidAttributeValue,"AlfAttributeValueType") + } + return mData->mValueType->realValue(); + } + +// --------------------------------------------------------------------------- +// Gets the RGB value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT float AlfAttributeValueType::rgbValue() const + { + return realValue(); + } + +// --------------------------------------------------------------------------- +// Gets the type of the atrribute value. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfAttributeValueType::Type AlfAttributeValueType::type() const + { + return mData->mValueType->type(); + } + +// --------------------------------------------------------------------------- +// Gets the unit. +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfUnit AlfAttributeValueType::unit() const + { + return mData->mValueType->unit(); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfcommonattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfcommonattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2007 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: This class implements common attribute setters. +* +*/ + + +#include +#include + +#include +#include +#include "alf/attrproperty.h" + +#include "alf/alfattribute.h" +#include "alf/alfcommonattributesetter.h" +#include +#include +#include "alf/alfattributecontainer.h" + +using namespace duiuimodel::commonattributes; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonAttributeSetter::AlfCommonAttributeSetter() + { + mDoDirtycheck=false; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonAttributeSetter::~AlfCommonAttributeSetter() + { + + } + +// --------------------------------------------------------------------------- +// Returns the type of the attribute setter. +// --------------------------------------------------------------------------- +// +OSN_EXPORT SetterType AlfCommonAttributeSetter::setterType() + { + return ECustomAttributeSetter; + } + +// --------------------------------------------------------------------------- +// Sets an attribute value in the target visual immediately +// without a transition. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCommonAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData) + { + if (!aContainer) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfCommonAttributeSetter" ) + } + + unsigned int attrCount = aContainer->attributeCount(); + for (int i=0; igetAttribute(i); + const char* attrName = attr.name(); + + if (attr.category() == AlfAttribute::EStaticData) + { + handleStaticDataAttribute(aVisual, attr, *aContainer, aData); + } + else if (attr.category() == AlfAttribute::EDynamicData) + { + handleDynamicDataAttribute(aVisual, attr, *aContainer, aData); + } + else if (attr.category() == AlfAttribute::EStatic) + { + if ((mDoDirtycheck&&attr.isDirty())||!mDoDirtycheck) + { + handleStaticAttribute(aVisual, attr, *aContainer); + } + attr.setDirty(false); + + } + else if (attr.category() == AlfAttribute::EDynamic) + { + if ((mDoDirtycheck&&attr.isDirty())||!mDoDirtycheck) + { + handleDynamicAttribute(aVisual, attr, *aContainer); + } + attr.setDirty(false); + + } + } + } + +// --------------------------------------------------------------------------- +// Creates a command to change the value of an attribute in the target visual. +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfCommonAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + // No need to implement. + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// Creates commands to change the given attribute values in the target visual. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCommonAttributeSetter::createAndSendCommands( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + CAlfVisual* /*aRefVisual*/) + { + // No need to implement. + } + +// --------------------------------------------------------------------------- +// Getter for interfaces provided by the element classes. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfCommonAttributeSetter::makeInterface( + const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfAttributeSetter::type().mImplementationId) + { + return this; + } + return NULL; + } + +// --------------------------------------------------------------------------- +// Converts text between Unicode (UCS-2) and the Unicode transformation +// format UTF-8. +// --------------------------------------------------------------------------- +// +HBufC* AlfCommonAttributeSetter::convertToUnicodeFromUtf8( + const TPtrC8& aSrc) const + { + HBufC* desValue = 0; + TRAPD( err, desValue = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aSrc)) + if (err != KErrNone) + { + ALF_THROW(AlfAttributeException, err,"AlfCommonAttributeSetter") + } + return desValue; + } + +// --------------------------------------------------------------------------- +// Sets a value of a static attribute to target visual immediately +// without a transition. +// --------------------------------------------------------------------------- +// +void AlfCommonAttributeSetter::handleStaticAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& /*aContainer*/) + { + const char* attrName = aAttr.name(); + if (!strcmp(attrName, KId)) + { + const char* val = aAttr.stringValue().getUtf8(); + TPtrC8 src((TUint8*)val); + TRAPD(err, aVisual.SetTagL( src )); + if (err) + { + ALF_THROW(AlfAttributeException, err, + "AlfCommonAttributeSetter") + } + } + } +// --------------------------------------------------------------------------- +// Sets a dynamic attribute value in the target visual using transitions +// defined in attributes. +// --------------------------------------------------------------------------- +// +void AlfCommonAttributeSetter::handleDynamicAttribute( + CAlfVisual& /*aVisual*/, AlfAttribute& /*aAttr*/, + AlfAttributeContainer& /*aContainer*/) + { + //nothing to do + } + +// --------------------------------------------------------------------------- +// Sets a value for static data attribute in the target visual +// immediately without a transition using data in map. +// --------------------------------------------------------------------------- +// +void AlfCommonAttributeSetter::handleStaticDataAttribute( + CAlfVisual& /*aVisual*/, AlfAttribute& /*aAttr*/, + AlfAttributeContainer& /*aContainer*/, IAlfMap* /*aData*/) + { + //nothing to do + } + +// --------------------------------------------------------------------------- +// Sets a value for dynamic data attribute value in the target visual +// using transitions and data in map. +// --------------------------------------------------------------------------- +// +void AlfCommonAttributeSetter::handleDynamicDataAttribute( + CAlfVisual& /*aVisual*/, AlfAttribute& /*aAttr*/, + AlfAttributeContainer& /*aContainer*/, IAlfMap* /*aData*/) + { + //nothing to do + } + +OSN_EXPORT void AlfCommonAttributeSetter::enableDirtyCheck(bool aCheck) + { + mDoDirtycheck=aCheck; + } + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfcommonlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfcommonlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,412 @@ +/* +* Copyright (c) 2007 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: Implements common attributesetters for layout. +* +*/ + + + +#include "alf/alfattribute.h" +#include "alf/alfcommonlayoutattributesetter.h" +#include "alf/alfattributevaluetype.h" +#include +#include +#include +#include "alf/alfattributecontainer.h" +#include +#include +#include "alf/attrproperty.h" +#include +#include +#include +#include +#include + +using namespace osncore; + +using namespace duiuimodel::layoutattributes; + +namespace Alf + { + +static void throwIfNot ( bool aBoolean ) + { + if ( !aBoolean ) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute,"CAlfCommonlayoutAttributeSetter") + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonLayoutAttributeSetter::AlfCommonLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonLayoutAttributeSetter::~AlfCommonLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCommonLayoutAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfLayout* layout = dynamic_cast ( &aVisual ); + + if ( !layout ) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, + "AlfCommonLayoutAttributeSetter" ) + } + + AlfCommonVisualAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +void AlfCommonLayoutAttributeSetter::handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + + if ( aData ) + { + CAlfLayout* layout = dynamic_cast ( &aVisual ); + if(!layout) + { + return; + } + + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KBaseUnitX ) ) + { + IAlfVariantType* dataX = aData->item ( UString(aAttr.getDataField()) ); + AlfAttribute& attrY = aContainer.getAttributeByName ( KBaseUnitY ); + + IAlfVariantType* dataY = aData->item ( UString(attrY.getDataField())); + + if (dataX!=NULL&&dataX->type() == IAlfVariantType::EMap&& + dataY!=NULL&&dataY->type() == IAlfVariantType::EMap) + { + IAlfVariantType* valueX=((IAlfMap*)dataX)->item(UString("value")); + IAlfVariantType* unitX=((IAlfMap*)dataX)->item(UString("unit")); + IAlfVariantType* valueY=((IAlfMap*)dataY)->item(UString("value")); + IAlfVariantType* unitY=((IAlfMap*)dataY)->item(UString("unit")); + + TAlfMetric xMetric ( valueX->real(), (TAlfUnit)unitX->integer() ); + TAlfMetric yMetric ( valueX->real(), (TAlfUnit)unitX->integer()); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetBaseUnit( xyMetric ); + } + else if (dataX!=NULL&&dataX->type() == IAlfVariantType::EReal&& + dataY!=NULL&&dataY->type() == IAlfVariantType::EReal) + { + TAlfMetric xMetric ( (float)dataX->real() ); + TAlfMetric yMetric ( (float)dataY->real()); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetBaseUnit( xyMetric ); + } + } + else if ( !strcmp ( attrName, KBaseUnitY ) ) + { + //we have handled it + } + + else if ( !strcmp ( attrName, KUpdateLayoutTime ) ) + { + IAlfVariantType* data = aData->item (UString(aAttr.getDataField()) ); + + if ( data && data->type() == IAlfVariantType::EInt ) + { + layout->SetTransitionTime ( data->integer() ); + } + else if ( data && data->type() == IAlfVariantType::EReal ) + { + layout->SetTransitionTime ( ( int ) data->real() ); + } + } + else if ( !strcmp ( attrName, KTransitionTime ) ) + { + IAlfVariantType* data = aData->item (UString(aAttr.getDataField()) ); + + if ( data && data->type() == IAlfVariantType::EInt ) + { + layout->SetTransitionTime ( data->integer() ); + } + else if ( data && data->type() == IAlfVariantType::EReal ) + { + layout->SetTransitionTime ( ( int ) data->real() ); + } + } + else if ( !strcmp ( attrName, KAutomaticLocaleMirroring ) ) + { + IAlfVariantType* data = aData->item (UString(aAttr.getDataField()) ); + throwIfNot ( data != NULL && data->type() == IAlfVariantType::EString ); + + if ( !strcmp ( data->string().getUtf8(), "true" ) ) + layout->SetFlag ( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + else if ( !strcmp ( data->string().getUtf8(), "false" ) ) + layout->ClearFlag ( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + } + else if ( !strcmp ( attrName, KInnerPaddingHoriz ) ) + { + IAlfVariantType* dataX = aData->item (UString(aAttr.getDataField()) ); + AlfAttribute& attrY = aContainer.getAttributeByName ( KInnerPaddingVertical ); + + IAlfVariantType* dataY = aData->item ( UString(attrY.getDataField() )); + + if (dataX&&dataX->type() == IAlfVariantType::EMap&&dataY + &&dataY->type()== IAlfVariantType::EMap) + { + IAlfVariantType* valueX=((IAlfMap*)dataX)->item(UString("value")); + IAlfVariantType* unitX=((IAlfMap*)dataX)->item(UString("unit")); + IAlfVariantType* valueY=((IAlfMap*)dataY)->item(UString("value")); + IAlfVariantType* unitY=((IAlfMap*)dataY)->item(UString("unit")); + + TAlfMetric xMetric ( valueX->real(), (TAlfUnit)unitX->integer() ); + TAlfMetric yMetric ( valueX->real(), (TAlfUnit)unitX->integer()); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetInnerPadding( xyMetric ); + } + if ( dataX&&dataX->type() == IAlfVariantType::EReal&&dataY + &&dataY->type()== IAlfVariantType::EReal) + { + TAlfMetric xMetric ( dataX->real(),EAlfUnitPixel ); + TAlfMetric yMetric ( dataY->real() ,EAlfUnitPixel); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetInnerPadding( xyMetric ); + } + } + else if ( !strcmp ( attrName, KInnerPaddingVertical ) ) + { + // we have handled it + } + else if ( !strcmp ( attrName, KScrolling ) ) + { + IAlfVariantType* data = aData->item ( UString(aAttr.getDataField() )); + + throwIfNot ( data != NULL && data->type() == IAlfVariantType::EString ); + + if ( !strcmp ( data->string().getUtf8(), "true" ) ) + { + TRAPD(err,layout->EnableScrollingL()) + throwIfNot(err!=KErrNone); + } + + else + { + TRAPD(err,layout->EnableScrollingL(false)) + throwIfNot(err!=KErrNone); + } + } + else if ( !strcmp ( attrName, KLayoutScrollOffsetX ) ) + { + IAlfVariantType* dataX = aData->item ( UString(aAttr.getDataField() )); + throwIfNot ( dataX != NULL && dataX->type() == IAlfVariantType::EReal ); + + AlfAttribute& attrY = aContainer.getAttributeByName ( KLayoutScrollOffsetY ); + IAlfVariantType* dataY = aData->item (UString( attrY.getDataField() )); + throwIfNot ( dataY != NULL && dataY->type() == IAlfVariantType::EReal ); + + TAlfTimedPoint point ( dataX->real(), dataY->real() ); + layout->SetScrollOffset ( point ); + } + else if ( !strcmp ( attrName, KLayoutScrollOffsetY ) ) + { + // we have handled it + } + else + { + AlfCommonVisualAttributeSetter::handleStaticDataAttribute( aVisual, aAttr, aContainer, aData); + } + } + } + +void AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + AlfCommonVisualAttributeSetter::handleDynamicDataAttribute( aVisual, aAttr, aContainer, aData); + } + +void AlfCommonLayoutAttributeSetter::handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + CAlfLayout* layout = dynamic_cast ( &aVisual ); + if(!layout) + { + return; + } + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KBaseUnitX )||!strcmp ( attrName, KBaseUnitY ) ) + { + AlfAttribute& attrX = aContainer.getAttributeByName ( KBaseUnitX ); + AlfAttribute& attrY = aContainer.getAttributeByName ( KBaseUnitY ); + TAlfMetric xMetric ( attrX.realValue(), attrX.unit() ); + TAlfMetric yMetric ( attrY.realValue(), attrY.unit() ); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetBaseUnit ( xyMetric ); + attrX.setDirty(false); + attrY.setDirty(false); + } + else if ( !strcmp ( attrName, KUpdateLayoutTime ) ) + { + if ( aAttr.type() == AlfAttributeValueType::EInt ) + { + layout->SetTransitionTime ( aAttr.intValue() ); + } + else if ( aAttr.type() == AlfAttributeValueType::EFloat ) + { + layout->SetTransitionTime ( ( int ) aAttr.realValue() ); + } + } + else if ( !strcmp ( attrName, KTransitionTime ) ) + { + if ( aAttr.type() == AlfAttributeValueType::EInt ) + { + layout->SetTransitionTime ( aAttr.intValue() ); + } + else if ( aAttr.type() == AlfAttributeValueType::EFloat ) + { + layout->SetTransitionTime ( ( int ) aAttr.realValue() ); + } + } + else if ( !strcmp ( attrName, KAutomaticLocaleMirroring ) ) + { + throwIfNot ( aAttr.type() == AlfAttributeValueType::EString ); + + if ( !strcmp ( aAttr.stringValue().getUtf8(), "true" ) ) + { + layout->SetFlag ( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + } + else if ( !strcmp ( aAttr.stringValue().getUtf8(), "false" ) ) + { + layout->ClearFlag ( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); + } + } + else if ( !strcmp ( attrName, KInnerPaddingHoriz )||!strcmp ( attrName, KInnerPaddingVertical ) ) + { + AlfAttribute& attrY = aContainer.getAttributeByName ( KInnerPaddingVertical ); + AlfAttribute& attrX= aContainer.getAttributeByName ( KInnerPaddingHoriz ); + throwIfNot ( attrX.type() == AlfAttributeValueType::EFloat ); + throwIfNot ( attrY.type() == AlfAttributeValueType::EFloat ); + TAlfMetric xMetric ( attrX.realValue(), attrX.unit() ); + TAlfMetric yMetric ( attrY.realValue(), attrY.unit() ); + TAlfXYMetric xyMetric ( xMetric, yMetric ); + layout->SetInnerPadding ( xyMetric ); + attrX.setDirty(false); + attrY.setDirty(false); + } + else if ( !strcmp ( attrName, KScrolling ) ) + { + throwIfNot ( aAttr.type() == AlfAttributeValueType::EString ); + + if ( !strcmp ( aAttr.stringValue().getUtf8(), "true" ) ) + { + TRAPD(err, layout->EnableScrollingL () ); + throwIfNot (err==KErrNone); + } + else + { + TRAPD(err, layout->EnableScrollingL ( false ) ); + throwIfNot (err==KErrNone); + } + } + else if ( !strcmp ( attrName, KLayoutScrollOffsetX )||!strcmp ( attrName, KLayoutScrollOffsetY ) ) + { + AlfAttribute& attrY = aContainer.getAttributeByName ( KLayoutScrollOffsetY ); + AlfAttribute& attrX = aContainer.getAttributeByName ( KLayoutScrollOffsetX ); + + TAlfTimedPoint point ( attrX.realValue(), attrY.realValue() ); + + layout->SetScrollOffset ( point ); + attrX.setDirty(false); + attrY.setDirty(false); + } + else + { + AlfCommonVisualAttributeSetter::handleStaticAttribute(aVisual, aAttr, aContainer); + } + } + +void AlfCommonLayoutAttributeSetter::handleDynamicAttribute( CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + AlfCommonVisualAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfCommonLayoutAttributeSetter::createCommand ( + CAlfVisual& aVisual, AlfAttributeContainer* aContainer, + IAlfMap* aData, int aTransitionTime, CAlfVisual* aRefVisual ) + { + TAlfCommand* cmd = 0; + cmd = AlfCommonVisualAttributeSetter::createCommand ( + aVisual, + aContainer, + aData, + aTransitionTime, + aRefVisual ); + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCommonLayoutAttributeSetter::createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + + unsigned int attrCount = aContainer->attributeCount(); + + for ( int i = 0; i < attrCount; ++i ) + { + AlfAttribute* attrib = & ( aContainer->getAttribute ( i ) ); + const char* attrName = attrib->name(); + + if (strcmp ( attrName, KBaseUnitX )&&strcmp ( attrName, KBaseUnitY ) + &&strcmp ( attrName, KUpdateLayoutTime )&&strcmp ( attrName, KTransitionTime ) + &&strcmp ( attrName, KAutomaticLocaleMirroring )&&strcmp ( attrName, KInnerPaddingHoriz ) + &&strcmp ( attrName, KInnerPaddingVertical )) + { + // Call the base class implementation also. + // It goes through the same loop again and checks if there are attributes + // that it handles. + AlfCommonVisualAttributeSetter::createAndSendCommands ( + aVisual, + aContainer, + aRefVisual ); + } + } + } + + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfcommonvisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfcommonvisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,843 @@ +/* +* Copyright (c) 2007 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: attributesetter for common visual attributes +* +*/ + + +#include "alf/alfattribute.h" +#include "alf/alfcommonvisualattributesetter.h" +#include "alf/alfattributevaluetype.h" +#include +#include +#include +#include +#include "alf/alfattributecontainer.h" +#include +#include +#include "alf/attrproperty.h" +#include + +using namespace osncore; + +using namespace duiuimodel::commonattributes; +using namespace duiuimodel::commonattributevalues; +using namespace duiuimodel::commonvisualattributes; +using namespace duiuimodel::layoutattributes; +using namespace duiuimodel::rect; +using namespace duiuimodel::padding; +using namespace duiuimodel::tactileattributes; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// gets the data from map pointed by attribute's field name. +// --------------------------------------------------------------------------- +// +IAlfVariantType* getData(const AlfAttribute& aAttr, IAlfMap* aData) + { + IAlfVariantType* data = 0; + const char* dataField = aAttr.getDataField(); + if (dataField) + { + data = aData->item(UString(dataField)); + } + return data; + } + +// --------------------------------------------------------------------------- +// gets the time from attribute safely. +// --------------------------------------------------------------------------- +// +int getTime(const AlfAttribute& aAttr, bool aImmediate = false) + { + int time = 0; + if (!aImmediate) + { + time = aAttr.getTime(); + } + + return time; + } + +// --------------------------------------------------------------------------- +// sets source values from aAttr to aPoint. +// --------------------------------------------------------------------------- +// +void setSourceValue(TAlfTimedValue& aValue, const AlfAttribute& aAttr) + { + if (aAttr.getSourceValueCount() > 0) + { + aValue.SetValueNow(aAttr.getSourceValue()->realValue()); + } + } +// --------------------------------------------------------------------------- +// sets source values to aPoint. +// --------------------------------------------------------------------------- +// +void SetSourceValues(TAlfTimedPoint& aPoint, const AlfAttribute& aAttrX, + const AlfAttribute& aAttrY) + { + if (aAttrX.getSourceValueCount() > 0) + { + aPoint.iX.SetValueNow(aAttrX.getSourceValue()->realValue()); + } + if (aAttrY.getSourceValueCount() > 0) + { + aPoint.iY.SetValueNow(aAttrY.getSourceValue()->realValue()); + } + } + +// --------------------------------------------------------------------------- +// sets source values to aRect. +// --------------------------------------------------------------------------- +// +void SetSourceRect(TAlfRealRect& aRect, const AlfAttribute& aAttrTopX, + const AlfAttribute& aAttrTopY, + const AlfAttribute& aAttrBottomRightX, + const AlfAttribute& aAttrBottomRightY) + { + if (aAttrTopX.getSourceValueCount() > 0) + { + aRect.iTl.iX = aAttrTopX.getSourceValue()->realValue(); + } + if (aAttrTopY.getSourceValueCount() > 0) + { + aRect.iTl.iY = aAttrTopY.getSourceValue()->realValue(); + } + if (aAttrBottomRightX.getSourceValueCount() > 0) + { + aRect.iBr.iX = aAttrBottomRightX.getSourceValue()->realValue(); + } + if (aAttrBottomRightY.getSourceValueCount() > 0) + { + aRect.iBr.iY = aAttrBottomRightY.getSourceValue()->realValue(); + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonVisualAttributeSetter::AlfCommonVisualAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCommonVisualAttributeSetter::~AlfCommonVisualAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// creates one command. +// deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfCommonVisualAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/ ) + { + return 0; + } + +// --------------------------------------------------------------------------- +// creates and sends one or more commands. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCommonVisualAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + unsigned int attrCount = aContainer->attributeCount(); + + for ( int i = 0; i < attrCount; ++i ) + { + AlfAttribute& attr = aContainer->getAttribute(i); + sendCommandsForAttribute(aVisual, *aContainer, attr, aRefVisual); + } + + // Call the base class implementation also. + // It goes through the same loop again and checks if there are attributes + // that it handles. + AlfCommonAttributeSetter::createAndSendCommands( + aVisual, + aContainer, + aRefVisual ); + } + +// --------------------------------------------------------------------------- +// Sets an value of a static attribute to target visual immediately +// without a transition. +// --------------------------------------------------------------------------- +// +void AlfCommonVisualAttributeSetter::handleStaticAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + const char* attrName = aAttr.name(); + if ( !strcmp(attrName, KParentVisual)) + { + } + else if (!strcmp(attrName, KMaxHeight)||!strcmp(attrName, KMaxWidth)) + { + setMaxSize(aVisual,aContainer,NULL); + } + else if (!strcmp(attrName, KMinHeight)||!strcmp(attrName, KMinWidth)) + { + setMinSize(aVisual,aContainer,NULL); + } + else if (!strcmp(attrName, KPaddingTop)||!strcmp(attrName, KPaddingBottom) + ||!strcmp(attrName, KPaddingLeft)||!strcmp(attrName, KPaddingRight)) + { + setPadding(aVisual,aContainer,NULL); + + } + else if (!strcmp(attrName, KSetFlags)) + { + int val = aAttr.intValue(); + aVisual.SetFlags(val); + } + else if (!strcmp(attrName, KClearFlags)) + { + int val = aAttr.intValue(); + aVisual.ClearFlags(val); + } + else if (!strcmp(attrName, KEventInput) || !strcmp(attrName, KFeedbackType)) + { + setTactileFeedback(aVisual,aContainer,NULL); + } + // turnangle and secondaryalpha are implemented by derived attributesetters + else + { + //check, if dynamic attribute, if so, set attributes immediately. + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer, true)) + { + //not handled here, try base class. + AlfCommonAttributeSetter::handleStaticAttribute(aVisual, + aAttr, aContainer); + } + } + } + +void AlfCommonVisualAttributeSetter::setTactileFeedback(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/) + { + TRAPD( error, aVisual.SetTactileFeedbackL( + aContainer.getAttributeByName( KEventInput ).intValue(), + aContainer.getAttributeByName( KFeedbackType ).intValue() ) ); + + if(error != KErrNone) + { + ALF_THROW(AlfVisualException,EInvalidAttribute,"AlfCommonVisualAttributeSetter") + } + try + { + aContainer.getAttributeByName( duiuimodel::tactileattributes::KEventInput ).setDirty( false ); + aContainer.getAttributeByName( duiuimodel::tactileattributes::KFeedbackType ).setDirty( false ); + } + + catch( AlfDataException& exception ) + { + //exception needed here? + } + } + +// --------------------------------------------------------------------------- +// Sets an dynamic attribute value in the target visual +// using transitions defined in attributes +// --------------------------------------------------------------------------- +// +void AlfCommonVisualAttributeSetter::handleDynamicAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer)) + { + //not handled here, try base class. + AlfCommonAttributeSetter::handleDynamicAttribute(aVisual, aAttr, + aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets an value for static attribute in the target visual immediately +// without a transition using data in map. +// --------------------------------------------------------------------------- +// +void AlfCommonVisualAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + + if (aData) + { + const char* attrName = aAttr.name(); + + if (!strcmp(attrName, KMaxHeight)) + { + // If maxheight exists, maxwidth must exists also. + const IAlfVariantType* maxHeight = getData(aAttr, aData); + const IAlfVariantType* maxWidth = getData( + aContainer.getAttributeByName(KMaxWidth), aData); + + if (maxHeight && maxHeight->type() == IAlfVariantType::EReal && + maxWidth && maxWidth->type() == IAlfVariantType::EReal) + { + TAlfRealSize size( maxWidth->real(), maxHeight->real() ); + aVisual.SetMaxSize(size); + } + } + else if (!strcmp(attrName, KMinHeight)) + { + //If minheight exists, minwidth must exists also. + const IAlfVariantType* minHeight = getData(aAttr, aData); + const IAlfVariantType* minWidth = getData( + aContainer.getAttributeByName(KMinWidth), aData); + + if (minHeight && minHeight->type() == IAlfVariantType::EReal && + minWidth && minWidth->type() == IAlfVariantType::EReal) + { + TAlfRealSize size( minWidth->real(), minHeight->real() ); + aVisual.SetMinSize(size); + } + } + else if (!strcmp(attrName, KPaddingTop)) + { + const IAlfVariantType* top = getData(aAttr, aData); + const IAlfVariantType* right = getData( + aContainer.getAttributeByName(KPaddingRight), aData); + const IAlfVariantType* bottom = getData( + aContainer.getAttributeByName(KPaddingBottom), aData); + const IAlfVariantType* left = getData( + aContainer.getAttributeByName(KPaddingLeft), aData); + + if (top && top->type() == IAlfVariantType::EReal && + right && right->type() == IAlfVariantType::EReal && + bottom && bottom->type() == IAlfVariantType::EReal && + left && left->type() == IAlfVariantType::EReal) + { + float l = left->real(); + float r = right->real(); + float t = top->real(); + float b = bottom->real(); + TAlfBoxMetric metric(l, r, t, b); + aVisual.SetPadding(metric); + } + } + else if (!strcmp(attrName, KSetFlags)) + { + const IAlfVariantType* flag = getData(aAttr, aData); + if (flag && flag->type() == IAlfVariantType::EInt) + { + int flagValue = flag->integer(); + aVisual.SetFlags(flagValue); + } + } + else if (!strcmp(attrName, KClearFlags)) + { + const IAlfVariantType* flag = getData(aAttr, aData); + if (flag && flag->type() == IAlfVariantType::EInt) + { + int flagValue = flag->integer(); + aVisual.ClearFlags(flagValue); + } + } + // turnangle and secondaryalpha are implemented by derived attributesetters + else if (strcmp(attrName, KMaxWidth) && //these are already + strcmp(attrName, KMinWidth) && //handled above + strcmp(attrName, KPaddingRight) && + strcmp(attrName, KPaddingBottom) && + strcmp(attrName, KPaddingLeft)) + { + //check, if dynamic attribute, if so, set attributes immediately. + //If not, the function will call baseclass SetAttributeValue. + if (!doHandleDynamicDataAttribute(aVisual, aAttr, + aContainer, aData, true)) + { + //not handled here, try base class. + AlfCommonAttributeSetter::handleStaticDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + } + } + +// --------------------------------------------------------------------------- +// From AlfCommonAttributeSetter +// +// Sets a value for dynamic data attribute value in the target visual +// using transitions and data in map. +// --------------------------------------------------------------------------- +// +void AlfCommonVisualAttributeSetter::handleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + if (!doHandleDynamicDataAttribute(aVisual, aAttr, aContainer, aData)) + { + //not handled here, try base class. + AlfCommonAttributeSetter::handleDynamicDataAttribute(aVisual, aAttr, + aContainer, aData); + } + } + +// --------------------------------------------------------------------------- +// Sets an dynamic attribute value in the target visual +// using transitions defined in attributes +// Handles only attributes, belonging to this attributesetter, not bases. +// --------------------------------------------------------------------------- +// +bool AlfCommonVisualAttributeSetter::doHandleDynamicAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, bool aImmediate) + { + const char* attrName = aAttr.name(); + bool handled = true; + + if ( !strcmp( attrName, KOpacity ) ) + { + TAlfTimedValue v; + setSourceValue(v, aAttr); + + float targetValue(aAttr.realValue()); + int time = getTime(aAttr, aImmediate); + v.SetTarget(targetValue, time); + v.SetStyle(aAttr.getInterpolationStyle()); + aVisual.SetOpacity(v); + } + + else if (!strcmp( attrName, KPositionX)||!strcmp( attrName, KPositionY)) ////also handles: KPositionY + { + setPos(aVisual,aContainer,NULL,aImmediate); + } + + else if (!strcmp( attrName, KWidth)||!strcmp( attrName, KHeight)) //also handles: KHeight + { + setSize(aVisual,aContainer,NULL,aImmediate); + } + else if (!strcmp(attrName, KTopLeftX)||!strcmp(attrName, KTopLeftY) + ||!strcmp(attrName, KBottomRightX)||!strcmp(attrName, KBottomRightY)) + { + setRect(aVisual,aContainer,NULL,aImmediate); + } + else + { + handled = false; + } + + return handled; + } + +// --------------------------------------------------------------------------- +// Sets an value for dynamic attribute value in the target visual +// using transitions and data in map. +// --------------------------------------------------------------------------- +// +bool AlfCommonVisualAttributeSetter::doHandleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate ) + { + bool handled = true; + if (aData) + { + const char* attrName = aAttr.name(); + + if ( !strcmp( attrName, KOpacity ) ) + { + const IAlfVariantType* data = getData(aAttr, aData); + if (data && data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue v; + setSourceValue(v, aAttr); + + float targetValue(data->real()); + int time = getTime(aAttr, aImmediate); + v.SetTarget(targetValue, time); + v.SetStyle(aAttr.getInterpolationStyle()); + aVisual.SetOpacity(v); + } + } + else if (!strcmp( attrName, KPositionX)) //also handles: KPositionY + { + //If positionx exists, positiony must exists also + const AlfAttribute& attrX = aAttr; + const AlfAttribute& attrY = aContainer.getAttributeByName(KPositionY); + + const IAlfVariantType* posX = getData(attrX, aData); + const IAlfVariantType* posY = getData(attrY, aData); + + if (posX && posX->type() == IAlfVariantType::EReal && + posY && posY->type() == IAlfVariantType::EReal) + { + TAlfTimedPoint pos; + SetSourceValues(pos, attrX, attrY); + + pos.iX.SetStyle(attrX.getInterpolationStyle()); + pos.iX.SetTarget(posX->real(), getTime(attrX, aImmediate)); + pos.iY.SetStyle(attrY.getInterpolationStyle()); + pos.iY.SetTarget(posY->real(), getTime(attrY, aImmediate)); + aVisual.SetPos(pos); + } + } + else if (!strcmp( attrName, KWidth)) //also handles: KHeight + { + const AlfAttribute& attrWidth = aAttr; + const AlfAttribute& attrHeight = + aContainer.getAttributeByName(KHeight); + + const IAlfVariantType* width = getData(attrWidth, aData); + const IAlfVariantType* height = getData(attrHeight, aData); + + if (width && width->type() == IAlfVariantType::EReal && + height && height->type() == IAlfVariantType::EReal) + { + TAlfTimedPoint size; + SetSourceValues(size, attrWidth, attrHeight); + + size.iX.SetStyle(attrWidth.getInterpolationStyle()); + size.iX.SetTarget(width->real(), + getTime(attrWidth, aImmediate)); + size.iY.SetStyle(attrHeight.getInterpolationStyle()); + size.iY.SetTarget(height->real(), + getTime(attrHeight, aImmediate)); + + aVisual.SetSize(size); + } + } + else if (!strcmp(attrName, KTopLeftX)) + { + //If topleftx exists, topy, bottomx and bottomy must exists also + const AlfAttribute& attrTopX = aAttr; + const AlfAttribute& attrTopY = + aContainer.getAttributeByName(KTopLeftY); + const AlfAttribute& attrBottomRightX = + aContainer.getAttributeByName(KBottomRightX); + const AlfAttribute& attrBottomRightY = + aContainer.getAttributeByName(KBottomRightY); + + const IAlfVariantType* topX = getData(attrTopX, aData); + const IAlfVariantType* topY = getData(attrTopY, aData); + const IAlfVariantType* bottomX = getData(attrBottomRightX, aData); + const IAlfVariantType* bottomY = getData(attrBottomRightY, aData); + + if (topX && topX->type() == IAlfVariantType::EReal && + topY && topY->type() == IAlfVariantType::EReal && + bottomX && bottomX->type() == IAlfVariantType::EReal && + bottomY && bottomY->type() == IAlfVariantType::EReal) + { + const TAlfRealPoint sTopLeft(aVisual.Pos().ValueNow()); + TAlfRealPoint size(aVisual.Size().ValueNow()); + TAlfRealRect sRect(sTopLeft, TAlfRealPoint( + sTopLeft.iX + size.iX, sTopLeft.iY + size.iY)); + + SetSourceRect(sRect, attrTopX, attrTopY, attrBottomRightX, + attrBottomRightY); + + aVisual.SetRect(sRect, 0); + + TAlfRealPoint topLeft(topX->real(), topY->real()); + TAlfRealPoint bottomRight(bottomX->real(), bottomY->real()); + TAlfRealRect realRect(topLeft, bottomRight); + aVisual.SetRect(realRect, getTime(aAttr, aImmediate)); + } + } + else if (strcmp(attrName, KPositionY) && //these are already + strcmp(attrName, KHeight) && //handled above + strcmp(attrName, KTopLeftY) && + strcmp(attrName, KBottomRightX) && + strcmp(attrName, KBottomRightY)) + { + handled = false; + } + } + + return handled; + } + +// --------------------------------------------------------------------------- +// Creates and returns one command +// --------------------------------------------------------------------------- +// +void AlfCommonVisualAttributeSetter::sendCommandsForAttribute( + CAlfVisual& aVisual, AlfAttributeContainer& aContainer, + AlfAttribute& aAttr, CAlfVisual* aRefVisual) + { + const char* attrName = aAttr.name(); + + if ( !strcmp( attrName, KOpacity ) ) + { + float value(aAttr.realValue()); + + if (aRefVisual) + { + // Add the opacity of the reference visual to the value + // of the opacity provided in the attribute + value += aRefVisual->Opacity().ValueNow(); + } + + int time = getTime(aAttr); + + //setting interpolation style + TAlfInterpolationStyle style = aAttr.getInterpolationStyle(); + TAlfTimedValue v; + v.SetStyle(style); + aVisual.SetOpacity(v); + + //create command + TAlfValueCommand cmd(&aVisual, EAlfValueCommandVisualSetOpacity, + EAlfOpSet, value, time); + + //send with delay. + CAlfEnv::Static()->Send(cmd, aAttr.getDelay()); + } + + else if (!strcmp( attrName, KPositionX)) ////also handles: KPositionY + { + // Must contain both KPositionX and KPositionY + const AlfAttribute& posXattrib = aAttr; + const AlfAttribute& posYattrib = + aContainer.getAttributeByName(KPositionY); + + TAlfRealPoint value(posXattrib.realValue(), + posYattrib.realValue()); + + if ( aRefVisual ) + { + value += aRefVisual->Pos().ValueNow(); // Add the reference point + } + + int time = getTime(aAttr); + + //create command + TAlfPointCommand cmd(&aVisual, EAlfPointCommandVisualSetPos, + value, time); + + //send with delay. + CAlfEnv::Static()->Send(cmd, aAttr.getDelay()); + } + + else if (!strcmp( attrName, KWidth)) //also handles: KHeight + { + // Must contain both KWidth and KHeight + const AlfAttribute& widthAttrib = aAttr; + const AlfAttribute& heightAttrib = + aContainer.getAttributeByName(KHeight); + + TAlfRealPoint value(widthAttrib.realValue(), + heightAttrib.realValue()); + + if (aRefVisual) + { + value += aRefVisual->Size().ValueNow(); // Add the reference point + } + int time = getTime(aAttr); + + //create command + TAlfPointCommand cmd(&aVisual, + EAlfPointCommandVisualSetSize, value, time); + + //send with delay. + CAlfEnv::Static()->Send(cmd, aAttr.getDelay()); + } + else if (!strcmp(attrName, KTopLeftX)) + { + //If topleftx exists, topy, bottomx and bottomy must exists also + float topX = aAttr.realValue(); + const AlfAttribute& attrTopY = + aContainer.getAttributeByName(KTopLeftY); + const AlfAttribute& attrBottomX = + aContainer.getAttributeByName(KBottomRightX); + const AlfAttribute& attrBottomY = + aContainer.getAttributeByName(KBottomRightY); + TAlfRealPoint topLeft(topX, attrTopY.realValue()); + TAlfRealPoint size(attrBottomX.realValue() - topLeft.iX, + attrBottomY.realValue() - topLeft.iY); + if (aRefVisual) + { + // Add the reference point + topLeft += aRefVisual->Pos().ValueNow(); + size += aRefVisual->Size().ValueNow(); + } + + int posTime = getTime(aAttr); + int sizeTime = getTime(attrBottomX); + + //create position command + TAlfPointCommand posCmd(&aVisual, EAlfPointCommandVisualSetPos, + topLeft, posTime); + TAlfPointCommand sizeCmd(&aVisual, EAlfPointCommandVisualSetPos, + size, sizeTime); + + //send with delay. + CAlfEnv::Static()->Send(posCmd, aAttr.getDelay()); + CAlfEnv::Static()->Send(sizeCmd, attrBottomX.getDelay()); + } + } + + +void AlfCommonVisualAttributeSetter::setPadding(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/) + { + //If padding-top exists, right, bottom and left must exists also + + AlfAttribute& attrTop = + aContainer.getAttributeByName(KPaddingTop); + AlfAttribute& attrRight = + aContainer.getAttributeByName(KPaddingRight); + AlfAttribute& attrBottom = + aContainer.getAttributeByName(KPaddingBottom); + AlfAttribute& attrLeft = + aContainer.getAttributeByName(KPaddingLeft); + + TAlfBoxMetric metric( + TAlfMetric(attrLeft.realValue(), attrLeft.unit()), + TAlfMetric(attrRight.realValue(), attrRight.unit()), + TAlfMetric(attrTop.realValue(), attrTop.unit()), + TAlfMetric(attrBottom.realValue(), attrBottom.unit())); + + aVisual.SetPadding(metric); + + attrTop.setDirty(false); + attrRight.setDirty(false); + attrBottom.setDirty(false); + attrLeft.setDirty(false); + + } + +void AlfCommonVisualAttributeSetter::setMinSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/) + { + //If minheight exists, minwidth must exists also. + AlfAttribute& attrHt = + aContainer.getAttributeByName(KMinHeight); + AlfAttribute& attrWidth = + aContainer.getAttributeByName(KMinWidth); + float height = attrHt.realValue(); + float width = attrWidth.realValue(); + TAlfRealSize size( width, height ); + + aVisual.SetMinSize(size); + + attrHt.setDirty(false); + attrWidth.setDirty(false); + } + +void AlfCommonVisualAttributeSetter::setMaxSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/) + { + AlfAttribute& attrHt = + aContainer.getAttributeByName(KMaxHeight); + AlfAttribute& attrWidth = + aContainer.getAttributeByName(KMaxWidth); + float height = attrHt.realValue(); + float width = attrWidth.realValue(); + TAlfRealSize size( width, height ); + + aVisual.SetMaxSize(size); + + + attrHt.setDirty(false); + attrWidth.setDirty(false); + + + } + +void AlfCommonVisualAttributeSetter::setSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/,bool aImmediate) + { + // Must contain both KWidth and KHeight + AlfAttribute& attrWidth = + aContainer.getAttributeByName(KWidth);; + AlfAttribute& attrHeight = + aContainer.getAttributeByName(KHeight); + + TAlfTimedPoint size(aVisual.Size()); + SetSourceValues(size, attrWidth, attrHeight); + + size.iX.SetStyle(attrWidth.getInterpolationStyle()); + size.iX.SetTarget(attrWidth.realValue(), + getTime(attrWidth, aImmediate)); + size.iY.SetStyle(attrHeight.getInterpolationStyle()); + size.iY.SetTarget(attrHeight.realValue(), + getTime(attrHeight, aImmediate)); + + + aVisual.SetSize(size); + + + attrWidth.setDirty(false); + attrHeight.setDirty(false); + } + +void AlfCommonVisualAttributeSetter::setPos(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/,bool aImmediate) + { + // Must contain both KPositionX and KPositionY + AlfAttribute& attrX = aContainer.getAttributeByName(KPositionX); + AlfAttribute& attrY = aContainer.getAttributeByName(KPositionY); + + TAlfTimedPoint pos(aVisual.Pos()); + SetSourceValues(pos, attrX, attrY); + + pos.iX.SetStyle(attrX.getInterpolationStyle()); + pos.iX.SetTarget(attrX.realValue(), getTime(attrX, aImmediate)); + pos.iY.SetStyle(attrY.getInterpolationStyle()); + pos.iY.SetTarget(attrY.realValue(), getTime(attrY, aImmediate)); + + aVisual.SetPos(pos); + + + attrX.setDirty(false); + attrY.setDirty(false); + } + +void AlfCommonVisualAttributeSetter::setRect(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* /*aData*/,bool aImmediate) + { + //If topleftx exists, topy, bottomx and bottomy must exists also + AlfAttribute& attrTopX = + aContainer.getAttributeByName(KTopLeftX); + AlfAttribute& attrTopY = + aContainer.getAttributeByName(KTopLeftY); + AlfAttribute& attrBottomRightX = + aContainer.getAttributeByName(KBottomRightX); + AlfAttribute& attrBottomRightY = + aContainer.getAttributeByName(KBottomRightY); + + const TAlfRealPoint sTopLeft(aVisual.Pos().ValueNow()); + TAlfRealPoint size(aVisual.Size().ValueNow()); + TAlfRealRect sRect(sTopLeft, TAlfRealPoint(sTopLeft.iX + size.iX, + sTopLeft.iY + size.iY)); + + SetSourceRect(sRect, attrTopX, attrTopY, attrBottomRightX, + attrBottomRightY); + + aVisual.SetRect(sRect, 0); + + TAlfRealPoint tTopLeft(attrTopX.realValue(), attrTopY.realValue()); + TAlfRealPoint tBottomRight(attrBottomRightX.realValue(), + attrBottomRightY.realValue()); + TAlfRealRect tRealRect(tTopLeft, tBottomRight); + + int time = getTime(attrTopX, aImmediate); + aVisual.SetRect(tRealRect, time); + + + attrTopX.setDirty(false); + attrTopY.setDirty(false); + attrBottomRightX.setDirty(false); + attrBottomRightY.setDirty(false); + + } +} // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfcurvepathlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfcurvepathlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,629 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for curvePathLayout. +* +*/ + + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alfcurvepathlayoutattributesetter.h" +#include +#include +#include + + +//osn includes +#include + +//alf includes +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include +#include + +//namespaces + +using namespace osncore; + +using namespace duiuimodel::commonvisualattributes; + +using namespace duiuimodel::layoutattributes; + +using namespace duiuimodel::curvepathattributes; + + +namespace Alf + { + +static void throwIfErr ( int aErr ) + { + if (aErr!=KErrNone) + { + ALF_THROW ( AlfAttributeException, aErr, + "AlfCurvePathLayoutAttributeSetter") + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCurvePathLayoutAttributeSetter:: +AlfCurvePathLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfCurvePathLayoutAttributeSetter:: +~AlfCurvePathLayoutAttributeSetter() + { + } + + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCurvePathLayoutAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + + CAlfCurvePathLayout* curvepathlayout = + dynamic_cast(&aVisual); + + if ( !curvepathlayout ) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, + "AlfCurvePathLayoutAttributeSetter" ) + } + + curvepathlayout->CurvePath().Reset(); + + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, aContainer, + aData); + + } + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfCurvePathLayoutAttributeSetter::createCommand ( + CAlfVisual& /*aVisual*/, + AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, + int /*aTransitionTime*/, + CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = NULL; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfCurvePathLayoutAttributeSetter::createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + //SetOffset in CAlfCurvePath can be sent as a TAlfCustomEventCommand + + AlfCommonLayoutAttributeSetter::createAndSendCommands ( + aVisual, aContainer, aRefVisual ); + } + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfCurvePathLayoutAttributeSetter::handleDynamicAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + CAlfCurvePathLayout* curvepathlayout = + dynamic_cast(&aVisual); + if(!curvepathlayout) + { + return; + } + + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KOffsetX ) ||!strcmp ( attrName, KOffsetY ) ) + { + // throws if attribute is not found + AlfAttribute& offsety = aContainer.getAttributeByName ( KOffsetY ); + AlfAttribute& offsetx = aContainer.getAttributeByName ( KOffsetX ); + + TAlfTimedPoint offset((TReal32)offsetx.getSourceValue()->realValue(), + (TReal32)offsety.getSourceValue()->realValue()); + + offset.iX.SetTarget((TReal32)offsetx.getTargetValue()->realValue(), + offsetx.getTime()); + + offset.iY.SetTarget((TReal32)offsety.getTargetValue()->realValue(), + offsety.getTime()); + + offset.iX.SetStyle ( offsetx.getInterpolationStyle() ); + offset.iY.SetStyle ( offsety.getInterpolationStyle() ); + + offset.iX.SetMappingFunctionIdentifier( + offsetx.getMappingFunctionId()); + offset.iY.SetMappingFunctionIdentifier( + offsety.getMappingFunctionId()); + + curvepathlayout->CurvePath().SetOffset( offset ); + offsetx.setDirty(false); + offsety.setDirty(false); + } + else + { + AlfCommonLayoutAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfCurvePathLayoutAttributeSetter::handleStaticAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + + CAlfCurvePathLayout* curvepathlayout = + dynamic_cast(&aVisual); + if(!curvepathlayout) + { + return; + } + + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KEnableLoop ) ) + { + // if value is not int, then use default parameter of EnableLoop + if ( AlfAttributeValueType::EInt != aAttr.type() ) + { + curvepathlayout->CurvePath().EnableLoop(); + } + + else + { + int enableLoop = aAttr.intValue(); + TBool flag = ETrue; //Assume true for any non-zero value. + if ( 0 == enableLoop ) + { + flag = EFalse; + } + curvepathlayout->CurvePath().EnableLoop( flag ); + } + } + + else if ( !strcmp ( attrName, KOrigin ) ) + { + curvepathlayout->CurvePath().SetOrigin( aAttr.realValue() ); + } + + else if ( !strcmp ( attrName, KOffsetX ) || !strcmp ( attrName, KOffsetY ) ) + { + // throws if attribute is not found + AlfAttribute& offsety = aContainer.getAttributeByName ( KOffsetY ); + AlfAttribute& offsetx = aContainer.getAttributeByName ( KOffsetX ); + + TAlfTimedPoint offset( offsetx.realValue(), offsety.realValue()); + curvepathlayout->CurvePath().SetOffset ( offset ); + offsety.setDirty(false); + offsetx.setDirty(false); + } + else if ( !strcmp ( attrName, KLine ) ) + { + // This multi-value attribute has to be filled in this order: + // startx,starty,endx,endy,linelength + + if ( 5 != aAttr.getTargetValueCount()) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfCurvePathLayoutAttributeSetter" ); + } + + float startx = this->floatOrInt( aAttr, 0 ); + float starty = this->floatOrInt( aAttr, 1 ); + float endx = this->floatOrInt( aAttr, 2 ); + float endy = this->floatOrInt( aAttr, 3 ); + float len = aAttr.realValue(4); + + TRAPD(err1,curvepathlayout->CurvePath().AppendLineL( + TAlfRealPoint(startx,starty), + TAlfRealPoint(endx,endy),len ) + ); + throwIfErr(err1); + } + + else if ( !strcmp ( attrName, KArc ) ) + { + // This multi-value attribute has to be filled in this order: + // arcoriginx,arcoriginy,archorzradius,arcvertradius,arcstartangle, + // arcendangle,arclength + + if ( 7 != aAttr.getTargetValueCount()) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfCurvePathLayoutAttributeSetter" ); + } + + float originx = this->floatOrInt( aAttr, 0 ); + float originy = this->floatOrInt( aAttr, 1 ); + float horzradius = this->floatOrInt( aAttr, 2 ); + float vertradius = this->floatOrInt( aAttr, 3 ); + float startangle = aAttr.realValue(4); + float endangle = aAttr.realValue(5); + float len = aAttr.realValue(6); + TRAPD(err1,curvepathlayout->CurvePath().AppendArcL( + TAlfRealPoint(originx,originy), + TAlfRealSize(horzradius,vertradius), + startangle,endangle,len)); + throwIfErr(err1); + } + + else + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute ( + aVisual, aAttr, aContainer); + } + } +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfCurvePathLayoutAttributeSetter::handleDynamicDataAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + CAlfCurvePathLayout* curvepathlayout = + dynamic_cast ( &aVisual ); + if ( !curvepathlayout ) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfCurvePathLayoutAttributeSetter" ) + } + + const char* attrName = aAttr.name(); + const char* dataField = aAttr.getDataField(); + + if ( !dataField ) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfCurvePathLayoutAttributeSetter" ) + } + + if (!aData) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfCurvePathLayoutAttributeSetter" ) + } + + IAlfVariantType* data = aData->item ( UString(dataField) ); + + if (data) + { + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KOffsetX ) ) + { + // throws if attribute not found + AlfAttribute& offsety = aContainer.getAttributeByName( KOffsetY ); + + const char* offsetyDataField = offsety.getDataField(); + if ( !offsetyDataField ) + { + ALF_THROW ( AlfDataException, + ECommonError, "AlfCurvePathLayoutAttributeSetter") + } + + IAlfVariantType* offsetyData = aData->item ( UString(offsetyDataField) ); + + if ( data->type() == IAlfVariantType::EReal && + offsetyData && offsetyData->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? Is it not + // part of data as well? + TAlfTimedPoint offset; + offset.iX.SetTarget(data->real(), aAttr.getTime()); + offset.iX.SetStyle ( aAttr.getInterpolationStyle() ); + offset.iX.SetMappingFunctionIdentifier (aAttr.getMappingFunctionId()); + + offset.iY.SetTarget(offsetyData->real(), offsety.getTime()); + offset.iY.SetStyle ( offsety.getInterpolationStyle() ); + offset.iY.SetMappingFunctionIdentifier ( + offsety.getMappingFunctionId()); + + curvepathlayout->CurvePath().SetOffset( offset ); + } + } + + else if ( !strcmp ( attrName, KOffsetY ) ) + { + //Make sure X Attribute also exists, but do nothing. + //Actual values will be set in the iteration that checks + //for KOffsetX + aContainer.getAttributeByName ( KOffsetX ); + //will throw if attribute is not found + } + + else + { + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfCurvePathLayoutAttributeSetter::handleStaticDataAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + CAlfCurvePathLayout* curvepathlayout = + dynamic_cast ( &aVisual ); + if(!curvepathlayout) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfCurvePathLayoutAttributeSetter" ) + } + const char* attrName = aAttr.name(); + + const char* dataField = aAttr.getDataField(); + + if ( !dataField ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfCurvePathLayoutAttributeSetter" ) + } + + if (!aData) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfCurvePathLayoutAttributeSetter" ) + } + + IAlfVariantType* data = aData->item ( UString(dataField) ); + + if ( data ) + { + + if ( !strcmp ( attrName, KEnableLoop ) ) + { + // if value is not bool, then use default parameter of EnableLoop + if ( data->type() != IAlfVariantType::EBool ) + { + curvepathlayout->CurvePath().EnableLoop(); + } + else + { + curvepathlayout->CurvePath().EnableLoop( data->boolean() ); + } + } + + else if ( !strcmp ( attrName, KOrigin ) ) + { + if ( data->type() == IAlfVariantType::EReal ) + { + float origin = data->real() ; + curvepathlayout->CurvePath().SetOrigin ( origin ); + } + } + + else if ( !strcmp ( attrName, KOffsetX ) ) + { + AlfAttribute& offsety + = aContainer.getAttributeByName ( KOffsetY ); + //will throw if attribute is not found + + const char* offsetyDataField = offsety.getDataField(); + if ( !offsetyDataField ) + { + ALF_THROW ( AlfDataException, + ECommonError, "AlfCurvePathLayoutAttributeSetter") + } + + IAlfVariantType* offsetyData = aData->item ( UString(offsetyDataField) ); + + if ( data->type() == IAlfVariantType::EReal && + offsetyData && offsetyData->type() == IAlfVariantType::EReal) + { + TAlfTimedPoint offset( data->real(), offsetyData->real()); + curvepathlayout->CurvePath().SetOffset( offset ); + } + } + + else if ( !strcmp ( attrName, KOffsetY ) ) + { + //Make sure X Attribute also exists, but do nothing. + //Actual values will be set in the iteration that checks for + //KOffsetX + aContainer.getAttributeByName( KOffsetX ); + //will throw if attribute is not found + } + + else if ( !strcmp ( attrName, KLine ) ) + { + + //if not a container, dont proceed + if (!(data->type() == IAlfVariantType::EContainer)) + { + return; + } + + IAlfContainer* container = data->container(); + //if all item are not present, throw + if (container->count() != 5) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfCurvePathLayoutAttributeSetter" ); + } + + IAlfVariantType* lineStartXvalue = container->item(0); + IAlfVariantType* lineStartYvalue = container->item(1); + IAlfVariantType* lineEndXvalue = container->item(2); + IAlfVariantType* lineEndYvalue = container->item(3); + IAlfVariantType* lineLengthvalue = container->item(4); + + float startx = this->floatOrIntFromData( lineStartXvalue); + float starty = this->floatOrIntFromData( lineStartYvalue); + float endx = this->floatOrIntFromData( lineEndXvalue ); + float endy = this->floatOrIntFromData( lineEndYvalue ); + float len = float(lineLengthvalue->real()); + TRAPD(err1, + curvepathlayout->CurvePath().AppendLineL( + TAlfRealPoint(startx,starty), + TAlfRealPoint(endx,endy),len) + ); + throwIfErr(err1); + } + + else if ( !strcmp ( attrName, KArc ) ) + { + + //if not a container, dont proceed + if (!(data->type() == IAlfVariantType::EContainer)) + { + return; + } + + IAlfContainer* container = data->container(); + + //if all item are not present, throw + if (container->count() != 7) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfCurvePathLayoutAttributeSetter" ); + } + + IAlfVariantType* arcOriginXValue = container->item(0); + IAlfVariantType* arcOriginYValue = container->item(1); + IAlfVariantType* archorzradiusValue = container->item(2); + IAlfVariantType* arcvertradiusValue = container->item(3); + IAlfVariantType* arcstartangleValue = container->item(4); + IAlfVariantType* arcendangleValue = container->item(5); + IAlfVariantType* arclengthValue = container->item(6); + + float originx = this->floatOrIntFromData( arcOriginXValue); + float originy = this->floatOrIntFromData( arcOriginYValue); + float horzradius = this->floatOrIntFromData( archorzradiusValue); + float vertradius = this->floatOrIntFromData( arcvertradiusValue); + float startangle = float(arcstartangleValue->real()); + float endangle = float(arcendangleValue->real()); + float len = float(arclengthValue->real()); + TRAPD(err1, + curvepathlayout->CurvePath().AppendArcL( + TAlfRealPoint(originx,originy), + TAlfRealSize(horzradius,vertradius), + startangle,endangle,len)); + throwIfErr(err1); + } + else + { + AlfCommonLayoutAttributeSetter::handleStaticDataAttribute ( + aVisual, aAttr, aContainer, aData ); + } + } + } + +// --------------------------------------------------------------------------- +// Check if data in the attribute is int or float. +// Return the value as a float value +// --------------------------------------------------------------------------- +// +float AlfCurvePathLayoutAttributeSetter::floatOrInt( + const AlfAttribute& aAttr, + int aIndex) + { + if (aAttr.type(aIndex) == AlfAttributeValueType::EInt) + { + return float(aAttr.intValue(aIndex)); + } + else if (aAttr.type(aIndex) == AlfAttributeValueType::EFloat) + { + return aAttr.realValue(aIndex); //will throw an exception i + } + else + { + ALF_THROW ( AlfAttributeException, + ECommonError, "AlfCurvePathLayoutAttributeSetter" ); + } + } + + +// --------------------------------------------------------------------------- +// Check if data in the variant type is int or float. +// Return the value as a float value +// --------------------------------------------------------------------------- +// +float AlfCurvePathLayoutAttributeSetter::floatOrIntFromData( + IAlfVariantType* aData) + { + if (IAlfVariantType::EInt == aData->type()) + { + return float(aData->integer()); + } + else if (IAlfVariantType::EReal == aData->type()) + { + return aData->real();; //will throw an exception i + } + else + { + ALF_THROW ( AlfAttributeException, + ECommonError, "AlfCurvePathLayoutAttributeSetter" ); + } + } + + } // namespace Alf +// End of file + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfdecklayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfdecklayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for DeckLayout. +* +*/ + + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alfdecklayoutattributesetter.h" +#include +#include +#include + +//osn includes +#include + +//alf includes +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include + +//namespaces +using namespace osncore; +using namespace duiuimodel::layoutattributes; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfDeckLayoutAttributeSetter::AlfDeckLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfDeckLayoutAttributeSetter::~AlfDeckLayoutAttributeSetter() + { + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfDeckLayoutAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData) + { + CAlfDeckLayout* deckLayout = dynamic_cast(&aVisual); + if (!deckLayout) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfDeckLayoutAttributeSetter") + } + + // Deck layout does not have any attribute of its own + // So, call the base class implementation. + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, aContainer, aData); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfDeckLayoutAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfDeckLayoutAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + // Deck layout has no api specific to it which takes a timedvalue + // So, call the base class implementation. + // It goes through its loop and checks if there are attributes that it handles. + AlfCommonLayoutAttributeSetter::createAndSendCommands(aVisual,aContainer,aRefVisual); + } + +// --------------------------------------------------------------------------- +// Sets a value of a static attribute to target visual immediately +// without a transition. +// --------------------------------------------------------------------------- +// +void AlfDeckLayoutAttributeSetter::handleStaticAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute(aVisual, + aAttr, aContainer); + } + +// --------------------------------------------------------------------------- +// Sets a dynamic attribute value in the target visual +// using transitions defined in attributes +// --------------------------------------------------------------------------- +// +void AlfDeckLayoutAttributeSetter::handleDynamicAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + AlfCommonLayoutAttributeSetter::handleDynamicAttribute(aVisual, + aAttr, aContainer); + } + +// --------------------------------------------------------------------------- +// Sets a value for static data attribute in the target visual +// immediately without a transition using data in map. +// --------------------------------------------------------------------------- +// +void AlfDeckLayoutAttributeSetter::handleStaticDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + AlfCommonLayoutAttributeSetter::handleStaticDataAttribute( + aVisual, aAttr, aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Sets a value for dynamic data attribute value in the target visual +// using transitions and data in map. +// --------------------------------------------------------------------------- +// +void AlfDeckLayoutAttributeSetter::handleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute(aVisual, + aAttr, aContainer, aData); + } + + }// Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfelement.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,636 @@ +/* +* Copyright (c) 2007 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: The basic implementation for presentation elements. +* +*/ + + +#include "alf/alfelement.h" +#include +#include +#include "alf/ialfvisualtemplate.h" +#include "alf/alfreferencetovisual.h" +//#include "alf/alfperf.h" +#include + +#include "alfelementattributeownerimpl.h" + +namespace Alf + { + +class AlfVisualData + { +public: + AlfVisualData( CAlfVisual* aVisualTree, uint aDataID ) : + mVisualTree( aVisualTree ), mDataID( aDataID ) + { + } + CAlfVisual *mVisualTree; + uint mDataID; + ~AlfVisualData() + { + + } + + }; + +class AlfElementImpl + { +public: + AlfElementImpl() + { + mControl = 0; + mVisualTemplate = 0; + mParentElement = 0; + mParentLayout = 0; + } + ~AlfElementImpl() + { + if (mVisualTemplate) + { + delete mVisualTemplate; + mVisualTemplate = 0; + } + if (mParentLayout) + { + delete mParentLayout; + mParentLayout = 0; + } + + mVisualTreeArray.clear(); + } + /** + * The control. Not own. + */ + CAlfWidgetControl* mControl; + + /** + * The element name. + */ + UString mName; + + /** + * The visual template for creating visual trees. Own. + */ + IAlfVisualTemplate* mVisualTemplate; + + /* + * Parent element. NULL for root elements. Not own. + */ + IAlfElement *mParentElement; + + /* + * Array of created visual trees with the associated data IDs. + */ + AlfPtrVectormVisualTreeArray; //RArray mVisualTreeArray; + + /* + * Reference to the default parent layout. Own. + */ + AlfReferenceToVisual *mParentLayout; + + /* + * IAlfAttributeOwner implementation. Own. + */ + auto_ptr mAttributeOwnerImpl; + }; + +// ======== MEMBER FUNCTIONS ======== + +OSN_EXPORT AlfElement::AlfElement() + { + } + +OSN_EXPORT void AlfElement::construct( CAlfWidgetControl& aControl, const char* aName ) + { + mData.reset(new (EMM) AlfElementImpl()); + + mData->mControl = &aControl; + mData->mName = UString(aName); + mData->mParentLayout=NULL; + mData->mParentElement=NULL; + mData->mVisualTemplate=NULL; + mData->mVisualTreeArray.setAutoDelete(true); + mData->mAttributeOwnerImpl.reset(new (EMM) AlfElementAttributeOwnerImpl(*this, + *mData->mControl)); + aControl.addElement(this); + } + + +OSN_EXPORT AlfElement::AlfElement(CAlfWidgetControl& aControl, const char* aName) + { + construct( aControl, aName ); + + } + +OSN_EXPORT AlfElement::~AlfElement() + { + } + +OSN_EXPORT const char* AlfElement::name() const + { + return mData->mName.getUtf8(); + } + +OSN_EXPORT void AlfElement::createChildVisualTree( + IAlfElement* aElement, IAlfVariantType& aChildData, + IAlfBranch& aData, int aIndex, uint aDataID ) + { + // Pass directly to the child element CreateVisualTree, no need + // to do anything else. Derived classes may need additional steps here. +// ALF_PERF_START( perfdata, "AlfElement-createVisualTree-createChildVisualTree") + aElement->createVisualTree( aChildData, aData, aIndex, aDataID, + aElement->defaultParentLayout( aDataID ), + aIndex ); +// ALF_PERF_STOP( perfdata, "AlfElement-createVisualTree-createChildVisualTree") + } + +OSN_EXPORT CAlfVisual* AlfElement::createVisualTree( + IAlfVariantType& aData, IAlfBranch& aParentData, int aIndex, + uint aParentDataID, CAlfLayout* aParentLayout, int aLayoutIndex ) + { + if ( aIndex >= 0 && aIndex <= aParentData.childrenCount() ) + { + // Update data IDs of all visual trees after the new visual tree + // Start from the aIndex, and increase all indices by one + updateDataIDs( aParentData, aIndex, 1, aParentDataID, aParentDataID ); + + // Create the new visual tree + uint dataID = control().elementDataId( *this, aIndex, aParentDataID ); + return createVisualTree( aData, dataID, aParentLayout, aLayoutIndex ); + } + ALF_THROW(AlfElementException,EInvalidElement,"AlfElement") + } + +OSN_EXPORT CAlfVisual* AlfElement::createVisualTree( + IAlfVariantType& aData, uint aDataID, CAlfLayout* aParentLayout, int aLayoutIndex ) + { + CAlfVisual *retVisual = NULL; + IAlfMap* currentData = NULL; + IAlfBranch* branch = NULL; + if ( aData.type()== IAlfVariantType::EMap ) + { + currentData = aData.map(); + } + else if (aData.type()== IAlfVariantType::EBranch) + { + branch = aData.branch(); + currentData = aData.branch()->data(); + } + + if ( currentData && mData->mVisualTemplate ) + { + //Find the visual tree with data id + int index = findFromArray( aDataID ); + if ( index < 0 ) + { + // Create a new visual tree + try + { + retVisual = mData->mVisualTemplate->createVisualTree(*mData->mControl, + currentData, aParentLayout, aLayoutIndex); + } + catch (...) + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfElement") + } + // Append the visual into the array + mData->mVisualTreeArray.resize(mData->mVisualTreeArray.count()+1); + mData->mVisualTreeArray.insert(mData->mVisualTreeArray.count(),(new (EMM) AlfVisualData(retVisual, aDataID))); + } + else + { + ALF_THROW(AlfVisualException,EInvalidElement,"AlfElement") + } + } + + if ( branch ) + { + // Pass to children + int count = branch->childrenCount(); + for ( int i = 0; i < count; ++i ) + { + IAlfElement* element = mData->mControl->findElement( + branch->childName( i ).getUtf8() ); + if ( element ) + { + createChildVisualTree( + element, *branch->childData( i ), *branch, i, aDataID ); + } + } + } + + return retVisual; + } + +OSN_EXPORT void AlfElement::removeChildVisualTree( + IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ) + { + // Pass directly to the child element RemoveVisualTree, no need + // to do anything else. Derived classes may need additional steps here. + aElement->removeVisualTree( aData, aIndex, aDataID ); + } + +OSN_EXPORT void AlfElement::removeVisualTree( IAlfBranch& aParentData, + int aIndex, uint aParentDataID ) + { + if ( aIndex < aParentData.childrenCount() ) + { + IAlfVariantType* data = aParentData.childData( aIndex ); + uint dataID = control().elementDataId( *this, aIndex, aParentDataID ); + + removeVisualTree( *data, dataID ); + + // Update data IDs of all visual trees after the removed visual tree + // Start from the aIndex + 1, and decrease all indices by one + updateDataIDs( aParentData, aIndex + 1, -1, aParentDataID, aParentDataID ); + } + else + ALF_THROW(AlfVisualException,EInvalidElement,"AlfElement") + } + +OSN_EXPORT void AlfElement::removeVisualTree( IAlfVariantType& aData, uint aDataID ) + { + if ( aData.type() == IAlfVariantType::EBranch ) + { + // Pass to children + IAlfBranch* branch = aData.branch(); + int count = branch->childrenCount(); + for ( int i = 0; i < count; ++i ) + { + IAlfElement* element = mData->mControl->findElement( branch->childName( i ).getUtf8() ); + if ( element ) + { + removeChildVisualTree( element, *branch, i, aDataID ); + } + } + } + + // Remove visual tree from this element + int index = findFromArray( aDataID ); + if (index >= 0) + { + CAlfVisual* visual = mData->mVisualTreeArray[index]->mVisualTree; + visual->RemoveAndDestroyAllD(); + mData->mVisualTreeArray.remove( index ); + } + else + { + ALF_THROW(AlfVisualException,EInvalidElement,"AlfElement") + } + } + +OSN_EXPORT void AlfElement::updateVisualTree( + IAlfVariantType& aNewData, IAlfVariantType& aOldData, uint aDataID ) + { + IAlfMap* currentNewData = NULL; + IAlfMap* currentOldData = NULL; + IAlfBranch* branch = NULL; + IAlfBranch* oldBranch = NULL; + + if ( aNewData.type()== IAlfVariantType::EMap ) + { + currentNewData = aNewData.map(); + } + else if (aNewData.type()== IAlfVariantType::EBranch) + { + branch = aNewData.branch(); + currentNewData = branch->data(); + } + + if (&aOldData) + { + if (aOldData.type()== IAlfVariantType::EMap) + { + currentOldData = aOldData.map(); + } + else if (aOldData.type()== IAlfVariantType::EBranch) + { + oldBranch = aOldData.branch(); + currentOldData = aOldData.branch()->data(); + } + } + + if ( currentNewData && mData->mVisualTemplate ) + { + //Find the visual tree with data id + int index = findFromArray( aDataID ); + if (index >= 0) + { + // Update the contents of the visual tree + CAlfVisual* visual = mData->mVisualTreeArray[index]->mVisualTree; + //ALF_PERF_START( perfdata, "AlfElement-updateVisualTree-VTUpdateVisualTree") + mData->mVisualTreeArray[index]->mVisualTree = + mData->mVisualTemplate->updateVisualTree( + currentNewData, currentOldData, *visual ); + //ALF_PERF_STOP( perfdata, "AlfElement-UpdateVisualTree-VTUpdateVisualTree") + } + } + + if ( branch ) + { + // Pass to children + int count = branch->childrenCount(); + for ( int i = 0; i < count; ++i ) + { + IAlfElement* element = mData->mControl->findElement( branch->childName( i ).getUtf8() ); + if ( element ) + { + IAlfVariantType* oldData = NULL; + if (oldBranch) + { + oldData = oldBranch->childData( i ); + } + + element->updateVisualTree( *branch->childData( i ), *oldData, + mData->mControl->elementDataId( *element, i, aDataID ) ); + } + } + } + } + +OSN_EXPORT void AlfElement::addVisualTree(CAlfVisual* aVisualTree, uint aDataID) + { + int index = findFromArray( aDataID ); + if ( index >= 0 || aVisualTree == NULL ) + { + ALF_THROW(AlfVisualException,EInvalidElement,"AlfElement") + } + // Append the visual with the assiciated data id into the array + + mData->mVisualTreeArray.resize(mData->mVisualTreeArray.count()+1); + mData->mVisualTreeArray.insert(mData->mVisualTreeArray.count(),(new (EMM) AlfVisualData(aVisualTree, aDataID))); + } + +OSN_EXPORT void AlfElement::replaceVisualTree( IAlfVariantType& aData, uint aDataID, uint aOldDataID ) + { + IAlfVariantType* oldData = control().elementData(*this, aOldDataID ); + + int index = findFromArray( aOldDataID ); + if ( index < 0 ) + { + ALF_THROW(AlfVisualException,EInvalidElement,"AlfElement") + } + mData->mVisualTreeArray[index]->mDataID = aDataID; + + // Update the contents of the visual tree with the new data + updateVisualTree( aData, *oldData, aDataID ); + } + +OSN_EXPORT void AlfElement::updateDataIDs( + IAlfBranch& aParentBranch, int aStartIndex, + int aOffset, uint /*aOldParentDataId*/, uint aParentDataID ) + { + + for ( int i = 0; i < mData->mVisualTreeArray.count(); ++i ) + { + uint oldDataID = mData->mVisualTreeArray[i]->mDataID; + uint index = control().dataIdToIndex( *this, oldDataID ); + uint newDataID = control().elementDataId( + *this, index + aOffset, aParentDataID ); + if ( index >= aStartIndex && oldDataID != newDataID ) + { + // Update the data ID + mData->mVisualTreeArray[i]->mDataID = newDataID; + // The old data ID was used to calculate the child element data IDs + // We need to update the visual trees in child elements + IAlfVariantType* data = aParentBranch.childData( index ); + if ( data != NULL ) + { + if ( data->type() == IAlfVariantType::EBranch ) + { + IAlfBranch* branch = data->branch(); + for ( int j = 0; j < branch->childrenCount(); ++j ) + { + IAlfElement* childElement = + mData->mControl->findElement( branch->childName( j ).getUtf8() ); + if ( childElement ) + { + childElement->updateDataIDs( + *branch, 0, 0, oldDataID, newDataID ); + } + } + } + } + } + } + } + +OSN_EXPORT CAlfLayout* AlfElement::defaultParentLayout(uint aParentDataID) + { + if (mData->mParentLayout) + { + CAlfVisual* visual=NULL; + try + { + visual = mData->mParentLayout->resolve(*mData->mControl, aParentDataID); + } + catch (...) + { + ALF_THROW(AlfVisualException,EInvalidVisual,"AlfElement") + } + return (CAlfLayout *)visual; + } + return NULL; + } + +OSN_EXPORT void AlfElement::setDefaultParentLayout(AlfReferenceToVisual* aReference) + { + if (mData->mParentLayout) + { + delete mData->mParentLayout; + mData->mParentLayout = 0; + } + mData->mParentLayout = aReference; + } + +OSN_EXPORT void AlfElement::setVisualTemplate(IAlfVisualTemplate& aTemplate) throw() + { + // Remove the visual template from its previous owner + if(aTemplate.owner()) + { + aTemplate.owner()->removeVisualTemplate(); + } + + // Set the visual template to this element + mData->mVisualTemplate = &aTemplate; + mData->mVisualTemplate->setOwner(this); + } + +OSN_EXPORT IAlfVisualTemplate* AlfElement::getVisualTemplate() const throw() + { + return mData->mVisualTemplate; + } + +OSN_EXPORT void AlfElement::destroyVisualTemplate() throw() + { + if (mData->mVisualTemplate) + { + delete mData->mVisualTemplate; + mData->mVisualTemplate = 0; + } + } + +OSN_EXPORT IAlfVisualTemplate* AlfElement::removeVisualTemplate() throw() + { + IAlfVisualTemplate* ret = mData->mVisualTemplate; + + // Set owner to NULL in removed visual template + if(mData->mVisualTemplate) + { + mData->mVisualTemplate->setOwner(0); + } + mData->mVisualTemplate = 0; + + return ret; + } + +OSN_EXPORT CAlfVisual* AlfElement::findVisual(const char* aName, uint aDataID) + { + int index = findFromArray( aDataID ); + if ( index < 0 ) + { + return NULL; + } + return mData->mVisualTreeArray[index]->mVisualTree->FindTag(TPtrC8((unsigned char*)aName));//Alf dependency + } + +OSN_EXPORT CAlfVisual* AlfElement::findVisual(uint aDataID) + { + int index = findFromArray( aDataID ); + if ( index < 0 ) + { + return NULL; + } + return mData->mVisualTreeArray[index]->mVisualTree; + } + +OSN_EXPORT uint AlfElement::dataID( const CAlfVisual& aVisual ) const + { + for ( int i = 0; i < mData->mVisualTreeArray.count(); ++i ) + { + if ( mData->mVisualTreeArray[i]->mVisualTree == &aVisual ) + { + return mData->mVisualTreeArray[i]->mDataID; + } + } + return 0; + } + +int AlfElement::findFromArray( uint aDataID ) const + { + for ( int i = 0; i < mData->mVisualTreeArray.count(); ++i ) + { + if ( mData->mVisualTreeArray[i]->mDataID == aDataID ) + { + return i; + } + } + return -1; + } + +OSN_EXPORT const IAlfElement* AlfElement::parentElement() const + { + return mData->mParentElement; + } + +OSN_EXPORT void AlfElement::setParentElement(IAlfElement& aParent) + { + mData->mParentElement = &aParent; + } + +OSN_EXPORT CAlfWidgetControl& AlfElement::control() + { + return *mData->mControl; + } + +OSN_EXPORT void AlfElement::removeAndDestroyVisuals( int aTimeMilliseconds ) + { + //remove child elements + for (int i = 0; imVisualTreeArray.count(); i++) + { + AlfVisualData* vData = mData->mVisualTreeArray[i]; + CAlfVisual* visual = vData->mVisualTree; + if(visual) + { + CAlfLayout* layout = dynamic_cast(visual); + if (layout) + { + for (int j = 0; jmDataID); + if (parent && contains(*parent)) + { + element.removeAndDestroyVisuals(aTimeMilliseconds); + } + } + } + visual->RemoveAndDestroyAllD(); + vData->mVisualTree = NULL; + } + } + + mData->mVisualTreeArray.clear(); + } + + +//From IAlfElement +OSN_EXPORT bool AlfElement::contains(CAlfVisual& aVisual) const + { + CAlfVisual* visual = &aVisual; + //traverse back to the root parent + while (visual) + { + for (int i = 0 ; i < mData->mVisualTreeArray.count(); i++) + { + if (visual == mData->mVisualTreeArray[i]->mVisualTree)//is this visual parent of passed visual? + return true; + } + visual = visual->Layout(); + } + return false; //referred visual is not part of this element. + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfElement::makeInterface( const IfId& aType ) + { + UString param(aType.mImplementationId); + if (param == IAlfElement::type().mImplementationId) + { + return static_cast(this); + } + else if (param == IAlfAttributeOwner::type().mImplementationId) + { + return static_cast(mData->mAttributeOwnerImpl.get()); + } + return NULL; + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfelementattributeownerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfelementattributeownerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,739 @@ +/* +* Copyright (c) 2007 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: Implementation of the IAlfAttributeOwner interface +* for AlfElement. +* +*/ + + +#include +#include "alf/alfattribute.h" +#include "alf/alfattributecontainer.h" +#include "alf/ialfvisualtemplate.h" +#include +#include "alf/ialfattributesetter.h" +#include "alf/alfcommonvisualattributesetter.h" +#include "alf/alfelement.h" +#include +#include "alf/attrproperty.h" +#include + + +#include "alfelementattributeownerimpl.h" + +using namespace duiuimodel; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfElementAttributeOwnerImpl::AlfElementAttributeOwnerImpl( + AlfElement& aElement, CAlfWidgetControl& aControl) : + mElement(aElement), mControl(aControl) + { + mAttributeList.setAutoDelete(true); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfElementAttributeOwnerImpl::~AlfElementAttributeOwnerImpl() + { + mAttributeList.clear(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfElementAttributeOwnerImpl::makeInterface( + const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfAttributeOwner::type().mImplementationId) + { + return static_cast(this); + } + return 0; + } + +// --------------------------------------------------------------------------- +// Get the number of available attributes. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +int AlfElementAttributeOwnerImpl::attributeCount() const + { + return mAttributeList.count(); + } + +// --------------------------------------------------------------------------- +// Gets the attribute with the given name. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +const AlfAttribute* AlfElementAttributeOwnerImpl::getAttribute( + const UString& aAttribName) const + { + AlfAttribute* attribute = 0; + for (int i = 0; i < mAttributeList.count(); i++) + { + if (!strcmp(aAttribName.getUtf8(), mAttributeList[i]->name())) + { + attribute = mAttributeList[i]; + break; + } + } + return attribute; + } + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttribute(const AlfAttribute& aAttribute) + { + // The attribute must have at least one value set. + if (!aAttribute.getTargetValueCount()) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfElementAttributeOwnerImpl") + } + + if (!canHandleAttribute(aAttribute.name())) + { + return false; + } + + // Check whether the attribute exists already. + int i = 0; + for (i = 0; i < mAttributeList.count() ; i++) + { + if (!strcmp(aAttribute.name(), mAttributeList[i]->name())) + { + // Attribute exists already, modify the contents. + *mAttributeList[i] = aAttribute; + handleAttribute(*mAttributeList[i]); + return true; + } + } + + // Attribute with the given name does not exist, + // clone the given attribute and insert it in the list. + mAttributeList.resize(mAttributeList.count() + 1); + // Insert cannot fail because already resized. + mAttributeList.insert(mAttributeList.count(), + const_cast(aAttribute).clone()); + + handleAttribute(*mAttributeList[i]); + return true; + } + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttribute( + const UString& aAttribName, AlfAttributeValueType* aValue) + { + if (!aValue) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfElementAttributeOwnerImpl") + } + + // Create a new attribute. + auto_ptr attribute( + new (EMM) AlfAttribute(aAttribName.getUtf8(), AlfAttribute::EStatic)); + attribute->addTargetValue(aValue); + + return setAttribute(*attribute.get()); + } +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttribute( const UString& aTargetId , + AlfAttribute& aAttribute ) + { + bool ret(false); + + // The attribute must have at least one value set. + if (!aAttribute.getTargetValueCount()) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfElementAttributeOwnerImpl") + } + + //check targetId + if (!aTargetId.isEmpty() + && !aTargetId.compare(mElement.name()) ) + { + ret = setAttribute(aAttribute); + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttribute( const UString& aTargetId, + const UString& aAttribName, + AlfAttributeValueType* aValue ) + { + bool ret(false); + + if (!aValue) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfElementAttributeOwnerImpl") + } + + if (!aTargetId.isEmpty()) + { + // Create a new static attribute. + auto_ptr attribute( + new (EMM) AlfAttribute(aAttribName.getUtf8(), AlfAttribute::EStatic)); + attribute->addTargetValue(aValue); + + ret = setAttribute(*attribute.get()); + + } + + return ret; + + } + +// --------------------------------------------------------------------------- +// Gets the attribute with the given name. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +const AlfAttribute* AlfElementAttributeOwnerImpl::getAttribute( const UString& aTargetId , + const UString& aAttribName ) const + { + const AlfAttribute* attr(0); + + //check targetId + if (!aTargetId.isEmpty() + && !aTargetId.compare(mElement.name())) + { + attr = getAttribute(aAttribName); + } + + return attr; + } + +// --------------------------------------------------------------------------- +// Sets the attributes from container +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttributeContainer( AlfAttributeContainer& aAttributeContainer ) + { + + const int attributeCount = aAttributeContainer.attributeCount(); + int numAttributesHandled = 0; + + for (int i = 0; i < attributeCount ; i++) + { + AlfAttribute& attribute = aAttributeContainer.getAttribute(i); + if (!strcmp(attribute.name(), duiuimodel::tactileattributes::KEventInput)) + { + + // Look for feedback type attribute. + try + { + AlfAttribute& feedBackType = + aAttributeContainer.getAttributeByName(duiuimodel::tactileattributes::KFeedbackType); + handleTactileAttribute(attribute,feedBackType); + numAttributesHandled += 2; + } + catch(AlfDataException& exception) + { + // attribute not found,so return false + return false; + } + } + + else if(setAttribute(attribute)) + { + numAttributesHandled++; + } + } + + + return (numAttributesHandled == attributeCount); + } + +// --------------------------------------------------------------------------- +// Handles the Tactile Attribute. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleTactileAttribute( + AlfAttribute& aAttributeEvent,AlfAttribute& aAttributeFeedback) + { + IAlfVisualTemplate* visualTemplate = mElement.getVisualTemplate(); + + // Find the root layout + CAlfVisual* main = mElement.findVisual(0);//needs to be changed because in some cases id may be + // set by the user + + if(visualTemplate ) + { + AlfAttribute* attrEvent = NULL; + AlfAttribute* attrFeedback = NULL; + + int setterCount = visualTemplate->numAttributeSetters(); + bool found(false); + for (int j = 0; j < setterCount ; j++) + { + AlfAttributeContainer& container = visualTemplate->attributeContainer(j); + try + { + //find the attribute in each container until it is found + attrEvent = &(container.getAttributeByName(duiuimodel::tactileattributes::KEventInput)); + attrFeedback = &(container.getAttributeByName(duiuimodel::tactileattributes::KFeedbackType)); + } + catch(AlfDataException& exception) + { + // attribute not found,so continue + continue; + } + //attribute found in one of the existing containers of the visual template, update it + *attrEvent = aAttributeEvent; + *attrFeedback = aAttributeFeedback; + found = true; + IAlfAttributeSetter& setter = visualTemplate->attributeSetter(j); + if(main) + setter.setAttributeValue(*main,&container,0); + break; + } + // attribute not found in any of the containers, so create one attribute container and one + // attribute setter and add both to the visual template + if (!found) + { + auto_ptr container( + new (EMM) AlfAttributeContainer()); + + auto_ptr setter( + new (EMM) AlfCommonVisualAttributeSetter()); + + AlfAttribute* attribe =aAttributeEvent.clone(); + AlfAttribute* attribf =aAttributeFeedback.clone(); + + container.get()->addAttribute(attribe); + container.get()->addAttribute(attribf); + if(main) + setter.get()->setAttributeValue(*main, container.get(), 0); + + visualTemplate->addAttributeSetter(setter.release(), + container.release()); + } + } + } + +// --------------------------------------------------------------------------- +// Sets the attributes from container using targetId +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::setAttributeContainer( const UString& aTargetId , + AlfAttributeContainer& aAttributeContainer ) + { + + + const int attributeCount = aAttributeContainer.attributeCount(); + int numAttributesHandled = 0; + + for (int i = 0; i < attributeCount ; i++) + { + AlfAttribute& attribute = aAttributeContainer.getAttribute(i); + if (!strcmp(attribute.name(), duiuimodel::tactileattributes::KEventInput)) + { + // Look for feedback type attribute. + + // Look for feedback type attribute. + try + { + AlfAttribute& feedBackType = + aAttributeContainer.getAttributeByName(duiuimodel::tactileattributes::KFeedbackType); + handleTactileAttribute(attribute,feedBackType); + numAttributesHandled += 2; + } + catch(AlfDataException& exception) + { + // attribute not found,so return false + return false; + } + } + else if(setAttribute(aTargetId,attribute)) + { + numAttributesHandled++; + } + } + + return (numAttributesHandled == attributeCount); + + } + +// --------------------------------------------------------------------------- +// Handles the attribute, sets proper values. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleAttribute(AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + + if (!strcmp(attrName, commonvisualattributes::KOpacity)) + { + handleOpacityAttribute(aAttribute); + } + else if(!strcmp(attrName, layoutattributes::KPositionX) || + !strcmp(attrName, layoutattributes::KPositionY)) + { + handlePositionAttribute(aAttribute); + } + else if(!strcmp(attrName, layoutattributes::KWidth) || + !strcmp(attrName, layoutattributes::KHeight)) + { + handleSizeAttribute(aAttribute); + } + else if(!strcmp(attrName, layoutattributes::KMaxWidth) || + !strcmp(attrName, layoutattributes::KMaxHeight)) + { + handleMaxSizeAttribute(aAttribute); + } + else if(!strcmp(attrName, layoutattributes::KMinWidth) || + !strcmp(attrName, layoutattributes::KMinHeight)) + { + handleMinSizeAttribute(aAttribute); + } + } + +// --------------------------------------------------------------------------- +// Can attribute be handled with this widget. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::canHandleAttribute( + const char* aAttributeName) + { + bool canHandle(false); + if (!strcmp(aAttributeName, commonvisualattributes::KOpacity) || + !strcmp(aAttributeName, layoutattributes::KPositionX) || + !strcmp(aAttributeName, layoutattributes::KPositionY) || + !strcmp(aAttributeName, layoutattributes::KWidth) || + !strcmp(aAttributeName, layoutattributes::KHeight) || + !strcmp(aAttributeName, layoutattributes::KMaxWidth) || + !strcmp(aAttributeName, layoutattributes::KMaxHeight) || + !strcmp(aAttributeName, layoutattributes::KMinWidth) || + !strcmp(aAttributeName, layoutattributes::KMinHeight)) + { + canHandle = true; + } + return canHandle; + } + +// --------------------------------------------------------------------------- +// Handles the Opacity Attribute. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleOpacityAttribute( + AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + + IAlfVisualTemplate* visualTemplate = mElement.getVisualTemplate(); + + // Find the root layout + CAlfVisual* main = mElement.findVisual(0); + + if(visualTemplate && main) + { + int setterCount = visualTemplate->numAttributeSetters(); + bool found(false); + for (int j = 0; j < setterCount && main; j++) + { + AlfAttributeContainer& container = visualTemplate->attributeContainer(j); + AlfAttribute* attr = NULL; + try + { + //find the attribute in each container until it is found + attr = &(container.getAttributeByName(attrName)); + } + catch(AlfDataException& exception) + { + // attribute not found,so continue + continue; + } + //attribute found in one of the existing containers of the visual template, update it + *attr = aAttribute; + found = true; + IAlfAttributeSetter& setter = visualTemplate->attributeSetter(j); + setter.setAttributeValue(*main,&container,0); + break; + } + // attribute not found in any of the containers, so create one attribute container and one + // attribute setter and add both to the visual template + if (!found) + { + auto_ptr container( + new (EMM) AlfAttributeContainer()); + auto_ptr setter( + new (EMM) AlfCommonVisualAttributeSetter()); + AlfAttribute* attribute =aAttribute.clone(); + container.get()->addAttribute(attribute); + + setter.get()->setAttributeValue(*main, container.get(), 0); + visualTemplate->addAttributeSetter(setter.release(), + container.release()); + } + } + } + +// --------------------------------------------------------------------------- +// Handles the Position Attribute +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handlePositionAttribute(AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + const char* attrPair = layoutattributes::KPositionX; + bool isPositionXAttr = false; + if(!strcmp(attrName, layoutattributes::KPositionX)) + { + attrPair = layoutattributes::KPositionY; + isPositionXAttr = true; + } + if (handleAttributePairs(aAttribute, attrPair)) + { + CAlfVisual* main = mElement.findVisual(0); + if (main) + { + bool needsRelayouting = false; + TAlfRealPoint pos(main->Pos().Target()); + + //for optimizing relayouting, which is expensive. Check, whether we need to do it. + if (isPositionXAttr) + { + //check against visual x position + needsRelayouting = (pos.iX != aAttribute.realValue()); + } + else + { + needsRelayouting = (pos.iY != aAttribute.realValue()); + } + + if (needsRelayouting) + { + main->UpdateChildrenLayout(); + mControl.updateParentLayout(); + } + } + } + } + +// --------------------------------------------------------------------------- +// Handles the Size Attribute. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleSizeAttribute(AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + const char* attrPair = layoutattributes::KWidth; + bool isWidthAttr = false; + + if(!strcmp(attrName, layoutattributes::KWidth)) + { + attrPair = layoutattributes::KHeight; + isWidthAttr = true; + } + if (handleAttributePairs(aAttribute, attrPair)) + { + CAlfVisual* main = mElement.findVisual(0); + if (main) + { + bool needsRelayouting = false; + TAlfRealPoint size(main->Size().Target()); + + //for optimizing relayouting, which is expensive. Check, whether we need to do it. + if (isWidthAttr) + { + needsRelayouting = (size.iX != aAttribute.realValue()); + } + else + { + needsRelayouting = (size.iY != aAttribute.realValue()); + } + + if (needsRelayouting) + { + main->UpdateChildrenLayout(); + mControl.updateParentLayout(); + } + } + } + } + +// --------------------------------------------------------------------------- +// Handles the Max Size Attribute. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleMaxSizeAttribute(AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + const char* attrPair = layoutattributes::KMaxWidth; + if(!strcmp(attrName, layoutattributes::KMaxWidth)) + { + attrPair = layoutattributes::KMaxHeight; + } + handleAttributePairs(aAttribute, attrPair); + } + +// --------------------------------------------------------------------------- +// Handles the Min Size Attribute. +// --------------------------------------------------------------------------- +// +void AlfElementAttributeOwnerImpl::handleMinSizeAttribute(AlfAttribute& aAttribute) + { + const char* attrName = aAttribute.name(); + const char* attrPair = layoutattributes::KMinWidth; + if(!strcmp(attrName, layoutattributes::KMinWidth)) + { + attrPair = layoutattributes::KMinHeight; + } + handleAttributePairs(aAttribute, attrPair); + } + +// --------------------------------------------------------------------------- +// Handles setting of paired attributes: widget & height, xpos & ypos etc. +// --------------------------------------------------------------------------- +// +bool AlfElementAttributeOwnerImpl::handleAttributePairs(AlfAttribute& aAttribute, + const char* aAttributeNamePair) + { + const char* attrName = aAttribute.name(); + bool changed(false); + IAlfVisualTemplate* visualTemplate = mElement.getVisualTemplate(); + + // Find the root layout + CAlfVisual* main = mElement.findVisual(0); + if(visualTemplate && main) + { + int setterCount = visualTemplate->numAttributeSetters(); + bool found(false); + + //find the attribute in all the existing containers + for (int j = 0; j < setterCount; j++) + { + AlfAttributeContainer& container = visualTemplate->attributeContainer(j); + AlfAttribute* attri = NULL; + try + { + attri = &(container.getAttributeByName(attrName)); + } + catch(AlfDataException& exception) + { + // attribute not found in the container + // continue to find in other containers + continue; + } + // attribute found, update it + *attri = aAttribute; + found = true; + + //check, that attribute pair exists. + try + { + AlfAttribute& attr = + container.getAttributeByName(aAttributeNamePair); + } + catch(AlfDataException& exception) + { + //attribute pair not found in the same container, so break + break; + } + + // attribute pair found, so call setAttributeValue() + IAlfAttributeSetter& setter = visualTemplate->attributeSetter(j); + setter.setAttributeValue(*main, &container, 0); + changed = true; + break; + } + + // the attribute not found in any of the existing containers + if(!found) + { + bool foundAttrPair(false); + + // again try to find the attribute pair + // this is for the situation where the attribute already exists + for (int j = 0; j < setterCount; j++) + { + AlfAttributeContainer& container = visualTemplate->attributeContainer(j); + + try + { + AlfAttribute& attr = + container.getAttributeByName(aAttributeNamePair); + } + catch(AlfDataException& exception) + { + // attribute not found,so continue + continue; + } + // attribute pair found, so add the attribute to the same container + // and call setAttributeValue() + AlfAttribute* attribute = aAttribute.clone(); + container.addAttribute(attribute); + IAlfAttributeSetter& setter = visualTemplate->attributeSetter(j); + setter.setAttributeValue(*main, &container, 0); + changed = true; + foundAttrPair = true; + break; + } + + // counter-part also does not exist, so create a new container and a attribute setter, add + // the attribute to the container, and the container and attribute setter to the visual template + if(!foundAttrPair) + { + auto_ptr container( + new (EMM) AlfAttributeContainer()); + auto_ptr setter( + new (EMM) AlfCommonVisualAttributeSetter()); + AlfAttribute* attribute = aAttribute.clone(); + container.get()->addAttribute(attribute); + visualTemplate->addAttributeSetter(setter.get(), + container.get()); + container.release(); + setter.release(); + } + } + } + return changed; + } + + } // namespace Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfenumvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfenumvalue.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 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: Implemenation file for enumValue for variants. +* +*/ + + +#include +#include "alfenumvalue.h" + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfEnumValue::AlfEnumValue(int aValue, TAlfUnit aUnit) + { + mEnum = aValue; + mUnit = aUnit; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfEnumValue::~AlfEnumValue() + { + + } + +// --------------------------------------------------------------------------- +// Gets the enum value. +// --------------------------------------------------------------------------- +// +int AlfEnumValue::enumValue() const + { + return mEnum; + } + +// --------------------------------------------------------------------------- +// Gets the type of the atrribute value. +// --------------------------------------------------------------------------- +// +AlfAttributeValueType::Type AlfEnumValue::type() const + { + return EInt; + } + +// --------------------------------------------------------------------------- +// Gets the unit. +// --------------------------------------------------------------------------- +// +TAlfUnit AlfEnumValue::unit() const + { + return mUnit; + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfeventinput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfeventinput.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,304 @@ +/* +* 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: File Implements the various input events, including custom events. +* +*/ + + +#include +#include +#include +#include +#include "alf/alfreferencetovisual.h" +#include +#include "alf/alfattribute.h" +#include "alf/alfwidget.h" +#include "alf/ialfattributeowner.h" +#include +#include +#include "alfeventinput.h" + +namespace Alf + { + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +AlfEventInput::AlfEventInput(int aEvtTypeFlags,int aEventID,int aEventData, int aKeyEventModifiers) + { + mEventTypeFlags = aEvtTypeFlags; + mEventID = aEventID; + mEventData = aEventData; + mKeyEventModifiers = aKeyEventModifiers; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +bool AlfEventInput::accept( const TAlfEvent& aEvent ) const + { + bool ret = false; + + // Custom event + if ( aEvent.Type() == TAlfEvent::ETypeCustom && + ( mEventTypeFlags & custom ) && + aEvent.CustomParameter() == mEventID ) + { + // If event data is defined to be used, it must match also + if ( ( mEventTypeFlags & useEventData ) == 0 || + aEvent.CustomEventData() == mEventData ) + { + ret = true; + } + } + // Key event + else if( aEvent.Type() == TAlfEvent::ETypeKey && + ( mEventTypeFlags & custom ) == 0 && + aEvent.KeyEvent().iScanCode == mEventID ) + { + // Test that key event up/down matches + + // keyDown triggers from EEventKey event. + // keyUp triggers from EEventKeyUp event. + + if ( ( mEventTypeFlags & keyDown && + aEvent.Code() == EEventKey ) || + ( mEventTypeFlags & keyUp && + aEvent.Code() == EEventKeyUp ) ) + { + // Set trigger status true first, match checks will change it to false if no match. + ret = true; + + // If no modifiers requested, no need to check anything + if ( mKeyEventModifiers ) + { + uint receivedModifiers = aEvent.KeyEvent().iModifiers; + + while ( true ) + { + if ( mKeyEventModifiers & alt ) + { + if ( !(receivedModifiers & (eventBitLeftAlt|eventBitRightAlt|eventBitAlt)) ) + { + ret = false; + break; + } + } + if ( mKeyEventModifiers & ctrl ) + { + if ( !(receivedModifiers & (eventBitLeftCtrl|eventBitRightCtrl|eventBitCtrl)) ) + { + ret = false; + break; + } + } + if ( mKeyEventModifiers & shift ) + { + if ( !(receivedModifiers & (eventBitLeftShift|eventBitRightShift|eventBitShift)) ) + { + ret = false; + break; + } + } + if ( mKeyEventModifiers & func ) + { + if ( !(receivedModifiers & (eventBitLeftFunc|eventBitRightFunc|eventBitFunc)) ) + { + ret = false; + break; + } + } + + break; + } + + if ( mKeyEventModifiers & capsLock && !(receivedModifiers & eventBitCapsLock) ) + { + ret = false; + } + + if ( mKeyEventModifiers & numLock && !(receivedModifiers & eventBitNumLock) ) + { + ret = false; + } + + if ( mKeyEventModifiers & scrollLock && !(receivedModifiers & eventBitScrollLock) ) + { + ret = false; + } + } + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfPointerEventInput::AlfPointerEventInput() + { + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfPointerEventInput::AlfPointerEventInput( const char* aElementName, + const char* aVisualName, + WidgetPointerEvent aEvent ) + { + mVisualRef.reset(AlfReferenceToVisual::create(aElementName, aVisualName, true )); + mEvent = aEvent; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfPointerEventInput::~AlfPointerEventInput() + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +bool AlfPointerEventInput::accept( + CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const + { + // Check whether the tapped visual matches with element and visual names + // of this pointer event input. + bool ret = false; + + // map OSN pointer event to TPointerEvent::TType + TPointerEvent::TType eventType = TPointerEvent::EButton1Down; + switch (mEvent) + { + case pointerEventDown: + eventType = TPointerEvent::EButton1Down; + break; + case pointerEventUp: + eventType = TPointerEvent::EButton1Up; + break; + case pointerEventDrag: + eventType = TPointerEvent::EDrag; + break; + default: + break; + } + + ret = aEvent.IsPointerEvent() && + (eventType == aEvent.PointerEvent().iType) && + mVisualRef->resolve( aControl, aEvent.Visual()); + + return ret; + } +// --------------------------------------------------------------------------- +// Class AlfWidgetAttributeInput +// --------------------------------------------------------------------------- +// +AlfWidgetAttributeInput::AlfWidgetAttributeInput( AlfAttribute& aAttribute, + const char* aElementId ) + { + mAttr = &aAttribute; + mElementId = ""; + if (aElementId) + { + mElementId = aElementId; + } + } + +AlfWidgetAttributeInput::AlfWidgetAttributeInput() + { + } + +AlfWidgetAttributeInput::~AlfWidgetAttributeInput() + { + delete mAttr; + } + +bool AlfWidgetAttributeInput::accept(const TAlfEvent& aEvent) const + { + bool accept(false); + + if (aEvent.IsCustomEvent()) + { + unsigned int eventID = aEvent.CustomParameter(); + if (eventID == EEventWidgetAttributeChanged) + { + TAlfWidgetAttributeCommand* command = + (TAlfWidgetAttributeCommand*)aEvent.CustomEventData(); + AlfAttribute* attribute = command->mOwnedAttribute; + const char* name = attribute->name(); + const char* targetelement = command->mTarget.getUtf8(); + + accept = true; + if (!mElementId.isEmpty() && targetelement) + { + if ( strcmp(mElementId.getUtf8(), targetelement) ) + { + accept = false; + } + } + + if (accept) + { + accept= false; + if (!strcmp(mAttr->name(), name)) + { + accept = true; + } + } + } + } + + return accept; + } +// --------------------------------------------------------------------------- +// Class AlfEventPasserInput +// --------------------------------------------------------------------------- +// +// AlfEventInput could be used instead of this class, it contains all the same +// functionality! +// +AlfEventPasserInput::AlfEventPasserInput( int aEventId, int aEventData ) + { + mEventId = aEventId; + mEventData = aEventData;//not used yet... + } + +AlfEventPasserInput::AlfEventPasserInput() + { + } + +AlfEventPasserInput::~AlfEventPasserInput() + { + } + +bool AlfEventPasserInput::accept( const TAlfEvent& aEvent ) const + { + // check whether the event matches to the one we need to pass to another widget + + return aEvent.IsCustomEvent() && + aEvent.CustomParameter() == mEventId; + } + + }//Alf + +// End of File. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfeventoutput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfeventoutput.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,473 @@ +/* +* 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: File Implements the various output events, including custom events. +* +*/ + + +#include +#include +#include +#include + +#include +#include "alf/alfreferencetovisual.h" +#include +#include "alf/alfwidget.h" +#include +#include "alf/alfattribute.h" +#include "alf/alfattributevaluetype.h" +#include "alf/ialfattributeowner.h" +#include +#include +#include +#include +#include + +#include "alfeventoutput.h" + +namespace Alf + { + +// ======== LOCAL FUNCTIONS ======== + +void DeleteIAlfVariantType( TAny* aParam ) + { + IAlfVariantType* ptr = static_cast( aParam ); + delete ptr; + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Class AlfEventOutput +// --------------------------------------------------------------------------- +// +AlfEventOutput::AlfEventOutput( + int aEventType, int aEventID, const char* aTargetWidget, unsigned int aDelay ) + { + if ( aEventType != TAlfEvent::ETypeCustom && + aEventType != TAlfEvent::ETypeKey ) + { + ALF_THROW(AlfVisualException,EInvalidAttribute,"AlfEventOutput") + } + + // Key event outputs must have a target widget. + if ( aEventType == TAlfEvent::ETypeKey && + !UString(aTargetWidget).compare(UString("")) ) + { + ALF_THROW(AlfVisualException,EInvalidAttribute,"AlfEventOutput") + } + + mEventType = aEventType; + mEventID = aEventID; + mTargetWidget = UString(aTargetWidget); + + mDelay = aDelay; + } +AlfEventOutput::AlfEventOutput() + { + } + +AlfEventOutput::~AlfEventOutput() + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void AlfEventOutput::execute( const CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) + { + CAlfEnv& env = aControl.Env(); + CAlfWidgetControl* controller = NULL; + + if ( mTargetWidget.compare( UString("") ) ) + { + IAlfWidget* widget = AlfWidgetEnvExtension::widgetFactory(env).findWidget( mTargetWidget.getUtf8() ); + + if ( !widget ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfEventOutput") + } + controller = widget->control(); + } + + if ( mEventType == TAlfEvent::ETypeCustom ) + { + // control is NULL if the event is to be broadcast + + TAlfCustomEventCommand command( mEventID, controller, aEvent.CustomEventData() ); + env.Send( command, mDelay ); + } + else if ( mEventType == TAlfEvent::ETypeKey && controller ) + { + // Simulate a key event with a given event ID as scan code. + + TKeyEvent key = + { + 0, // iCode + mEventID, // iScanCode + 0, // iModifiers + 0 // iRepeats + }; + + TAlfEvent event( *controller->Display(), key, EEventKey ); + controller->processEvent( event ); + } + } + +// --------------------------------------------------------------------------- +// Class AlfEventCancelOutput +// --------------------------------------------------------------------------- +// +AlfEventCancelOutput::AlfEventCancelOutput( + const char* aTargetWidget, int aEventID, bool aCancelAll ) + { + mTargetWidget = UString(aTargetWidget); + mEventID = aEventID; + mCancelAll = aCancelAll; + } + +AlfEventCancelOutput::AlfEventCancelOutput() + { + } + +AlfEventCancelOutput::~AlfEventCancelOutput() + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void AlfEventCancelOutput::execute( const CAlfWidgetControl& aControl ) + { + // This cancels either all or specified command in the given + // target control. + + CAlfEnv& env = aControl.Env(); + + IAlfWidget* widget = AlfWidgetEnvExtension::widgetFactory(env).findWidget( mTargetWidget.getUtf8() ); + + if ( !widget ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfEventCancelOutput") + } + + CAlfControl* controller = widget->control(); + + if ( mCancelAll ) + { + env.CancelCustomCommands( controller ); + } + else + { + env.CancelCustomCommands( controller, mEventID ); + } + } + +// --------------------------------------------------------------------------- +// Class AlfAnimationCancelOutput +// --------------------------------------------------------------------------- +// +AlfAnimationCancelOutput::AlfAnimationCancelOutput( + const char* aElementName, + const char* aVisualName, + TAlfOp aOperation, + bool aCancelAll ) + { + mVisualRef.reset(AlfReferenceToVisual::create( aElementName, aVisualName, true )); + + mOperation = aOperation; + mCancelAll = aCancelAll; + } + +AlfAnimationCancelOutput::AlfAnimationCancelOutput() + { + } + +AlfAnimationCancelOutput::~AlfAnimationCancelOutput() + { + } +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void AlfAnimationCancelOutput::execute( + CAlfWidgetControl& aControl, int aDataID ) + { + CAlfEnv& env = aControl.Env(); + CAlfVisual* visual=NULL; + + visual = mVisualRef->resolve( aControl, aDataID ); + + if ( visual ) + { + if ( mCancelAll ) + { + env.CancelCommands( visual ); + } + else + { + env.CancelCommands( visual, mOperation ); + } + } + } + +// --------------------------------------------------------------------------- +// Class AlfWidgetAttributeOuptut +// --------------------------------------------------------------------------- +// +AlfWidgetAttributeOutput::AlfWidgetAttributeOutput( AlfAttribute& aAttribute, + const char* aWidgetId ) + { + mAttr = &aAttribute; + mWidgetId = ""; + if (aWidgetId) + { + mWidgetId = aWidgetId; + } + } + +AlfWidgetAttributeOutput::AlfWidgetAttributeOutput() + { + } + +AlfWidgetAttributeOutput::~AlfWidgetAttributeOutput() + { + delete mAttr; + } + +void AlfWidgetAttributeOutput::execute( CAlfWidgetControl& aControl ) + { + AlfWidget* widget = aControl.widget(); + + IAlfAttributeOwner* owner = 0; + if (mWidgetId.isEmpty()) + { + owner = IAlfInterfaceBase::makeInterface(widget); + } + else + { + IAlfWidget* widget1 = AlfWidgetEnvExtension::widgetFactory(aControl.Env()).findWidget(mWidgetId.getUtf8()); + owner = IAlfInterfaceBase::makeInterface(widget1); + } + + if ( owner ) + { + owner->setAttribute( *mAttr ); + UString target; + TAlfWidgetAttributeCommand command( mAttr, target, widget ); + CAlfEnv& env = aControl.Env(); + env.Send( command, 0); + command.mOwnedAttribute = NULL; + } + } + + +#ifdef RD_TACTILE_FEEDBACK +// --------------------------------------------------------------------------- +// Class AlfWidgetTactileOutput +// --------------------------------------------------------------------------- +// +AlfTactileOutput::AlfTactileOutput( TTouchLogicalFeedback aFeedbackType ) + { + mFeedbackType = aFeedbackType; + } + +AlfTactileOutput::AlfTactileOutput() + { + } + +AlfTactileOutput::~AlfTactileOutput() + { + } + +void AlfTactileOutput::execute() + { + MTouchFeedback* feedback = MTouchFeedback::Instance(); + if ( feedback ) + { + feedback->InstantFeedback( mFeedbackType ); + } + } + +#endif // RD_TACTILE_FEEDBACK + + +// --------------------------------------------------------------------------- +// Class AlfEventOutputSignal +// --------------------------------------------------------------------------- +// +AlfEventOutputSignal::AlfEventOutputSignal( + IAlfEventOutputSignalSubscriber& aSubscriber ) + : mSubscriber(&aSubscriber) + {} + +AlfEventOutputSignal::~AlfEventOutputSignal() + { + delete mSubscriber; + } + +void AlfEventOutputSignal::execute() + { + mSubscriber->receiveSignal(); + } + +// --------------------------------------------------------------------------- +// Class AlfStateChangeOutput +// --------------------------------------------------------------------------- +// +AlfStateChangeOutput::AlfStateChangeOutput( + const char* aTargetWidget, uint aEnableStates, uint aDisableStates ): + mTargetWidget(aTargetWidget), + mEnableStates(aEnableStates), + mDisableStates(aDisableStates) + { + + // State change events output must have a target widget. + if ( !aTargetWidget || aTargetWidget[0] == 0 ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfStateChangeOutput") + } + + // State change events must not have ambiguous overlapping bits + if ( mEnableStates & mDisableStates ) + { + ALF_THROW(AlfWidgetException,EInvalidArgument,"AlfStateChangeOutput") + } + + } + +AlfStateChangeOutput::~AlfStateChangeOutput() + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void AlfStateChangeOutput::execute( const CAlfWidgetControl& aControl) + { + CAlfEnv& env = aControl.Env(); + + if ( mTargetWidget.compare( UString("") ) ) + { + IAlfWidget* widget = AlfWidgetEnvExtension::widgetFactory(env).findWidget( mTargetWidget.getUtf8() ); + + if ( !widget ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfStateChangeOutput") + } + CAlfWidgetControl* target = widget->control(); + target->enableState( mEnableStates); + target->disableState(mDisableStates); + } + } + +// --------------------------------------------------------------------------- +// Class AlfEventPasserOutput +// --------------------------------------------------------------------------- +// +AlfEventPasserOutput::AlfEventPasserOutput( const char* aSourceWidget, const char* aTargetWidget ): + mSourceWidget(aSourceWidget), + mTargetWidget(aTargetWidget) + { + + mEventMappingData = false; + + // Event passer events output must have a target widget. + if ( !mTargetWidget ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfEventPasserOutput") + } + } + +// --------------------------------------------------------------------------- +// Class AlfEventPasserOutput +// --------------------------------------------------------------------------- +// +AlfEventPasserOutput::AlfEventPasserOutput( const char* aSourceWidget , const char* aTargetWidget, + int aNewEventId , int aNewEventCustomData ): + mSourceWidget(aSourceWidget), + mTargetWidget(aTargetWidget), + mNewEventId(aNewEventId), + mNewEventCustomData(aNewEventCustomData) + { + + mEventMappingData = true; + // Event passer events output must have a target widget. + if ( !mTargetWidget ) + { + ALF_THROW(AlfWidgetException,EInvalidWidget,"AlfEventPasserOutput") + } + } + +AlfEventPasserOutput::AlfEventPasserOutput() + { + } + +AlfEventPasserOutput::~AlfEventPasserOutput() + { + } + +void AlfEventPasserOutput::execute( const CAlfWidgetControl* aControl , const TAlfEvent& aEvent ) + { + if(mTargetWidget) + { + IAlfWidget* wdgt = AlfWidgetEnvExtension::widgetFactory(aControl->Env()).findWidget(mTargetWidget); + //const char* wname = wdgt->widgetName(); //for debugging purposes + // if widget is not found, ignore... + if( wdgt ) + { + if(!mEventMappingData) + { + //pass to widgets control. The event handler that handles the event + //is found from the target widgets controls event handler list. + wdgt->control()->processEvent(aEvent); + } + else + { + //map event to other type of event. Use user set event ids and custom data. + wdgt->control()->processEvent(TAlfEvent(mNewEventId , mNewEventCustomData)); + } + } + + } + } + +// --------------------------------------------------------------------------- +// Class AlfAppEventOutput +// --------------------------------------------------------------------------- +// +AlfAppEventOutput::AlfAppEventOutput( const UString& aCmd, IAlfAppEventListener& aAppEvent ): + mAppEvent(&aAppEvent), + mCmd(aCmd) + { + } + +AlfAppEventOutput::~AlfAppEventOutput() + { + } + +void AlfAppEventOutput::execute(const TAlfEvent& aEvent) + { + mAppEvent->handleApplicationEvent(mCmd, aEvent); + } + + + } // namespace Alf + +// End of File. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfflowlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfflowlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,267 @@ +/* +* Copyright (c) 2007 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: File implements the atrributesetters for the flowlayout. +* +*/ + + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattribute.h" +#include "alf/alfflowlayoutattributesetter.h" +#include +#include +#include + +//osn includes +#include + +//alf includes +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include + + + +//namespaces +using namespace osncore; +using namespace duiuimodel::layoutattributes; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfFlowLayoutAttributeSetter::AlfFlowLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfFlowLayoutAttributeSetter::~AlfFlowLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfFlowLayoutAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + // Ensure that the visual is a flow layout + CAlfFlowLayout* flowLayout = dynamic_cast(&aVisual); + if (!flowLayout) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfFlowLayoutAttributeSetter"); + } + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfFlowLayoutAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfFlowLayoutAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + // Flow layout does not have any specific API which takes timed value. + // So, call the base class implementation. It goes through its loop and + // checks if there are attributes that it handles. + AlfCommonLayoutAttributeSetter::createAndSendCommands(aVisual,aContainer, + aRefVisual); + } + +void AlfFlowLayoutAttributeSetter::handleDynamicDataAttribute ( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + // Flow Layout does not have any specific dynamic attribute, so call the + // base class implementation. It goes through its loop and checks if there + // are attributes that it handles. + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute(aVisual, aAttr, + aContainer, aData); + } + +void AlfFlowLayoutAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + if (!aData) ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfFlowLayoutAttributeSetter" ) + + const char* dataField = aAttr.getDataField(); + if ( !dataField ) ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfFlowLayoutAttributeSetter" ) + + IAlfVariantType* data = aData->item ( UString(dataField)); + if (data) + { + const char* attrName = aAttr.name(); + CAlfFlowLayout* flowLayout = dynamic_cast(&aVisual); + if (!flowLayout) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfFlowLayoutAttributeSetter"); + } + + if (!strcmp(attrName,flow::KFlowDirection)) + { + if (data->type() == IAlfVariantType::EInt) + { + int direction = data->integer(); + flowLayout->SetFlowDirection( + (CAlfFlowLayout::TFlowDirection)direction); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfFlowLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName,flow::KLayoutMode)) + { + if (data->type() == IAlfVariantType::EInt) + { + int layoutMode = data->integer(); + flowLayout->SetMode(layoutMode); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfFlowLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName,flow::KLayoutCentering)) + { + if (data->type() == IAlfVariantType::EBool) + { + TBool layoutCentering = data->boolean(); + flowLayout->SetCentering(layoutCentering); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfFlowLayoutAttributeSetter"); + } + } + else + { + // Call the base class implementation . + // It goes through its loop and checks if there are attributes + // that it handles. + AlfCommonLayoutAttributeSetter::handleStaticDataAttribute(aVisual, + aAttr, aContainer, aData); + } + } + return; + } + +void AlfFlowLayoutAttributeSetter::handleDynamicAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + // Flow Layout does not have any specific dynamic attribute, so call the + // base class implementation also. It goes through its loop and checks if + // there are attributes that it handles. + AlfCommonLayoutAttributeSetter::handleDynamicAttribute(aVisual, aAttr, + aContainer); + } + +void AlfFlowLayoutAttributeSetter::handleStaticAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + CAlfFlowLayout* flowLayout = dynamic_cast(&aVisual); + if (!flowLayout) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfFlowLayoutAttributeSetter"); + } + + const char* attrName = aAttr.name(); + + if (!strcmp(attrName, flow::KFlowDirection)) + { + if(aAttr.type() == AlfAttributeValueType::EInt) + { + int direction = aAttr.intValue(); + flowLayout->SetFlowDirection( + (CAlfFlowLayout::TFlowDirection)direction); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfFlowLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName, flow::KLayoutMode)) + { + if (aAttr.type() == AlfAttributeValueType::EInt) + { + int layoutMode = aAttr.intValue(); + flowLayout->SetMode(layoutMode); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfFlowLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName, flow::KLayoutCentering)) + { + if (aAttr.type() == AlfAttributeValueType::EInt) + { + int layoutCentering = aAttr.intValue(); + TBool flag=ETrue; //Assume true for any non-zero value. + if (0==layoutCentering) flag=EFalse; + flowLayout->SetCentering(flag); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfFlowLayoutAttributeSetter"); + } + } + else // Call the base class implementation also. + // It goes through the same loop again and checks if there are + // attributes that it handles. + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute(aVisual, aAttr, + aContainer); + } + return; + } + + } // Alf + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfflowlayoutmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfflowlayoutmanager.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2007 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: flowlayoutmanager implementation +* +*/ + + +#include +#include +#include +#include +#include + +#include "alfflowlayoutpolicyimpl.h" +#include "alfflowlayoutpreferencesimpl.h" + +using osncore::UString; + +using namespace Alf; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layout manager constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfFlowLayoutManager::AlfFlowLayoutManager() + : AlfLayoutManager(EAlfLayoutTypeFlow) + { + mData.reset(new (EMM) AlfFlowLayoutPolicyImpl(*this)); + mPrefImpl.reset(new (EMM) AlfFlowLayoutPreferencesImpl(*this)); + } + +// --------------------------------------------------------------------------- +// virtual destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfFlowLayoutManager::~AlfFlowLayoutManager() + { + } + +// --------------------------------------------------------------------------- +// from AlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfFlowLayoutManager::updateChildLayout( + CAlfWidgetControl* aControl) + { + CAlfLayout& layout = getLayout(); + doUpdateChildLayout(aControl); + layout.UpdateChildrenLayout(); + + //doUpdateChildLayout changes the visual size and position. + //need to notify the widget that size and position has changed. + //for aControl both the size and position might have changes. + //Only the position changes for all the controls after aControl. + + //set the size and postion for aControl + TAlfRealRect rect; + if (controlRect(*aControl, rect)) //returns the real rect (of the root visual) + { + setControlRect(*aControl, rect); + } + + //update the position for controls after aControl in layout. + const int childrenCount = count(); + bool childControlFound = false; + + for (int i = 0; i < childrenCount; i++) + { + CAlfWidgetControl* child = getControl(i); + + if (childControlFound && controlRect(*child, rect)) + { + setControlPosition(*child, rect.iTl); + } + else if (child == aControl) + { + childControlFound = true; + } + } + + // Inform parent layout manager about the changed presentation size + owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfFlowLayoutManager::makeInterface( + const IfId& aType ) + { + UString param(aType.mImplementationId); + IAlfInterfaceBase* ret = 0; + + ret = mData->makeInterface(aType); + if (!ret) + { + ret = mPrefImpl->makeInterface(aType); + } + if (!ret) + { + ret = AlfLayoutManager::makeInterface(aType); + } + + return ret; + } + + } // Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfflowlayoutpolicyimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfflowlayoutpolicyimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 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: implementation for flowlayoutpolicy +* +*/ + + +#include +#include +#include +#include +#include + +#include "alfflowlayoutpolicyimpl.h" + +using osncore::UString; + +using namespace Alf; + +namespace Alf + { + +typedef enum IAlfFlowLayoutPolicy::flowDirection flowDirection; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// flowlayoutpolicyimpl constructor +// --------------------------------------------------------------------------- +// +AlfFlowLayoutPolicyImpl::AlfFlowLayoutPolicyImpl( + AlfFlowLayoutManager& aFlowLayoutManager) : + mFlowLayoutManager(aFlowLayoutManager), mDirection(EFlowVertical) + { + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +AlfFlowLayoutPolicyImpl::~AlfFlowLayoutPolicyImpl() + { + } + +// --------------------------------------------------------------------------- +// Sets the direction of the flow. +// --------------------------------------------------------------------------- +// +void AlfFlowLayoutPolicyImpl::setFlowDirection(enum flowDirection aDirection) + { + mDirection = aDirection; + + CAlfFlowLayout::TFlowDirection flowdir(CAlfFlowLayout::EFlowHorizontal); + if (aDirection == EFlowVertical) + { + flowdir = CAlfFlowLayout::EFlowVertical; + } + + layout().SetFlowDirection(flowdir); + } + +// --------------------------------------------------------------------------- +// returns the flow direction +// --------------------------------------------------------------------------- +// +flowDirection AlfFlowLayoutPolicyImpl::flowDirection() const + { + return mDirection; + } + +// --------------------------------------------------------------------------- +// Sets the mode of the flow. The mode flags determine how the flow layout +// behaves. +// --------------------------------------------------------------------------- +// +void AlfFlowLayoutPolicyImpl::setMode(int aMode) + { + layout().SetMode(aMode); + } + +// --------------------------------------------------------------------------- +// Returns the mode flags of the flow. +// --------------------------------------------------------------------------- +// +int AlfFlowLayoutPolicyImpl::mode() const + { + return layout().Mode(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfFlowLayoutPolicyImpl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + IAlfInterfaceBase* ret = 0; + if (param == IAlfFlowLayoutPolicy::type().mImplementationId) + { + ret = static_cast(this); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// returns the flow layout used by the layoutmanager +// --------------------------------------------------------------------------- +// +CAlfFlowLayout& AlfFlowLayoutPolicyImpl::layout() const + { + return dynamic_cast(mFlowLayoutManager.getLayout()); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfflowlayoutpreferencesimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfflowlayoutpreferencesimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2007 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: layoutpreferences implementation for flowlayoutmanager. +* +*/ + + +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include +#include + +//stl +#include //for min & max +#include "alfflowlayoutpreferencesimpl.h" + +using namespace Alf; + +namespace Alf + { +// ======== MEMBER FUNCTIONS ======== + +AlfFlowLayoutPreferencesImpl::AlfFlowLayoutPreferencesImpl( + AlfFlowLayoutManager& aFlowLayoutManager) : + mFlowLayoutManager(aFlowLayoutManager), mPreferredSize(TAlfMetric(0)) + { + } +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the minimum area that this layout manager can occupy by observing +// the minimum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfFlowLayoutPreferencesImpl::getMinimumSize(TAlfXYMetric& aMinSize) const + { + return calculateChildSizes(aMinSize, + flowLayoutPolicy().flowDirection(), ESizeMin); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the maximum area that this layout manager can occupy by observing +// the maximum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfFlowLayoutPreferencesImpl::getMaximumSize(TAlfXYMetric& aMaxSize) const + { + return calculateChildSizes(aMaxSize, + flowLayoutPolicy().flowDirection(), ESizeMax); + } + +// --------------------------------------------------------------------------- +// Combines and returns the preferred sizes of all child UI elements according +// to the layouting rules. +// --------------------------------------------------------------------------- +// +bool AlfFlowLayoutPreferencesImpl::getPreferredSize(TAlfXYMetric& aPreferredSize) const + { + bool b = false; + bool manualSet = (mPreferredSize.iX.iMagnitude > 0 && + mPreferredSize.iY.iMagnitude > 0); + + if (manualSet) + { + aPreferredSize = mPreferredSize; + b = true; + } + else + { + b = calculateChildSizes(aPreferredSize, + flowLayoutPolicy().flowDirection(), ESizePreferred); + } + return b; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// At the moment doesn't do anything since preferred size is being queried +// from the child UI elements added to this layout manager. +// --------------------------------------------------------------------------- +// +void AlfFlowLayoutPreferencesImpl::setPreferredSize( + const TAlfXYMetric& aPreferredSize ) + { + mPreferredSize = aPreferredSize; + mFlowLayoutManager.owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfFlowLayoutPreferencesImpl::makeInterface( + const IfId& aType) + { + UString param(aType.mImplementationId); + IAlfInterfaceBase* ret = 0; + if (param == IAlfLayoutPreferences::type().mImplementationId) + { + ret = static_cast(this); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// calculate the min-, preferred-, or max- sizes from the children. +// --------------------------------------------------------------------------- +// +bool AlfFlowLayoutPreferencesImpl::calculateChildSizes( + TAlfXYMetric& aSize, + enum IAlfFlowLayoutPolicy::flowDirection aFlowDirection, + enum AlfFlowLayoutPreferencesImpl::sizeType aSizeType) const + { + bool ret = false; + TAlfXYMetric resultSize(TAlfMetric(0), TAlfMetric(0)); + + // Iterate through all the child controls, and get their + // preferred sizes. + int childCount = mFlowLayoutManager.count(); + for (int i = 0; i < childCount; i++) + { + CAlfWidgetControl* childWidgetControl = mFlowLayoutManager.getControl(i); + + TAlfXYMetric size; + if (getSize(childWidgetControl, size, aSizeType)) + { + TAlfRealSize pixelSize = sizeInPixels(size); + + if (aFlowDirection == IAlfFlowLayoutPolicy::EFlowVertical) + { + //total width = max preferred width of child widgets. + //total height = sum of the preferred heights of child widgets. + if(pixelSize.iWidth > resultSize.iX.iMagnitude) + { + resultSize.iX.iMagnitude = pixelSize.iWidth; + } + resultSize.iY.iMagnitude += pixelSize.iHeight; + ret = true; + } + else + { + //horizontal flow direction + //total height = max preferred height of child widgets. + //total width = sum of the preferred widths of child widgets. + if(pixelSize.iHeight > resultSize.iY.iMagnitude) + { + resultSize.iY.iMagnitude = pixelSize.iHeight; + } + resultSize.iX.iMagnitude += pixelSize.iWidth; + ret = true; + } + } + } + + aSize = resultSize; + return ret; + } + +// --------------------------------------------------------------------------- +// fetches the size from the IAlfLayoutPreferences-interface of the aControl. +// --------------------------------------------------------------------------- +// +bool AlfFlowLayoutPreferencesImpl::getSize( + CAlfWidgetControl* aControl, + TAlfXYMetric& aSize, + enum AlfFlowLayoutPreferencesImpl::sizeType aSizeType) const + { + bool ret = false; + + if (aControl) + { + const IAlfLayoutPreferences* layoutPrefs = + mFlowLayoutManager.getLayoutPreferences(aControl); + + if (layoutPrefs) + { + switch(aSizeType) + { + case AlfFlowLayoutPreferencesImpl::ESizePreferred: + ret = layoutPrefs->getPreferredSize(aSize); + break; + case AlfFlowLayoutPreferencesImpl::ESizeMin: + ret = layoutPrefs->getMinimumSize(aSize); + break; + case AlfFlowLayoutPreferencesImpl::ESizeMax: + ret = layoutPrefs->getMaximumSize(aSize); + break; + } + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// get the flowlayoutpolicy-interface. +// --------------------------------------------------------------------------- +// +const IAlfFlowLayoutPolicy& AlfFlowLayoutPreferencesImpl::flowLayoutPolicy() const + { + AlfFlowLayoutManager* man = + const_cast(&mFlowLayoutManager); + IAlfFlowLayoutPolicy* policy = + IAlfInterfaceBase::makeInterface(man); + assert(policy); + return *policy; + } +// --------------------------------------------------------------------------- +// converts size in metrics to size in pixels. +// implementation missing! +// --------------------------------------------------------------------------- +// +TAlfRealSize AlfFlowLayoutPreferencesImpl::sizeInPixels( + const TAlfXYMetric& aSize) + { + TAlfRealSize s; + + if(aSize.iX.iUnit == EAlfUnitPixel) + { + s.iWidth = aSize.iX.iMagnitude; + } + if(aSize.iY.iUnit == EAlfUnitPixel) + { + s.iHeight = aSize.iY.iMagnitude; + } + + return s; + } +} // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfgridlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfgridlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,428 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for grid layout.. +* +*/ + + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alfgridlayoutattributesetter.h" +#include +#include +#include + +//osn includes +#include + +//alf includes +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include + +using osncore::UString; + +using namespace duiuimodel::commonvisualattributes; + +using namespace duiuimodel::layoutattributes; + +//variable inside ifdef to prevent compiler warning. +#ifdef ALF_DEBUG_EXCEPTIONS +static const char* const ClassName = "AlfGridLayoutAttributeSetter"; +#endif + +namespace Alf + { + +// --------------------------------------------------------------------------- +// returns int or realvalue as float. +// --------------------------------------------------------------------------- +// +float realOrInt(const AlfAttribute& aAttr, int aIndex) + { + switch(aAttr.type(aIndex)) + { + case AlfAttributeValueType::EInt: + return aAttr.intValue(aIndex); + case AlfAttributeValueType::EFloat: + return aAttr.realValue(aIndex); + default: + ALF_THROW ( AlfDataException, ECommonError, ClassName); + } + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfGridLayoutAttributeSetter::AlfGridLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfGridLayoutAttributeSetter::~AlfGridLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfGridLayoutAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfGridLayout* gridlayout = dynamic_cast(&aVisual); + + if (!gridlayout) + { + ALF_THROW(AlfVisualException, EInvalidVisual, ClassName) + } + + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfGridLayoutAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, + AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, + int /*aTransitionTime*/, + CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfGridLayoutAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + //no animatable attributes in grid layout. + AlfCommonLayoutAttributeSetter::createAndSendCommands( + aVisual, aContainer, aRefVisual); + } + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfGridLayoutAttributeSetter::handleDynamicAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + //no dynamic attributes in grid layout. + AlfCommonLayoutAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfGridLayoutAttributeSetter::handleStaticAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + const char* attrName = aAttr.name(); + CAlfGridLayout* gridlayout = dynamic_cast(&aVisual); + if (!gridlayout) + { + return; + } + + if (!strcmp(attrName, grid::KRows)) + { + int rows = realOrInt(aAttr, 0); //this can throw + TRAPD(err1, gridlayout->SetRowsL(rows)); + if (err1 != KErrNone) + { + ALF_THROW(AlfException, err1, ClassName) + } + } + else if (!strcmp(attrName, grid::KColumns)) + { + int columns = realOrInt(aAttr, 0); //this can throw + TRAPD(err1, gridlayout->SetColumnsL(columns)); + if (err1 != KErrNone) + { + ALF_THROW(AlfException, err1, ClassName) + } + } + else if (!strcmp( attrName, grid::KColumnWeight)) + { + unsigned int valueCount = aAttr.getTargetValueCount(); + + for (int i = 0; i < valueCount; ++i) + { + TAlfUnit unitType = aAttr.unit(i); + + float val = realOrInt(aAttr, i); + TAlfMetric metric( val, unitType ); + + TRAPD(err, gridlayout->ReplaceWeightL(EAlfGridColumn, metric, i)); + + int err2 = KErrNone; + if (err == KErrArgument) + { + TRAP(err2, gridlayout->AppendWeightL(EAlfGridColumn, metric)); + if (err2 != KErrNone) + { + ALF_THROW(AlfException, err2, ClassName) + } + } + else if (err != KErrNone) + { + ALF_THROW(AlfException, ECommonError, ClassName) + } + } + } + else if ( !strcmp ( attrName, grid::KRowWeight ) ) + { + unsigned int valueCount = aAttr.getTargetValueCount(); + + for ( int i = 0; i < valueCount; ++i ) + { + + TAlfUnit unitType = aAttr.unit(i); + float val = realOrInt(aAttr, i); + TAlfMetric metric ( val, unitType ); + + TRAPD ( err, gridlayout->ReplaceWeightL ( EAlfGridRow, metric, i ) ); + + int err2 = KErrNone; + if ( err == KErrArgument ) + { + TRAP ( err2, gridlayout->AppendWeightL ( EAlfGridRow, metric ) ); + if (err2 != KErrNone) + { + ALF_THROW(AlfException, err2, ClassName) + } + } + else if (err != KErrNone) + { + ALF_THROW(AlfException, ECommonError, ClassName) + } + } + } + else if (!strcmp( attrName, KExpansionFlag )) + { + gridlayout->SetExpanding ( aAttr.intValue() ); + } + else if (!strcmp( attrName, grid::KSetLayoutModeFlag )) + { + if (aAttr.getTargetValueCount() == 2 && + aAttr.type(0) == AlfAttributeValueType::EInt && + aAttr.type(1) == AlfAttributeValueType::EInt) + { + gridlayout->SetLayoutModeFlags(TAlfGridDimension( + aAttr.intValue(0)), uint(aAttr.intValue(1))); + } + else + { + ALF_THROW(AlfAttributeException, EInvalidAttribute, ClassName) + } + } + else if (!strcmp( attrName, grid::KClearLayoutModeFlag )) + { + if ( aAttr.getTargetValueCount() == 2 && + aAttr.type(0) == AlfAttributeValueType::EInt && + aAttr.type(1) == AlfAttributeValueType::EInt) + { + gridlayout->ClearLayoutModeFlags(TAlfGridDimension( + aAttr.intValue(0)), uint(aAttr.intValue(1))); + } + else + { + ALF_THROW( AlfAttributeException, EInvalidAttribute, ClassName) + } + } + else + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfGridLayoutAttributeSetter::handleDynamicDataAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + //no dynamic attributes in grid layout. + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute(aVisual, + aAttr, aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfGridLayoutAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData) + { + CAlfGridLayout* gridlayout = dynamic_cast ( &aVisual ); + if (!gridlayout) + { + ALF_THROW(AlfDataException, ECommonError, ClassName) + } + + const char* attrName = aAttr.name(); + const char* dataField = aAttr.getDataField(); + + if (!dataField) + { + ALF_THROW(AlfDataException, ECommonError, ClassName) + } + + if (!aData) + { + ALF_THROW(AlfDataException, ECommonError, ClassName) + } + + IAlfVariantType* data = aData->item(UString(dataField)); + + if (data) + { + if (!strcmp(attrName, grid::KRows)) + { + if (data->type() == IAlfVariantType::EInt) + { + int rows = data->integer() ; + TRAPD(err1, gridlayout->SetRowsL ( rows )); + if (err1 != KErrNone) + { + ALF_THROW(AlfException, err1, ClassName) + } + } + } + else if (!strcmp( attrName, grid::KColumns)) + { + if (data->type() == IAlfVariantType::EInt) + { + int columns = data->integer(); + TRAPD(err1, gridlayout->SetColumnsL (columns)); + if (err1 != KErrNone) + { + ALF_THROW ( AlfException, ECommonError, ClassName ) + } + } + } + else if (!strcmp(attrName, KExpansionFlag)) + { + if (data->type() == IAlfVariantType::EInt) + { + gridlayout->SetExpanding(data->integer()); + } + } + else if (!strcmp(attrName, grid::KSetLayoutModeFlag)) + { + if (data->type() == IAlfVariantType::EContainer) + { + IAlfContainer* dataContainer = data->container(); + + if ( dataContainer->count() != 2) + { + ALF_THROW(AlfDataException, EInvalidContainerOperation, + ClassName) + } + + IAlfVariantType* dimensionData = dataContainer->item(0); + IAlfVariantType* flags = dataContainer->item(1); + + if (dimensionData && flags && + dimensionData->type() == IAlfVariantType::EInt && + flags->type() == IAlfVariantType::EInt) + { + gridlayout->SetLayoutModeFlags(TAlfGridDimension( + dimensionData->integer()) , uint(flags->integer())); + } + } + } + else if (!strcmp(attrName, grid::KClearLayoutModeFlag)) + { + if (data->type() == IAlfVariantType::EContainer) + { + IAlfContainer* dataContainer = data->container(); + + if (dataContainer->count() != 2) + { + ALF_THROW(AlfDataException, EInvalidContainerOperation, + ClassName) + } + + IAlfVariantType* dimensionData = dataContainer->item(0); + IAlfVariantType* flags = dataContainer->item(1); + + if (dimensionData && flags && + dimensionData->type() == IAlfVariantType::EInt && + flags->type() == IAlfVariantType::EInt) + { + gridlayout->ClearLayoutModeFlags(TAlfGridDimension( + dimensionData->integer()), uint(flags->integer())); + } + } + } + else if ( !strcmp ( attrName, grid::KColumnWeight ) ) + { + } + else if ( !strcmp ( attrName, grid::KRowWeight ) ) + { + } + else + { + AlfCommonAttributeSetter::handleStaticDataAttribute(aVisual, + aAttr, aContainer, aData); + } + } + } + + } // namespace Alf +// End of file + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfgridlayoutmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfgridlayoutmanager.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2007 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: gridlayoutmanager with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include +#include + +#include "alfgridlayoutmanagerimpl.h" +#include "alfgridlayoutpolicyimpl.h" + +using osncore::UString; + +using namespace Alf; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layout manager constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfGridLayoutManager::AlfGridLayoutManager() + : AlfLayoutManager(EAlfLayoutTypeGrid) + { + mData.reset(new (EMM) AlfGridLayoutManagerImpl(*this)); + mDataPolicy.reset(new (EMM) AlfGridLayoutPolicyImpl(*this)); + } + +// --------------------------------------------------------------------------- +// virtual destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfGridLayoutManager::~AlfGridLayoutManager() + { + } + +// --------------------------------------------------------------------------- +// from AlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfGridLayoutManager::updateChildLayout( + CAlfWidgetControl* aControl) + { + CAlfLayout& layout = getLayout(); + doUpdateChildLayout(aControl); + layout.UpdateChildrenLayout(); + + //doUpdateChildLayout changes the visual size and position. + //need to notify the widget that size and position has changed. + + //set the size and postion for aControl + TAlfRealRect rect; + if (controlRect(*aControl, rect)) //returns the real rect (of the root visual) + { + setControlRect(*aControl, rect); + } + + // Inform parent layout manager about the changed presentation size + owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// notifies the layout manager, that the control's has been +// removed from the layout. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfGridLayoutManager::childRemoved(CAlfWidgetControl* aControl) + { + //when control is removed from layout, no change to other widget rects, + // just call the base class + AlfLayoutManager::childRemoved(aControl); + } + +// --------------------------------------------------------------------------- +// from AlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfGridLayoutManager::doUpdateChildLayout( + CAlfWidgetControl* /*aControl*/) + { + //gridlayout changes the position and size, nothing to do here. + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfGridLayoutManager::makeInterface( + const IfId& aType ) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutManager::type().mImplementationId) + { + return this; + } + + // Let the implementation class try the interface creation + IAlfInterfaceBase* pInterface = mData->makeInterface(aType); + if(!pInterface) + pInterface = mDataPolicy->makeInterface(aType); + return pInterface; + } + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfgridlayoutmanagerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfgridlayoutmanagerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2007 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: layoutmanager implementation class with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include + +//stl +#include //for min & max + +#include "alfgridlayoutmanagerimpl.h" + +using namespace Alf; + +namespace Alf + { +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layoutmanagerimpl constructor +// --------------------------------------------------------------------------- +// +AlfGridLayoutManagerImpl::AlfGridLayoutManagerImpl( + AlfGridLayoutManager& aGridLayoutManager) : + mGridLayoutManager(aGridLayoutManager) + { + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +AlfGridLayoutManagerImpl::~AlfGridLayoutManagerImpl() + { + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the minimum area that this layout manager can occupy by observing +// the minimum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfGridLayoutManagerImpl::getMinimumSize( TAlfXYMetric& /*aMinSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the maximum area that this layout manager can occupy by observing +// the maximum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfGridLayoutManagerImpl::getMaximumSize( TAlfXYMetric& /*aMaxSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// Combines and returns the preferred sizes of all child UI elements according +// to the layouting rules. +// --------------------------------------------------------------------------- +// +bool AlfGridLayoutManagerImpl::getPreferredSize(TAlfXYMetric& aPreferredSize) const + { + bool hasPreferredSize = false; + TAlfXYMetric resultSize = TAlfXYMetric(TAlfMetric(0), TAlfMetric(0)); + + const CAlfGridLayout& gridlayout = layout(); + const int childCount = mGridLayoutManager.count(); + const int gridColCount = gridlayout.ColumnCount(); + + //iterate the columns to calculate the preferred width. + const int colCount = std::min(gridColCount, childCount); + for (int i = 0; i < colCount; i++) + { + CAlfWidgetControl* childWidgetControl = mGridLayoutManager.getControl(i); + //getControl may return null, but getLayoutPreferences checks that. + const IAlfLayoutPreferences* layoutPrefs = + mGridLayoutManager.getLayoutPreferences(childWidgetControl); + + if (layoutPrefs) + { + TAlfXYMetric prefSize; + if (layoutPrefs->getPreferredSize(prefSize)) + { + if(prefSize.iX.iUnit == EAlfUnitPixel) + { + resultSize.iX.iMagnitude += prefSize.iX.iMagnitude; + hasPreferredSize = true; + } + } + } + } + + //iterate the rows to calculate the preferred height + if (hasPreferredSize) + { + //count rows, that have at least one visual. + int usedRows = childCount / gridColCount; + if (childCount % gridColCount) + { + //last wor not filled completely, but still valid to get preferred height + //for this row also. + usedRows++; + } + + const int rowCount = std::min(gridlayout.RowCount(), usedRows); + for (int i = 0; i < rowCount; i+= gridColCount) + { + CAlfWidgetControl* childWidgetControl = mGridLayoutManager.getControl(i); + //getControl may return null, but getLayoutPreferences checks that. + const IAlfLayoutPreferences* layoutPrefs = + mGridLayoutManager.getLayoutPreferences(childWidgetControl); + + if (layoutPrefs) + { + TAlfXYMetric prefSize; + if (layoutPrefs->getPreferredSize(prefSize)) + { + if(prefSize.iY.iUnit == EAlfUnitPixel) + { + resultSize.iY.iMagnitude += prefSize.iY.iMagnitude; + hasPreferredSize = true; + } + } + } + } + } + + aPreferredSize = resultSize; + return hasPreferredSize; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// At the moment doesn't do anything since preferred size is being queried +// from the child UI elements added to this layout manager. +// --------------------------------------------------------------------------- +// +void AlfGridLayoutManagerImpl::setPreferredSize( const TAlfXYMetric& aPreferredSize) + { + TAlfTimedPoint size((float)aPreferredSize.iX.iMagnitude,(float)aPreferredSize.iY.iMagnitude); + layout().SetSize(size); + mGridLayoutManager.owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfGridLayoutManagerImpl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutPreferences::type().mImplementationId) + { + return this; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// returns the gridlayout used by the layoutmanager +// --------------------------------------------------------------------------- +// +CAlfGridLayout& AlfGridLayoutManagerImpl::layout() const + { + return dynamic_cast(mGridLayoutManager.getLayout()); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfgridlayoutpolicyimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfgridlayoutpolicyimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2008 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: layoutmanager implementation class with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include + +//stl +#include //for min & max + +#include "alfgridlayoutpolicyimpl.h" + +using namespace Alf; + +namespace Alf + { +//ifdef to prevent compiler warning: className not used. +#ifdef ALF_DEBUG_EXCEPTIONS +static const char* const className = "AlfGridLayoutPolicyImpl"; +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layoutmanagerimpl constructor +// --------------------------------------------------------------------------- +// +AlfGridLayoutPolicyImpl::AlfGridLayoutPolicyImpl( + AlfGridLayoutManager& aGridLayoutManager) : + mGridLayoutManager(aGridLayoutManager) + { + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +AlfGridLayoutPolicyImpl::~AlfGridLayoutPolicyImpl() + { + } + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Sets the number and weights of blocks in this grid layout in the direction of the specified +// dimension. +// --------------------------------------------------------------------------- +void AlfGridLayoutPolicyImpl::fillWeights(gridLayoutDimension aDim, int aCount, const TAlfMetric& aWeight) + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TRAPD(err, gridLayout.FillWeightsL(dim, aCount, aWeight)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + } + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Add a new line of blocks to this grid layout at the last position in the direction of the +// specified dimension. +// --------------------------------------------------------------------------- +void AlfGridLayoutPolicyImpl::appendWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight) + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TRAPD(err, gridLayout.AppendWeightL(dim, aWeight)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + } + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Add a new line of blocks to this grid layout at the specified position in the direciton of +// the specified dimension. +// --------------------------------------------------------------------------- +void AlfGridLayoutPolicyImpl::insertWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos) + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TRAPD(err, gridLayout.InsertWeightL(dim, aWeight, aPos)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + } + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Sets the weight of a specific line of blocks in this grid layout, in the direction of the supplied dimension. +// --------------------------------------------------------------------------- +void AlfGridLayoutPolicyImpl::replaceWeight(gridLayoutDimension aDim, const TAlfMetric& aWeight, int aPos) + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TRAPD(err, gridLayout.ReplaceWeightL(dim, aWeight, aPos)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + } + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Remove a line of blocks from this grid layout at the specified position in the +// specified dimension. +// --------------------------------------------------------------------------- +void AlfGridLayoutPolicyImpl::removeWeight(gridLayoutDimension aDim, int aPos) + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TRAPD(err, gridLayout.RemoveWeightL(dim, aPos)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + } + + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Returns the weight of a specific line of blocks in this grid layout, in the +// specified dimension. +// --------------------------------------------------------------------------- +TAlfMetric AlfGridLayoutPolicyImpl::weight(gridLayoutDimension aDim, int aPos) const + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + TAlfMetric result; + TRAPD(err, result = gridLayout.Weight(dim, aPos)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + return result; + } + + +// --------------------------------------------------------------------------- +// from IAlfGridLayoutPolicy +// Return the number of lines of blocks in this grid, along the specified dimension +// --------------------------------------------------------------------------- +int AlfGridLayoutPolicyImpl::count(gridLayoutDimension aDim) const + { + CAlfGridLayout& gridLayout = layout(); + TAlfGridDimension dim = (TAlfGridDimension)aDim; + int result(0); + TRAPD(err, result = gridLayout.DimensionCount(dim)); + if(err != KErrNone) + { + ALF_THROW(AlfVisualException, err, className); + } + return result; + } + + + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfGridLayoutPolicyImpl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfGridLayoutPolicy::type().mImplementationId) + { + return this; + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// returns the gridlayout used by the layoutmanager +// --------------------------------------------------------------------------- +// +CAlfGridLayout& AlfGridLayoutPolicyImpl::layout() const + { + return dynamic_cast(mGridLayoutManager.getLayout()); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfhostapiimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfhostapiimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2007 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: The private implementation of AlfHostAPI. +* +*/ + + +#include "alfhostapiimpl.h" +#include +#include +#include + +namespace Alf + { + +AlfHostAPIImpl::AlfHostAPIImpl(): mBaseLayout(NULL), mHostControl(NULL) + { + } + + +AlfHostAPIImpl::~AlfHostAPIImpl() + { + } + +OSN_EXPORT IAlfInterfaceBase* AlfHostAPIImpl::makeInterface( + const IfId& aType ) + { + UString param(aType.mImplementationId); + if ( param == IAlfHostAPI::type().mImplementationId ) + { + return static_cast( this ); + } + return 0; + } + +void AlfHostAPIImpl::setHostControl(CAlfWidgetControl& aControl) + { + mHostControl = &aControl; + } + +void AlfHostAPIImpl::setConnection(CAlfWidgetControl& aControl, AlfRole aRole) + { + if (mHostControl) + { + // Remove previous host connection from connected control + if(aControl.Host()) + { + CAlfWidgetControl* parentControl = dynamic_cast(aControl.Host()); + if(parentControl) + { + parentControl->hostAPI().removeConnection(aControl); + } + } + + // Add connection from host control to connected control + TRAPD(err, mHostControl->AddConnectionL(&aControl,aRole)); + if(err != KErrNone) + { + ALF_THROW(AlfException, err, "AlfHostAPIImpl::setConnection() - AddConnectionL() failed."); + } + + // Update layout of host control if a child control was connected + if (aRole == EChild && mBaseLayout.get()) + { + mBaseLayout->updateChildLayout(&aControl); + } + } + } + +CAlfWidgetControl* AlfHostAPIImpl::getConnection(int aIndex) const + { + if (mHostControl) + { + //AlfControl doesn't perform bound checks. + if (aIndex >=0 && aIndex < mHostControl->ConnectionCount()) + { + return (static_cast(&(mHostControl->Connection(aIndex)))); + } + } + return 0; //NULL is not defined in osncore + } + +int AlfHostAPIImpl::getConnectionCount() const + { + int connectionCount = 0; + if (mHostControl) + { + connectionCount = mHostControl->ConnectionCount(); + } + return connectionCount; + } + +int AlfHostAPIImpl::getConnectionIndex(CAlfWidgetControl& aControl) const + { + return mHostControl->FindConnection(&aControl); + } + +void AlfHostAPIImpl::removeConnection(CAlfWidgetControl& aControl) + { + if (mHostControl) + { + mHostControl->RemoveConnection(&aControl); + if (getBaseLayout()) + { + getBaseLayout()->childRemoved(&aControl); + } + } + } + +void AlfHostAPIImpl::setBaseLayout(IAlfLayoutManager& aLayout) + { + if(mHostControl) + { + mBaseLayout.reset(&aLayout); + mBaseLayout->createLayout(*mHostControl, 0, 0); + } + } + +IAlfLayoutManager* AlfHostAPIImpl::getBaseLayout() const + { + return mBaseLayout.get(); + } + + } //namespace alf + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfimagevisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfimagevisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,821 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for image. +* +*/ + + +#include "alf/alfattribute.h" +#include "alf/alfimagevisualattributesetter.h" +#include "alf/alfattributevaluetype.h" +#include +#include +#include +#include "alf/alfattributecontainer.h" +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using namespace osncore; + +using namespace duiuimodel::imagevisualattributes; +using namespace duiuimodel::commonvisualattributes; +using namespace duiuimodel::layoutattributes; + +namespace Alf +{ + +class AlfImageVisualAttributeSetterImpl + { +public: + AlfImageVisualAttributeSetterImpl(); + ~AlfImageVisualAttributeSetterImpl(); +public: + //Keep track of loaded texture for imagevisuals. + //Texture manager doesn't unload the texture from memory untill Env is deleted. + //Hence need to unload them once attribute setter is deleted. + AlfPtrVector mLoadedTextures; + //Env needed to access TextureManager while unloading textures. + CAlfEnv* mEnv; + + // Utility functions. Keep them static so whole class can become static in future + TAlfImage createImageFromImagePath( const CAlfImageVisual& aImageVisual, const TPtrC8& aPath ); + TAlfImage createNonPoolImageFromSkinLogicalID(CAlfEnv& aEnv, const Utf8* aResourceRef, AlfAttributeContainer& aContainer); + }; + +AlfImageVisualAttributeSetterImpl::AlfImageVisualAttributeSetterImpl() + { + //Do not delete textures here as they may be in use by the visuals that have not been deleted. + mEnv = CAlfEnv::Static(); + mLoadedTextures.setAutoDelete(false); + } + +AlfImageVisualAttributeSetterImpl::~AlfImageVisualAttributeSetterImpl() + { + //Unload all loaded textures created by this attributesetter to free up the memory. + for (int i =0;iTextureManager().UnloadTexture(texture->Id()); + } + mLoadedTextures.clear(); + + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfImageVisualAttributeSetter::AlfImageVisualAttributeSetter() + { + mImpl.reset(new (EMM) AlfImageVisualAttributeSetterImpl()); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfImageVisualAttributeSetter::~AlfImageVisualAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfImageVisualAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if (!imageVisual) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfImageVisualAttributeSetter") + } + + AlfCommonVisualAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::handleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + AlfCommonVisualAttributeSetter::handleDynamicDataAttribute( aVisual, aAttr, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + if (!aData) ALF_THROW ( AlfDataException, EInvalidVariantDataType, "CAlfTextVisualAttributeSetter" ) + + const char* dataField = aAttr.getDataField(); + if (!dataField) ALF_THROW ( AlfDataException, EInvalidAttribute, "CAlfTextVisualAttributeSetter" ) + + IAlfVariantType* data = aData->item ( UString(dataField)); + + const char* attrName = aAttr.name(); + + if (data) + { + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if(!imageVisual) + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "CAlfTextVisualAttributeSetter" ) + } + + if (!strcmp(attrName,KImageScaleMode)) + { + if (data->type() == IAlfVariantType::EInt) + { + int val = data->integer(); + imageVisual->SetScaleMode(CAlfImageVisual::TScaleMode(val)); + } + } + else if (!strcmp(attrName,KImageColorMode)) + { + if (data->type() == IAlfVariantType::EInt) + { + int val = data->integer(); + imageVisual->SetColorMode(CAlfImageVisual::TColorMode(val)); + } + } + else if (!strcmp(attrName,KDropShadow)) + { + + // needs to have discussion about how to store unit in the data + + } + + else if (!strcmp(attrName, KImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + HandleImagePathAttribute( src, imageVisual, true ); + } + } + + else if (!strcmp(attrName,KImageResourceRef)) + { + if (data->type() == IAlfVariantType::EString) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(data->string().getUtf8()); + } + catch(invalid_argument &) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + + if(image.HasTexture()) + { + imageVisual->SetImage(image); + } + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + } + } + + else if (!strcmp(attrName,KSecondaryImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + + HandleImagePathAttribute( src, imageVisual, false ); + } + } + + else if (!strcmp(attrName,KSecondaryImageResourceRef)) + { + if (data->type() == IAlfVariantType::EString) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(data->string().getUtf8()); + } + catch(invalid_argument &) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + if(image.HasTexture()) + { + imageVisual->SetSecondaryImage(image); + } + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + } + } + + else if (!strcmp(attrName,KSkinImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(data->string().getUtf8()); + } + catch(invalid_argument &) + { + // This image is not present in currently active Theme, + // hence Resource Pool throws an exception + // which can be ignored and we will try to load it for first time. + } + if(!image.HasTexture()) + { + image = mImpl->createNonPoolImageFromSkinLogicalID( imageVisual->Env(), data->string().getUtf8(), aContainer); + } + imageVisual->SetImage(image); + } + + } + else if (!strcmp(attrName,KAnimatedSkinImage)) + { + + // Retrieve animation skin id + + auto_ptr< HBufC> skinAnimId; + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src( (TUint8*) data->string().getUtf8() ); + TRAPD(err,skinAnimId.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(src))); + + if(err != KErrNone) + { + ALF_THROW ( AlfDataException, err, "AlfImageVisualAttributeSetter") + } + + // loading the texture from animation id. + TAlfImage skinAnimImage(imageVisual->Env().TextureManager(). + LoadAnimatedTextureL(*(skinAnimId.get()), + imageVisual->Env().PrimaryDisplay().VisibleArea().Size(), + EAlfTextureFlagDefault, + KAlfAutoGeneratedTextureId)); + + // setting the texture to imagevisual only if it exists. + if(skinAnimImage.HasTexture()) + { + imageVisual->SetImage(skinAnimImage); + } + } + + } + else if (!strcmp(attrName,KSecondarySkinImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(data->string().getUtf8()); + } + catch(invalid_argument &) + { + // This image is not present in currently active Theme, + // hence Resource Pool throws an exception + // which can be ignored and we will try to load it for first time. + } + if(!image.HasTexture()) + { + image = mImpl->createNonPoolImageFromSkinLogicalID( imageVisual->Env(), data->string().getUtf8(), aContainer); + } + imageVisual->SetSecondaryImage(image); + } + } + else if(!strcmp(attrName,KSkinFrameImage)) + { + + if (data->type() == IAlfVariantType::EString) + { + + setFrameImage(aVisual,data->string().getUtf8(), aContainer,aData); + } + } + else if (!strcmp(attrName,KStretchMode)) + { + if (data->type() == IAlfVariantType::EInt) + { + int val = data->integer(); + imageVisual->SetStretchMode(CAlfGc::TStretchMode(val)); + } + } + else if (!strcmp(attrName,KColor)) + { + if (data->type() == IAlfVariantType::EContainer ) + { + IAlfContainer* dataContainer = data->container(); + + if ( 4 != dataContainer -> count() ) ALF_THROW ( AlfDataException, EIncompleteAttributeValues, "AlfImageVisualAttributeSetter") + + IAlfVariantType* red = dataContainer->item ( 0 ); //red + + IAlfVariantType* green = dataContainer->item ( 1 ); //green + + IAlfVariantType* blue = dataContainer->item ( 2 ); //blue + + IAlfVariantType* alpha = dataContainer->item ( 3 ); //alpha + + if ( red && IAlfVariantType::EInt == red->type() && green && IAlfVariantType::EInt == green->type() && blue && IAlfVariantType::EInt == blue->type() && alpha && IAlfVariantType::EInt == alpha->type() ) + { + TRgb color ( red->integer(), green->integer(), blue->integer(), alpha->integer() ); + imageVisual->SetColor ( color ); + } + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter" ) + } + } + + } + else + { + AlfCommonVisualAttributeSetter::handleStaticDataAttribute(aVisual, aAttr, aContainer, aData); + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if(!imageVisual) + { + return; + } + + const char* attrName = aAttr.name(); + + //KScale + if (!strcmp(attrName,KScale)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(), (TInt)aAttr.getTime()); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId()); + imageVisual->SetScale( tVal ); + } + // KSecondaryAlpha + else if (!strcmp(attrName, KSecondaryAlpha)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(), (TInt)aAttr.getTime()); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + imageVisual->SetSecondaryAlpha( tVal ); + } + //KTurnAngle + else if (!strcmp(attrName, KTurnAngle)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(), (TInt)aAttr.getTime()); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + imageVisual->SetTurnAngle( tVal ); + } + else if (!strcmp(attrName,KOffsetX)||!strcmp(attrName,KOffsetY)) + { + AlfAttribute& attrX = aContainer.getAttributeByName( KOffsetX ); + AlfAttribute& attrY = aContainer.getAttributeByName( KOffsetY ); + + TAlfTimedPoint timedpoint((TReal32)attrX.getSourceValue()->realValue(), + (TReal32)attrY.getSourceValue()->realValue()); + + timedpoint.iX.SetTarget((TReal32)attrX.getTargetValue()->realValue(), (TInt)attrX.getTime()); + timedpoint.iY.SetTarget((TReal32)attrY.getTargetValue()->realValue(), (TInt)attrY.getTime()); + + timedpoint.iX.SetStyle(attrX.getInterpolationStyle()); + timedpoint.iY.SetStyle(attrY.getInterpolationStyle() ); + + timedpoint.iX.SetMappingFunctionIdentifier(attrX.getMappingFunctionId()); + timedpoint.iY.SetMappingFunctionIdentifier(attrY.getMappingFunctionId()); + + imageVisual->SetOffset(timedpoint); + attrX.setDirty(false); + attrY.setDirty(false); + + } + else + { + AlfCommonVisualAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + CAlfImageVisual* imageVisual = dynamic_cast(&aVisual); + if(!imageVisual) + { + return; + } + + const char* attrName = aAttr.name(); + + // imagevisual attributes + if (!strcmp(attrName,KImageScaleMode)) + { + int val = aAttr.intValue(); + imageVisual->SetScaleMode(CAlfImageVisual::TScaleMode(val)); + } + else if (!strcmp(attrName,KImageColorMode)) + { + int val = aAttr.intValue(); + imageVisual->SetColorMode( CAlfImageVisual::TColorMode(val)); + } + else if (!strcmp(attrName,KDropShadow)) + { + int count = aAttr.getTargetValueCount(); + + //user has added one value to the attribute,so this value will be used for both x and y directions. + if (1==count) + { + AlfAttributeValueType* attrType = aAttr.getTargetValue(0); + imageVisual->SetDropShadow( TAlfMetric(attrType->unit(),attrType->realValue()) ); + } + //user has not added two values to the attribute,so the first and second values + // will be used for x and y directions respectively. + else if (2==count) + { + const AlfAttributeValueType* attrType1 = aAttr.getTargetValue(0); + const AlfAttributeValueType* attrType2 = aAttr.getTargetValue(1); + imageVisual->SetDropShadow(TAlfXYMetric(TAlfMetric(attrType1->unit(),attrType1->realValue()),TAlfMetric(attrType2->unit(),attrType2->realValue()))); + } + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter") + } + + } + else if (!strcmp(attrName,KImagePath)) + { + TPtrC8 src((TUint8*)aAttr.stringValue().getUtf8()); + HandleImagePathAttribute( src, imageVisual, true ); + } + else if (!strcmp(attrName,KImageResourceRef)) + { + + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(aAttr.stringValue().getUtf8()); + } + catch(invalid_argument &) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + if(image.HasTexture()) + imageVisual->SetImage(image); + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + + } + else if (!strcmp(attrName,KSecondaryImagePath)) + { + TPtrC8 src((TUint8*)aAttr.stringValue().getUtf8()); + HandleImagePathAttribute( src, imageVisual, false ); + } + else if (!strcmp(attrName,KSecondaryImageResourceRef)) + { + + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(aAttr.stringValue().getUtf8()); + } + catch(invalid_argument &) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + if(image.HasTexture()) + imageVisual->SetSecondaryImage(image); + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter:: Image does not exist"); + } + + } + else if (!strcmp(attrName,KSkinImagePath)) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(aAttr.stringValue().getUtf8()); + } + catch(invalid_argument &) + { + // This image is not present in currently active Theme, + // hence Resource Pool throws an exception + // which can be ignored and we will try to load it for first time. + } + if(!image.HasTexture()) + { + image = mImpl->createNonPoolImageFromSkinLogicalID( + imageVisual->Env() ,aAttr.stringValue().getUtf8(), aContainer); + } + imageVisual->SetImage(image); + } + else if (!strcmp(attrName,KAnimatedSkinImage)) + { + + // Retrieve animation skin id + auto_ptr< HBufC> skinAnimId; + TPtrC8 src( (TUint8*) aAttr.stringValue().getUtf8() ); + TRAPD(err,skinAnimId.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(src))); + + if(err != KErrNone) + { + ALF_THROW ( AlfDataException, err, "AlfImageVisualAttributeSetter") + } + + // loading the texture from animation id. + TAlfImage skinAnimImage(imageVisual->Env().TextureManager(). + LoadAnimatedTextureL(*(skinAnimId.get()), + imageVisual->Env().PrimaryDisplay().VisibleArea().Size(), + EAlfTextureFlagDefault, + KAlfAutoGeneratedTextureId)); + + // setting the texture to imagevisual only if it exists. + if(skinAnimImage.HasTexture()) + { + imageVisual->SetImage(skinAnimImage); + } + + } + else if (!strcmp(attrName,KSecondarySkinImagePath)) + { + TAlfImage image; + try + { + image = AlfWidgetEnvExtension::resourcePool(aVisual.Env()).getImageResource(aAttr.stringValue().getUtf8()); + } + catch(invalid_argument &) + { + // This image is not present in currently active Theme, + // hence Resource Pool throws an exception + // which can be ignored and we will try to load it for first time. + } + if(!image.HasTexture()) + { + image = mImpl->createNonPoolImageFromSkinLogicalID( imageVisual->Env(), aAttr.stringValue().getUtf8(), aContainer); + } + imageVisual->SetSecondaryImage(image); + } + else if(!strcmp(attrName,KSkinFrameImage)) + { + setFrameImage(aVisual, aAttr.stringValue().getUtf8(), aContainer); + } + else if (!strcmp(attrName,KStretchMode)) + { + int val = aAttr.intValue(); + imageVisual->SetStretchMode(CAlfGc::TStretchMode(val)); + } + else if (!strcmp(attrName, KSecondaryAlpha)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(), (TInt)aAttr.getTime()); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId()); + imageVisual->SetSecondaryAlpha( tVal ); + } + else if (!strcmp(attrName, KTurnAngle)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(), (TInt)aAttr.getTime()); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + imageVisual->SetTurnAngle( tVal ); + } + else if (!strcmp(attrName, KColor)) + { + if ( 4 == aAttr.getTargetValueCount() && AlfAttributeValueType::EInt == aAttr.type(0) && AlfAttributeValueType::EInt == aAttr.type(1) && AlfAttributeValueType::EInt == aAttr.type(2) && AlfAttributeValueType::EInt == aAttr.type(3)) + { + TRgb color ( aAttr.intValue(0), aAttr.intValue(1), aAttr.intValue(2), aAttr.intValue(3) ); + imageVisual->SetColor ( color ); + } + else + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfImageVisualAttributeSetter") + } + } + else + { + AlfCommonVisualAttributeSetter::handleStaticAttribute(aVisual, aAttr, aContainer); + } + } + + + +// --------------------------------------------------------------------------- +// Helper method to set the frame image to the image visual. +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::setFrameImage(CAlfVisual& /*aVisual*/, const Utf8* /*aSkinFrameID*/, + const AlfAttributeContainer& /*aContainer*/,IAlfMap* /*aData*/) + { + + } + +// --------------------------------------------------------------------------- +// This method gets the value of the attribute based on whether the attribute is static +// or staticData. +// Currently handled only for static or staticdata. +// --------------------------------------------------------------------------- + +int AlfImageVisualAttributeSetter::getValueFromAttribute(const AlfAttribute& aAttr,IAlfMap* aData) const + { + int attrValue=0; + + // Check whether attribute is from Static type. + + if(AlfAttribute::EStatic==aAttr.category()) + { + attrValue=aAttr.intValue(); + } + else + { + + // static data case. + try + { + if(aData) + { + + const char* dataValue = aAttr.getDataField(); + IAlfVariantType* dataVariant = aData->item ( UString(dataValue) ); + + if (dataVariant && dataVariant->type() == IAlfVariantType::EInt ) + { + + attrValue=dataVariant->integer(); + + } + } + } + catch(AlfDataException& e) + { + // Error in getting the value. + // default is already set to 0,dont do anything here. + } + } + + return attrValue; + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfImageVisualAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfImageVisualAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + + // Call the base class implementation.It goes through its loop and checks if there are attributes + // that it handles. + AlfCommonVisualAttributeSetter::createAndSendCommands( + aVisual, + aContainer, + aRefVisual ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfImageVisualAttributeSetter::HandleImagePathAttribute( + const TPtrC8& aStringValue, + CAlfImageVisual* aImageVisual, + bool aPrimary ) + { + TAlfImage image = mImpl->createImageFromImagePath( *aImageVisual, aStringValue); + if ( aPrimary ) + { + aImageVisual->SetImage(image); + } + else + { + aImageVisual->SetSecondaryImage(image); + } + } + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +TAlfImage AlfImageVisualAttributeSetterImpl::createNonPoolImageFromSkinLogicalID(CAlfEnv& /*aEnv*/, const Utf8* /*aLogicalId*/, AlfAttributeContainer& /*aContainer*/) + { + + // Depricated + return TAlfImage(); + + } + +TAlfImage AlfImageVisualAttributeSetterImpl::createImageFromImagePath( const CAlfImageVisual& aImageVisual, const TPtrC8& aPath ) + { + TAlfImage image; // return value + + auto_ptr textureId; + TRAPD(err,textureId.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(aPath))); + if ( err != KErrNone ) + { + ALF_THROW ( AlfDataException, err, "AlfImageVisualAttributeSetter") + } + + // check if the texture is already loaded + CAlfTextureManager& textureMgr = aImageVisual.Env().TextureManager(); + const TInt existingTextureId = textureMgr.TextureId(*(textureId.get())); + if (existingTextureId != KErrNotFound) + { + const CAlfTexture* texture = textureMgr.Texture( existingTextureId ); + image = TAlfImage(*texture); + } + else + { + CAlfTexture* mutableTexture = 0; + TRAP(err, mutableTexture = &(textureMgr.LoadTextureL(*(textureId.get()), EAlfTextureFlagDefault, KAlfAutoGeneratedTextureId))); + if ( err != KErrNone ) + { + ALF_THROW ( AlfDataException, err, "AlfImageVisualAttributeSetter") + } + mutableTexture->EnableRefCounting(ETrue); + image = TAlfImage(*mutableTexture); + mLoadedTextures.resize(mLoadedTextures.count()+1); + mLoadedTextures.insert(mLoadedTextures.count(),mutableTexture); + } + + return image; + } + +}// Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alflayoutmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alflayoutmanager.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2007 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: layoutmanager with focus handling in 1D (next/previous) +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "alf/alfwidget.h" +#include "alflayoutmanagerimpl.h" + +using osncore::UString; + +using namespace Alf; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layout manager constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLayoutManager::AlfLayoutManager(TAlfLayoutType aLayoutType) + { + mData.reset(new (EMM) AlfLayoutManagerImpl(aLayoutType)); + } + +// --------------------------------------------------------------------------- +// virtual destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLayoutManager::~AlfLayoutManager() + { + } + +// --------------------------------------------------------------------------- +// returns the owner of the layoutmanager +// --------------------------------------------------------------------------- +// +OSN_EXPORT CAlfWidgetControl& AlfLayoutManager::owner() const + { + return mData->owner(); + } + +// --------------------------------------------------------------------------- +// returns the widget at index aIndex. +// --------------------------------------------------------------------------- +// +OSN_EXPORT CAlfWidgetControl* AlfLayoutManager::getControl(int aIndex) const + { + return mData->getControl(aIndex); + } + +// --------------------------------------------------------------------------- +// returns the count of controls in the layoutmanager. +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfLayoutManager::count() const + { + return mData->count(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// creates the layout used by this layoutmanager. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::createLayout(CAlfWidgetControl& aOwner, + CAlfLayout* aParentLayout, int aLayoutIndex) + { + mData->createLayout(aOwner, aParentLayout, aLayoutIndex); + updateChildrenLayout(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// returns the layout used by this layoutmanager. +// --------------------------------------------------------------------------- +// +OSN_EXPORT CAlfLayout& AlfLayoutManager::getLayout() const + { + return mData->getLayout(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::updateChildLayout( + CAlfWidgetControl* aControl) + { + mData->getLayout(); //checks, that the layout exists, throws exception if not. + doUpdateChildLayout( aControl ); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// notifies the layout manager, that all the child controls' layouts +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::updateChildrenLayout() + { + CAlfLayout& layout = mData->getLayout(); + mData->updateMainLayout(); + + // CAlfWidgetControl& container = mData->owner(); + const int childrenCount = count(); + + // go through all the child controls, and update the layout + for (int i = 0; i < childrenCount; i++) + { + doUpdateChildLayout(getControl(i)); + } + + layout.UpdateChildrenLayout(); + + //doUpdateChildLayout changes the visual size and position. + //need to notify all the widgets that size and position might have changed. + mData->updateAllWidgetRects(); + + // Inform parent layout manager about the changed presentation size + owner().updateParentLayout(); + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutManager +// notifies the layout manager, that the control's has been +// removed from the layout. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::childRemoved(CAlfWidgetControl* aControl) + { + mData->childRemoved(aControl); + } + +// --------------------------------------------------------------------------- +// notifies the layout manager, that the child control's layout +// must be updated. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::doUpdateChildLayout( + CAlfWidgetControl* aControl) + { + mData->doUpdateChildLayout(aControl); + } + +// --------------------------------------------------------------------------- +// returns the size of the widget. +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfLayoutManager::controlRect( + CAlfWidgetControl& aControl, TAlfRealRect& aRect) + { + return mData->controlRect(aControl, aRect); + } + +// --------------------------------------------------------------------------- +// sets the size and position of the widget. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::setControlRect( + CAlfWidgetControl& aControl, const TAlfRealRect &aRect) + { + AlfWidget* widget = aControl.widget(); + if (widget) + { + const char* name = widget->widgetName(); + IAlfWidget* ownerwidget = AlfWidgetEnvExtension::widgetFactory(aControl.Env()).findWidget(name); + if (ownerwidget) + { + mData->setWidgetRect(*ownerwidget, aRect); + } + } + } + +// --------------------------------------------------------------------------- +// sets the position of the widget. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::setControlPosition( + CAlfWidgetControl& aControl, const TAlfRealPoint& aPos) + { + AlfWidget* widget = aControl.widget(); + if (widget) + { + const char* name = widget->widgetName(); + IAlfWidget* ownerwidget = AlfWidgetEnvExtension::widgetFactory(aControl.Env()).findWidget(name); + if (ownerwidget) + { + mData->setWidgetPosition(*ownerwidget, aPos); + } + } + } + +// --------------------------------------------------------------------------- +// sets the size of the widget. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLayoutManager::setControlSize( + CAlfWidgetControl& aControl, const TAlfRealPoint &aSize) + { + AlfWidget* widget = aControl.widget(); + if (widget) + { + const char* name = widget->widgetName(); + IAlfWidget* ownerwidget = AlfWidgetEnvExtension::widgetFactory(aControl.Env()).findWidget(name); + if (ownerwidget) + { + mData->setWidgetSize(*ownerwidget, aSize); + } + } + } + +// --------------------------------------------------------------------------- +// returns layout preferences for aControl +// --------------------------------------------------------------------------- +// +OSN_EXPORT const IAlfLayoutPreferences* AlfLayoutManager::getLayoutPreferences( + CAlfWidgetControl* aControl) const + { + return mData->getLayoutPreferences(aControl); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfLayoutManager::makeInterface( + const IfId& aType ) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutManager::type().mImplementationId) + { + return static_cast(this); + } + + + // Let the implementation class try the interface creation + return mData->makeInterface(aType); + } + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alflayoutmanagerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alflayoutmanagerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2007 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: layoutmanager implementation class with focus handling in 1D (next/previous) +* +*/ + + +#include +#include "alf/ialfattributeowner.h" +#include "alf/alfattribute.h" +#include +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "alflayoutmanagerimpl.h" + + + +namespace Alf + { + +//ifdef to prevent compiler warning: className not used. +#ifdef ALF_DEBUG_EXCEPTIONS +static const char* const className = "AlfLayoutManagerImpl"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// layoutmanagerimpl constructor +// --------------------------------------------------------------------------- +// +AlfLayoutManagerImpl::AlfLayoutManagerImpl( + TAlfLayoutType aLayoutType) + { + mLayoutType = aLayoutType; + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +AlfLayoutManagerImpl::~AlfLayoutManagerImpl() + { + if (mLayout.get()) + { + CAlfLayout* layout = mLayout.release(); + layout->RemoveAndDestroyAllD(); + } + } + +// --------------------------------------------------------------------------- +// creates the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::createLayout(CAlfWidgetControl& aOwner, + CAlfLayout* aParentLayout, int aLayoutIndex) + { + + //check parameter validity. + if (aParentLayout && + (aLayoutIndex < 0 ||aLayoutIndex > aParentLayout->Count())) + { + ALF_THROW(AlfException, EInvalidArrayIndex, className); + } + + //create layout + CAlfLayout* layout = 0; + TRAPD(err, layout = aOwner.AppendLayoutL(mLayoutType, aParentLayout)); + + if(!layout || err != KErrNone) + { + ALF_THROW(AlfVisualException, ECanNotCreateVisual, className); + } + + //reorder, if needed. + if (aParentLayout && aLayoutIndex != aParentLayout->Count() - 1) + { + aParentLayout->Reorder(*layout, aLayoutIndex); + } + + mLayout.reset(layout); + } + +// --------------------------------------------------------------------------- +// returns the layout used by the layoutmanager. +// --------------------------------------------------------------------------- +// +CAlfLayout& AlfLayoutManagerImpl::getLayout() const + { + checkLayout(); + return *mLayout.get(); + } + +// --------------------------------------------------------------------------- +// updates the main layout +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::updateMainLayout() + { + checkLayout(); + + const IAlfLayoutPreferences* layoutPrefs = + getLayoutPreferences(getControl(*mLayout.get())); + if (layoutPrefs) + { + TAlfXYMetric prefSize; + if (layoutPrefs->getPreferredSize(prefSize)) + { + TAlfRealPoint p(prefSize.iX.iMagnitude, + prefSize.iY.iMagnitude); + mLayout->SetSize(p); + } + } + } + +// --------------------------------------------------------------------------- +// notifies the layout manager, that the control's has been +// removed from the layout. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::childRemoved(CAlfWidgetControl* /*aControl*/) + { + checkLayout(); + mLayout->UpdateChildrenLayout(); + } + +// --------------------------------------------------------------------------- +// returns the owner control of the layoutmanager. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl& AlfLayoutManagerImpl::owner() const + { + checkLayout(); + CAlfWidgetControl* widgetControl = 0; + + /* The owner is always a AlfWidgetControl. + So a static_cast is safe. see AlfLayoutManagerImpl::createLayout() */ + widgetControl = static_cast( + &mLayout->Owner()); + + return *widgetControl; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the minimum area that this layout manager can occupy by observing +// the minimum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfLayoutManagerImpl::getMinimumSize( TAlfXYMetric& /*aMinSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// Returns the maximum area that this layout manager can occupy by observing +// the maximum sizes of the child UI elements in the layout +// --------------------------------------------------------------------------- +// +bool AlfLayoutManagerImpl::getMaximumSize( TAlfXYMetric& /*aMaxSize*/ ) const + { + return false; + } + +// --------------------------------------------------------------------------- +// Combines and returns the preferred sizes of all child UI elements according +// to the layouting rules. +// --------------------------------------------------------------------------- +// +bool AlfLayoutManagerImpl::getPreferredSize(TAlfXYMetric& /*aPreferredSize*/) const + { + return false; + } + +// --------------------------------------------------------------------------- +// from IAlfLayoutPreferences +// At the moment doesn't do anything since preferred size is being queried +// from the child UI elements added to this layout manager. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::setPreferredSize( const TAlfXYMetric& /*aPreferredSize*/ ) + { + + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the element. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfLayoutManagerImpl::makeInterface(const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfLayoutPreferences::type().mImplementationId) + { + return static_cast(this); + } + + return 0; + } + +// --------------------------------------------------------------------------- +// gets control at aIndex position in the layout. +// --------------------------------------------------------------------------- +// +CAlfWidgetControl* AlfLayoutManagerImpl::getControl(int aIndex) const + { + CAlfWidgetControl* control = 0; + CAlfLayout* layout = mLayout.get(); + if (layout) + { + CAlfVisual& visual = layout->Visual(aIndex); + control = getControl(visual); + } + return control; + } + +// --------------------------------------------------------------------------- +// returns the control, which owns the visual +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::doUpdateChildLayout(CAlfWidgetControl* aControl) + { + const IAlfLayoutPreferences* layoutPrefs = + getLayoutPreferences(aControl); + + if (layoutPrefs) + { + TAlfXYMetric prefSize; + if (layoutPrefs->getPreferredSize(prefSize)) + { + CAlfVisual* v = findRootVisual(aControl); + if (v) + { + v->SetSize(TAlfRealPoint(prefSize.iX.iMagnitude, + prefSize.iY.iMagnitude)); + } + } + } + } + +// --------------------------------------------------------------------------- +// returns the size of the widget. +// --------------------------------------------------------------------------- +// +bool AlfLayoutManagerImpl::controlRect(CAlfWidgetControl& aControl, + TAlfRealRect& aRect) + { + CAlfVisual* v = findRootVisual(&aControl); + if (v != 0) + { + TAlfRealPoint size(v->Size().Target()); + TAlfRealPoint pos(v->Pos().Target()); + aRect.iTl = pos; + aRect.iBr.iX = pos.iX + size.iX; + aRect.iBr.iY = pos.iY + size.iY; + return true; + } + + return false; + } + +// --------------------------------------------------------------------------- +// set the size and position to the widget. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::setWidgetRect(IAlfWidget& aWidget, const TAlfRealRect &aRect) + { + const UString widthName(layoutattributes::KWidth); + const UString heightName(layoutattributes::KHeight); + const UString posX(layoutattributes::KPositionX); + const UString posY(layoutattributes::KPositionY); + + IAlfAttributeOwner* attrOwner = + IAlfInterfaceBase::makeInterface(&aWidget); + if (attrOwner) + { + auto_ptr w( + new (EMM) AlfAttributeValueType(aRect.Width())); + auto_ptr h( + new (EMM) AlfAttributeValueType(aRect.Height())); + auto_ptr x( + new (EMM) AlfAttributeValueType(aRect.iTl.iX)); + auto_ptr y( + new (EMM) AlfAttributeValueType(aRect.iTl.iY)); + attrOwner->setAttribute(heightName, h.get()); + attrOwner->setAttribute(widthName, w.get()); + attrOwner->setAttribute(posX, x.get()); + attrOwner->setAttribute(posY, y.get()); + + h.release(); + w.release(); + x.release(); + y.release(); + } + } + +// --------------------------------------------------------------------------- +// set the position for the widget. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::setWidgetPosition(IAlfWidget& aWidget, + const TAlfRealPoint &aPos) + { + const UString posX(layoutattributes::KPositionX); + const UString posY(layoutattributes::KPositionY); + + IAlfAttributeOwner* attrOwner = + IAlfInterfaceBase::makeInterface(&aWidget); + if (attrOwner) + { + auto_ptr x( + new (EMM) AlfAttributeValueType(aPos.iX)); + auto_ptr y( + new (EMM) AlfAttributeValueType(aPos.iY)); + attrOwner->setAttribute(posX, x.get()); + attrOwner->setAttribute(posY, y.get()); + x.release(); + y.release(); + } + } + +// --------------------------------------------------------------------------- +// set the size for the widget. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::setWidgetSize(IAlfWidget& aWidget, const TAlfRealPoint &aSize) + { + const UString widthName(layoutattributes::KWidth); + const UString heightName(layoutattributes::KHeight); + IAlfAttributeOwner* attrOwner = + IAlfInterfaceBase::makeInterface(&aWidget); + if (attrOwner) + { + auto_ptr w( + new (EMM) AlfAttributeValueType(aSize.iX)); + auto_ptr h( + new (EMM) AlfAttributeValueType(aSize.iY)); + attrOwner->setAttribute(heightName, h.get()); + attrOwner->setAttribute(widthName, w.get()); + h.release(); + w.release(); + } + } + +// --------------------------------------------------------------------------- +// updates widget size and position properties for all the children +// to correct sizes and positions of the root visuals. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::updateAllWidgetRects() + { + const int childCount = mLayout->Count(); + TAlfRealRect rect; + for (int i = 0; i < childCount; i++) + { + CAlfWidgetControl* control = getControl(i); + controlRect(*control, rect); //returns the real rect(of the root visual) + AlfWidget* widget = control->widget(); + if(widget) + { + const char* name = widget->widgetName(); + IAlfWidget* ownerwidget = AlfWidgetEnvExtension::widgetFactory(control->Env()).findWidget(name); + if (ownerwidget) + { + setWidgetRect(*ownerwidget, rect); //sets the rect using widget properties. + } + } + } + + } + +// --------------------------------------------------------------------------- +// returns the child visual count +// --------------------------------------------------------------------------- +// +int AlfLayoutManagerImpl::count() const + { + return getLayout().Count(); + } + +// --------------------------------------------------------------------------- +// returns the control, which owns the visual +// --------------------------------------------------------------------------- +// +CAlfWidgetControl* AlfLayoutManagerImpl::getControl(CAlfVisual& aVisual) const + { + CAlfWidgetControl* temp = 0; + temp = dynamic_cast(&aVisual.Owner()); + return temp; + } + +// --------------------------------------------------------------------------- +// returns the control, which owns the visual +// --------------------------------------------------------------------------- +// +const IAlfLayoutPreferences* AlfLayoutManagerImpl::getLayoutPreferences( + CAlfWidgetControl* aControl) const + { + IAlfLayoutPreferences* layoutPrefs = 0; + if (aControl) + { + layoutPrefs = + CAlfWidgetControl::makeInterface(aControl); + } + + return layoutPrefs; + } + +// --------------------------------------------------------------------------- +// finds the root visual for a control. +// --------------------------------------------------------------------------- +// +CAlfVisual* AlfLayoutManagerImpl::findRootVisual(CAlfWidgetControl* aControl) const + { + CAlfVisual* root = 0; + if (aControl->VisualCount() > 0) + { + //take first visual, + //go up in layout hierarchy until the control is not owner anymore. + for (root = &aControl->Visual(0); + root && root->Layout() && &root->Layout()->Owner() == aControl; + root = root->Layout()){} + } + return root; + } + +// --------------------------------------------------------------------------- +// throws an exception, if layout is not created. +// --------------------------------------------------------------------------- +// +void AlfLayoutManagerImpl::checkLayout() const + { + if (!mLayout.get()) + { + ALF_THROW(AlfVisualException, EInvalidVisual, className); + } + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alflctanchorlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alflctanchorlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,281 @@ +/* +* Copyright (c) 2007 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: attributesetter for lct anchor layout. +* +*/ + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alflctanchorlayoutattributesetter.h" +#include +#include + +//osn includes +#include + +//alf includes +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" +#include +//other includes +#include +#ifdef RD_ALF_IN_PLATFORM +#include +#endif + +#include "AlfLctAttributeSetterUtils.h" + +using osncore::UString; + +using namespace duiuimodel::layoutattributes::grid; + +using namespace duiuimodel::lctvisualattributes; + +using namespace duiuimodel::anchorlayoutinput; + +namespace Alf + { + +//variable inside ifdef to prevent compiler warning. +#ifdef ALF_DEBUG_EXCEPTIONS +static const char* const ClassName = "AlfLCTAnchorLayoutAttributeSetter"; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLCTAnchorLayoutAttributeSetter::AlfLCTAnchorLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLCTAnchorLayoutAttributeSetter::~AlfLCTAnchorLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLCTAnchorLayoutAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfLCTAnchorLayout* anchorlayout = + dynamic_cast(&aVisual); + + if ( !anchorlayout ) + { + ALF_THROW(AlfVisualException, EInvalidVisual, ClassName) + } + + AlfAnchorLayoutAttributeSetter::setAttributeValue( + aVisual, aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfLCTAnchorLayoutAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, + AlfAttributeContainer* /*aContainer*/, IAlfMap* /*aData*/, + int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLCTAnchorLayoutAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + AlfAnchorLayoutAttributeSetter::createAndSendCommands( + aVisual, aContainer, aRefVisual); + } + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfLCTAnchorLayoutAttributeSetter::handleDynamicAttribute( + CAlfVisual& aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + const char* attrName = aAttr.name(); + +#ifdef RD_ALF_IN_PLATFORM + if ( !strcmp ( attrName, KLCT ) ) + { + TAknLayoutHierarchyComponentHandle componentHandle = + AlfLctAttributeSetterUtils::getCommonLctAttributes(&aContainer); + + int width(0); + int height(0); + if (AlfLctAttributeSetterUtils::itemSize(componentHandle, + width, height)) + { + TInt displayWidth = + aVisual.Env().PrimaryDisplay().VisibleArea().Width(); + if (width > displayWidth) + { + width = displayWidth; + } + + TAlfTimedPoint size(width, height); + aVisual.SetSize(size); + } + } + else +#endif + if (strcmp(attrName,KRows) && + strcmp(attrName,KColumns) && + strcmp(attrName,KChildOrdinal)) + { + AlfAnchorLayoutAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfLCTAnchorLayoutAttributeSetter::handleStaticAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + CAlfLCTAnchorLayout* anchorlayout = + dynamic_cast(&aVisual); + + const char* attrName = aAttr.name(); + +#ifdef RD_ALF_IN_PLATFORM + if ( !strcmp ( attrName, KLCT ) ) + { + TAknLayoutHierarchyComponentHandle componentHandle = + AlfLctAttributeSetterUtils::getCommonLctAttributes(&aContainer); + + int width(0); + int height(0); + if (AlfLctAttributeSetterUtils::itemSize(componentHandle, + width, height)) + { + // Some cases returns wrong width, so check that width is reasonable + TInt displayWidth = + aVisual.Env().PrimaryDisplay().VisibleArea().Width(); + if (width > displayWidth) + { + width = displayWidth; + } + TAlfTimedPoint size(width, height); + aVisual.SetSize(size); + } + } + else if ( !strcmp(attrName, KRows)|| + !strcmp (attrName,KColumns) || !strcmp(attrName,KChildOrdinal) ) + { + TAknLayoutHierarchyComponentHandle componentHandle = + AlfLctAttributeSetterUtils::getCommonLctAttributes(&aContainer); + AlfAttribute& attrRows = aContainer.getAttributeByName(KRows); + AlfAttribute& attrCols = aContainer.getAttributeByName(KColumns); + AlfAttribute& attrOrdinal = + aContainer.getAttributeByName(KChildOrdinal); + componentHandle.SetColumn(attrCols.realValue()); + componentHandle.SetRow(attrRows.realValue()); + TAlfTimedPoint timedpoint(attrCols.getSourceValue()->realValue(), + attrRows.getSourceValue()->realValue()); + + //since static, effect will be immediate + timedpoint.iX.SetTarget(attrCols.getTargetValue()->realValue(), 0); + timedpoint.iY.SetTarget(attrRows.getTargetValue()->realValue(), 0); + + timedpoint.iX.SetStyle(attrCols.getInterpolationStyle()); + timedpoint.iY.SetStyle(attrRows.getInterpolationStyle()); + + //TO ADD: Mapping Function Identifiers + anchorlayout->SetAnchors(attrOrdinal.intValue(), + componentHandle, timedpoint); + attrRows.setDirty(false); + attrCols.setDirty(false); + attrOrdinal.setDirty(false); + } + else +#endif + { + AlfAnchorLayoutAttributeSetter::handleStaticAttribute(aVisual, aAttr, + aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfLCTAnchorLayoutAttributeSetter::handleDynamicDataAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + AlfAnchorLayoutAttributeSetter::handleDynamicDataAttribute(aVisual, aAttr, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfLCTAnchorLayoutAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + AlfAnchorLayoutAttributeSetter::handleStaticDataAttribute(aVisual, aAttr, + aContainer, aData); + } + + } // namespace Alf + +// End of file + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alflinevisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alflinevisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1409 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for linevisual. +* +*/ + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alflinevisualattributesetter.h" +#include +#include +#include + +//osn includes +#include +#include + +//alf includes +#include +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include +#include + + + +//namespaces + +using namespace osncore; + +using namespace duiuimodel::commonvisualattributes; +using namespace duiuimodel::linevisualattributes; +using namespace duiuimodel::curvepathattributes; + +namespace Alf + { + +static void throwIfErr ( int aErr ) + { + if (aErr!=KErrNone) + { + ALF_THROW ( AlfAttributeException, aErr, + "AlfLineVisualAttributeSetter") + } + } + + +class AlfLineVisualAttributeSetterImpl + { +public: + AlfLineVisualAttributeSetterImpl(); + ~AlfLineVisualAttributeSetterImpl(); +public: + + // Texture manager doesn't unload the texture from memory untill Env + // is deleted. Hence need to unload them once attribute setter is deleted. + AlfPtrVector mLoadedTextures; + // Env needed to access TextureManager while unloading textures. + CAlfEnv* mEnv; + }; + +AlfLineVisualAttributeSetterImpl::AlfLineVisualAttributeSetterImpl() + { + // Do not delete textures here as they may be in use by the visuals + // that have not been deleted. + mLoadedTextures.setAutoDelete(false); + } + +AlfLineVisualAttributeSetterImpl::~AlfLineVisualAttributeSetterImpl() + { + // Unload all loaded textures created by this attributesetter to free + // up the memory. + for (int i =0;iTextureManager().UnloadTexture(Texture->Id()); + } + mLoadedTextures.clear(); + } + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLineVisualAttributeSetter::AlfLineVisualAttributeSetter() + { + mImpl.reset(new (EMM) AlfLineVisualAttributeSetterImpl()); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfLineVisualAttributeSetter::~AlfLineVisualAttributeSetter() + { + } + + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLineVisualAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfLineVisual* lineVisual = dynamic_cast( &aVisual); + + if ( !lineVisual ) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfLineVisualAttributeSetter" ) + } + + CAlfCurvePath* curve = lineVisual->Path(); + if (curve) + { + curve->Reset(); + } + + AlfCommonVisualAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfLineVisualAttributeSetter::createCommand ( + CAlfVisual& /*aVisual*/, + AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, + int /*aTransitionTime*/, + CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfLineVisualAttributeSetter::createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + // SetOffset in CAlfCurvePath, + // SetThickness,SetShadowThickness SetStartPos & SetEndPos + // in Line Visual can be sent as a TAlfCustomEventCommand + AlfCommonVisualAttributeSetter::createAndSendCommands ( + aVisual, aContainer, aRefVisual ); + + } + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfLineVisualAttributeSetter::handleDynamicAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + + CAlfLineVisual* lineVisual = dynamic_cast( &aVisual); + if ( !lineVisual ) + { + return; + } + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KThickness ) ) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget ((TReal32)aAttr.getTargetValue()->realValue(), + (TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier (aAttr.getMappingFunctionId()); + + lineVisual->SetThickness(tVal); + } + + else if ( !strcmp ( attrName, KShadowThickness ) ) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget ((TReal32)aAttr.getTargetValue()->realValue(), + (TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier (aAttr.getMappingFunctionId()); + + lineVisual->SetShadowThickness(tVal); + } + + else if ( !strcmp ( attrName, KStartPos ) ) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget ((TReal32)aAttr.getTargetValue()->realValue(), + (TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier (aAttr.getMappingFunctionId()); + + lineVisual->SetStartPos(tVal); + } + + else if ( !strcmp ( attrName, KEndPos ) ) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget ((TReal32)aAttr.getTargetValue()->realValue(), + (TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier (aAttr.getMappingFunctionId()); + + lineVisual->SetEndPos(tVal); + } + + else if ( !strcmp ( attrName, KOffsetX )||!strcmp ( attrName, KOffsetY ) ) + { + AlfAttribute& offsety = aContainer.getAttributeByName ( + KOffsetY ); + AlfAttribute& offsetx = aContainer.getAttributeByName ( + KOffsetX ); + //will throw if attribute is not found + + TAlfTimedPoint offset((TReal32)offsetx.getSourceValue()->realValue(), + (TReal32)offsety.getSourceValue()->realValue()); + + offset.iX.SetTarget((TReal32)offsetx.getTargetValue()->realValue(), + offsetx.getTime()); + + offset.iY.SetTarget((TReal32)offsety.getTargetValue()->realValue(), + offsety.getTime()); + + offset.iX.SetStyle ( offsetx.getInterpolationStyle() ); + offset.iY.SetStyle ( offsety.getInterpolationStyle() ); + + offset.iX.SetMappingFunctionIdentifier ( + offsetx.getMappingFunctionId()); + offset.iY.SetMappingFunctionIdentifier ( + offsety.getMappingFunctionId()); + + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + curve->SetOffset ( offset ); + offsetx.setDirty(false); + offsety.setDirty(false); + } + + else + { + AlfCommonVisualAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfLineVisualAttributeSetter::handleStaticAttribute ( + CAlfVisual& aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + + CAlfLineVisual* lineVisual = dynamic_cast( &aVisual); + if ( !lineVisual ) + { + return; + } + + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KImagePath ) ) + { + TPtrC8 src; + src.Set((TUint8*)aAttr.stringValue().getUtf8()); + auto_ptr DesC; + TRAPD(err1, + DesC.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(src))); + throwIfErr(err1); + + if (DesC.get()) + { + CAlfTexture* texture = NULL; + TRAPD(err2,texture = &(aVisual.Env().TextureManager(). + LoadTextureL( *(DesC.get()), + EAlfTextureFlagDefault, + KAlfAutoGeneratedTextureId))); + throwIfErr(err2); + lineVisual->SetImage(TAlfImage(*texture)); + mImpl->mEnv = &aVisual.Env(); + mImpl->mLoadedTextures.resize(mImpl->mLoadedTextures.count()+1); + mImpl->mLoadedTextures.insert(mImpl->mLoadedTextures.count(), + texture); + } + } + + else if ( !strcmp ( attrName, KThickness ) ) + { + TAlfTimedValue val(aAttr.realValue(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetThickness(val); + } + + else if ( !strcmp ( attrName, KShadowThickness ) ) + { + TAlfTimedValue val(aAttr.realValue(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetShadowThickness(val); + } + + else if ( !strcmp ( attrName, KStartPos ) ) + { + TAlfTimedValue val(aAttr.realValue(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetStartPos(val); + } + + else if ( !strcmp ( attrName, KEndPos ) ) + { + TAlfTimedValue val(aAttr.realValue(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetEndPos(val); + } + + else if ( !strcmp ( attrName, KAlphaMappingFunction ) ) + { + // assumption: + // The int value-mapping function mapping is the following: + // 0 - KConstMappingFunction + // 1 - duiuimodel::nodetypes::KLinearMappingFunction + // 2 - KSineMappingFunction + // 3 - KCosineMappingFunction + + MAlfMappingFunction* func = this->getMappingFunction(aAttr, + lineVisual->Env()); + if (!func) + { + ALF_THROW ( AlfAttributeException, + EInvalidAttribute, "AlfLineVisualAttributeSetter") + } + + lineVisual->SetAlphaFunction(func); + } + + else if ( !strcmp ( attrName, KWidthMappingFunction ) ) + { + //assumption: + //The int value-mapping function mapping is the following: + //0 - KConstMappingFunction + //1 - duiuimodel::nodetypes::KLinearMappingFunction + //2 - KSineMappingFunction + //3 - KCosineMappingFunction + + MAlfMappingFunction* func = this->getMappingFunction(aAttr, + lineVisual->Env()); + if (!func) + { + ALF_THROW ( AlfAttributeException, + EInvalidAttribute, "AlfLineVisualAttributeSetter") + } + lineVisual->SetWidthFunction(func); + } + + else if ( !strcmp ( attrName, KColor ) ) + { + if ( 4 == aAttr.getTargetValueCount() && + AlfAttributeValueType::EFloat == aAttr.type(0) && + AlfAttributeValueType::EFloat == aAttr.type(1) && + AlfAttributeValueType::EFloat == aAttr.type(2) && + AlfAttributeValueType::EFloat == aAttr.type(3)) + { + TRgb color ( aAttr.realValue(0), + aAttr.realValue(1), + aAttr.realValue(2), + aAttr.realValue(3) ); + lineVisual->SetColor ( color ); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfLineVisualAttributeSetter") + } + } + + else if ( !strcmp ( attrName, KEnableLoop ) ) + { + + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + // if value is not int, then use default parameter of EnableLoop + if ( AlfAttributeValueType::EInt != aAttr.type() ) + { + curve->EnableLoop (); + } + else + { + int enableLoop = aAttr.intValue(); + + TBool flag = ETrue; + //Assume true for any non-zero value. + + if ( 0 == enableLoop ) + { + flag = EFalse; + } + curve->EnableLoop ( flag ); + } + } + + else if ( !strcmp ( attrName, KOrigin ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + curve->SetOrigin ( aAttr.realValue() ); + } + + else if ( !strcmp ( attrName, KOffsetX )||!strcmp ( attrName, KOffsetY ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + AlfAttribute& offsety = aContainer.getAttributeByName ( + KOffsetY ); + AlfAttribute& offsetx = aContainer.getAttributeByName ( + KOffsetX ); + //will throw if attribute is not found + + TAlfTimedPoint offset( offsetx.realValue(), offsety.realValue()); + curve->SetOffset ( offset ); + offsetx.setDirty(false); + offsety.setDirty(false); + } + + else if ( !strcmp ( attrName, KLine ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + // This multi-value attribute has to be filled in this order: + // startx,starty,endx,endy,linelength + + if ( 5 != aAttr.getTargetValueCount()) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "CAlfLineVisualLayoutAttributeSetter" ); + } + float startx = this->floatOrInt( aAttr, 0 ); + float starty = this->floatOrInt( aAttr, 1 ); + float endx = this->floatOrInt( aAttr, 2 ); + float endy = this->floatOrInt( aAttr, 3 ); + float len = aAttr.realValue(4); + + TRAPD(err1, + curve->AppendLineL ( TAlfRealPoint(startx,starty), + TAlfRealPoint(endx,endy),len )) + throwIfErr(err1); + } + + else if ( !strcmp ( attrName, KArc ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + // This multi-value attribute has to be filled in this order: + // arcoriginx,arcoriginy,archorzradius,arcvertradius, + // arcstartangle,arcendangle,arclength + + if ( 7 != aAttr.getTargetValueCount()) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "CAlfLineVisualLayoutAttributeSetter" ); + } + + float originx = this->floatOrInt( aAttr, 0 ); + float originy = this->floatOrInt( aAttr, 1 ); + float horzradius = this->floatOrInt( aAttr, 2 ); + float vertradius = this->floatOrInt( aAttr, 3 ); + float startangle = aAttr.realValue(4); + float endangle = aAttr.realValue(5); + float len = aAttr.realValue(6); + TRAPD(err1, + curve->AppendArcL(TAlfRealPoint(originx,originy), + TAlfRealSize(horzradius,vertradius), + startangle, endangle, len)) + throwIfErr(err1); + } + + else + { + AlfCommonVisualAttributeSetter::handleStaticAttribute ( + aVisual, aAttr, aContainer); + } + } + + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfLineVisualAttributeSetter::handleDynamicDataAttribute ( + CAlfVisual& aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + CAlfLineVisual* lineVisual = dynamic_cast( &aVisual); + if ( !lineVisual ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ) + } + + const char* attrName = aAttr.name(); + + const char* dataField = aAttr.getDataField(); + + if ( !dataField ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter") + } + + if (!aData) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ) + } + + IAlfVariantType* data = aData->item ( UString(dataField) ); + + if (data) + { + const char* attrName = aAttr.name(); + + if ( !strcmp ( attrName, KOffsetX ) ) + { + AlfAttribute& offsety = aContainer.getAttributeByName ( + KOffsetY ); + //will throw if attribute is not found + + const char* offsetyDataField = offsety.getDataField(); + if ( !offsetyDataField ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ) + } + IAlfVariantType* offsetyData = + aData->item ( UString(offsetyDataField) ); + + if ( data->type() == IAlfVariantType::EReal && + offsetyData && + offsetyData->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? + //Is it not part of data as well? + TAlfTimedPoint offset; + offset.iX.SetTarget(data->real(), aAttr.getTime()); + offset.iX.SetStyle ( aAttr.getInterpolationStyle() ); + offset.iX.SetMappingFunctionIdentifier ( + aAttr.getMappingFunctionId()); + offset.iY.SetTarget(offsetyData->real(), offsety.getTime()); + offset.iY.SetStyle ( offsety.getInterpolationStyle() ); + offset.iY.SetMappingFunctionIdentifier ( + offsety.getMappingFunctionId()); + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + curve->SetOffset ( offset ); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KOffsetY ) ) + { + //Make sure X Attribute also exists, but do nothing. Actual values + //will be set in the iteration that checks for KOffsetX + aContainer.getAttributeByName ( KOffsetX ); + //will throw if attribute is not found + } + + else if ( !strcmp ( attrName, KThickness ) ) + { + if ( data->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? + // Is it not part of data as well? + // how is the source value stored in data? policy not clear + TAlfTimedValue tVal; + tVal.SetTarget(data->real(),(TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier ( + aAttr.getMappingFunctionId()); + lineVisual->SetThickness(tVal); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KShadowThickness ) ) + { + if ( data->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? + // Is it not part of data as well? + // how is the source value stored in data? policy not clear + TAlfTimedValue tVal; + tVal.SetTarget(data->real(),(TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier ( + aAttr.getMappingFunctionId()); + lineVisual->SetShadowThickness(tVal); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KStartPos ) ) + { + if ( data->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? + // Is it not part of data as well? + // how is the source value stored in data? policy not clear + TAlfTimedValue tVal; + tVal.SetTarget(data->real(),(TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier ( + aAttr.getMappingFunctionId()); + lineVisual->SetStartPos(tVal); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KEndPos ) ) + { + if ( data->type() == IAlfVariantType::EReal) + { + // The time value is in the attribute? + // Is it not part of data as well? + // how is the source value stored in data? policy not clear + TAlfTimedValue tVal; + tVal.SetTarget(data->real(),(TInt) aAttr.getTime()); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier ( + aAttr.getMappingFunctionId()); + lineVisual->SetEndPos(tVal); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else + { + AlfCommonVisualAttributeSetter::handleDynamicDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfLineVisualAttributeSetter::handleStaticDataAttribute ( + CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, + IAlfMap* aData ) + { + + CAlfLineVisual* lineVisual = dynamic_cast( &aVisual); + if ( !lineVisual ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ) + } + + const char* dataField = aAttr.getDataField(); + + if ( !dataField ) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ); + } + + if (!aData) + { + ALF_THROW ( AlfDataException, ECommonError, + "AlfLineVisualAttributeSetter" ); + } + + IAlfVariantType* data = aData->item (UString( dataField) ); + + const char* attrName = aAttr.name(); + + if ( data ) + { + if ( !strcmp ( attrName, KImagePath ) ) + { + if (data->type() == IAlfVariantType::EString) + { + + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + auto_ptr DesC; + TRAPD(err1, + DesC.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(src))); + throwIfErr(err1); + + if (DesC.get()) + { + CAlfTexture* texture = NULL; + TRAPD(err2,texture = &(aVisual.Env().TextureManager(). + LoadTextureL(*(DesC.get()), + EAlfTextureFlagDefault, + KAlfAutoGeneratedTextureId))); + throwIfErr(err2); + lineVisual->SetImage(TAlfImage(*texture)); + mImpl->mEnv = &aVisual.Env(); + mImpl->mLoadedTextures.resize( + mImpl->mLoadedTextures.count()+1); + mImpl->mLoadedTextures.insert( + mImpl->mLoadedTextures.count(), texture); + } + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KThickness ) ) + { + if (data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue val(data->real(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetThickness(val); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KShadowThickness ) ) + { + if (data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue val(data->real(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetShadowThickness(val); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KStartPos ) ) + { + if (data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue val(data->real(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetStartPos(val); + } + } + + else if ( !strcmp ( attrName, KEndPos ) ) + { + if (data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue val(data->real(),0); + //static attribute,apply with immidiate effect + + lineVisual->SetEndPos(val); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KAlphaMappingFunction ) ) + { + //assumption: + //The int value-mapping function mapping is the following: + //0 - KConstMappingFunction + //1 - duiuimodel::nodetypes::KLinearMappingFunction + //2 - KSineMappingFunction + //3 - KCosineMappingFunction + if (data->type() == IAlfVariantType::EContainer ) + { + IAlfContainer* dataContainer = data->container(); + MAlfMappingFunction* func = + this->getMappingFunctionFromContainer(dataContainer, + lineVisual->Env()); + + if (!func) + { + ALF_THROW ( AlfAttributeException, + EInvalidAttribute, "AlfLineVisualAttributeSetter") + } + + lineVisual->SetAlphaFunction(func); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KWidthMappingFunction ) ) + { + //assumption: + //The int value-mapping function mapping is the following: + //0 - KConstMappingFunction + //1 - duiuimodel::nodetypes::KLinearMappingFunction + //2 - KSineMappingFunction + //3 - KCosineMappingFunction + + if (data->type() == IAlfVariantType::EContainer ) + { + IAlfContainer* dataContainer = data->container(); + MAlfMappingFunction* func = + this->getMappingFunctionFromContainer(dataContainer, + lineVisual->Env()); + + if (!func) + { + ALF_THROW ( AlfAttributeException, + EInvalidAttribute, "AlfLineVisualAttributeSetter") + } + + lineVisual->SetWidthFunction(func); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KColor ) ) + { + if (data->type() == IAlfVariantType::EContainer ) + { + IAlfContainer* dataContainer = data->container(); + + if ( 4 != dataContainer -> count() ) + { + ALF_THROW ( AlfAttributeException,EIncompleteAttributeValues, "AlfLineVisualAttributeSetter") + } + + IAlfVariantType* red = dataContainer->item ( 0 );//red + + IAlfVariantType* green = dataContainer->item ( 1 );//green + + IAlfVariantType* blue = dataContainer->item ( 2 );//blue + + IAlfVariantType* alpha = dataContainer->item ( 3 );//alpha + + if ( red && IAlfVariantType::EReal == red->type() && + green && IAlfVariantType::EReal == green->type() && + blue && IAlfVariantType::EReal == blue->type() && + alpha && IAlfVariantType::EReal == alpha->type() ) + { + TRgb color ( red->real(), + green->real(), + blue->real(), + alpha->real() ); + + lineVisual->SetColor ( color ); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfLineVisualAttributeSetter" ) + } + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KEnableLoop ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + // if value is not bool, then use default parameter of EnableLoop + if ( data->type() != IAlfVariantType::EBool ) + { + curve->EnableLoop (); + } + + else + { + curve->EnableLoop ( data->boolean() ); + } + } + + else if ( !strcmp ( attrName, KOrigin ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + if ( data->type() == IAlfVariantType::EReal ) + { + float origin = data->real() ; + curve->SetOrigin ( origin ); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KOffsetX ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + AlfAttribute& offsety = aContainer.getAttributeByName ( + KOffsetY ); + + //will throw if attribute is not found + const char* offsetyDataField = offsety.getDataField(); + if ( !offsetyDataField ) + { + ALF_THROW ( AlfDataException, + ECommonError, "AlfLineVisualAttributeSetter" ) + } + + IAlfVariantType* offsetyData = + aData->item (UString( offsetyDataField ) ); + + if ( data->type() == IAlfVariantType::EReal && + offsetyData && + offsetyData->type() == IAlfVariantType::EReal) + { + TAlfTimedPoint offset( data->real(), offsetyData->real()); + curve->SetOffset ( offset ); + } + else + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfLineVisualtAttributeSetter"); + } + } + + else if ( !strcmp ( attrName, KOffsetY ) ) + { + //Make sure X Attribute also exists, but do nothing. + //Actual values will be set in the iteration that checks for + //KOffsetX + + aContainer.getAttributeByName ( KOffsetX ); + //will throw if attribute is not found + } + + else if ( !strcmp ( attrName, KLine ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + //if not a container, dont proceed + if (!(data->type() == IAlfVariantType::EContainer)) + { + return; + } + + IAlfContainer* container = data->container(); + //if all item are not present, throw + if (container->count() != 5) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfLineVisualAttributeSetter" ); + } + + IAlfVariantType* lineStartXvalue = container->item(0); + IAlfVariantType* lineStartYvalue = container->item(1); + IAlfVariantType* lineEndXvalue = container->item(2); + IAlfVariantType* lineEndYvalue = container->item(3); + IAlfVariantType* lineLengthvalue = container->item(4); + + float startx = this->floatOrIntFromData( lineStartXvalue); + float starty = this->floatOrIntFromData( lineStartYvalue); + float endx = this->floatOrIntFromData( lineEndXvalue ); + float endy = this->floatOrIntFromData( lineEndYvalue ); + float len = float(lineLengthvalue->real()); + TRAPD(err1, + curve->AppendLineL ( TAlfRealPoint(startx,starty), + TAlfRealPoint(endx,endy),len )) + throwIfErr(err1); + } + + else if ( !strcmp ( attrName, KArc ) ) + { + CAlfCurvePath* curve = this->getCurvePath(lineVisual); + + //if not a container, dont proceed + if (!(data->type() == IAlfVariantType::EContainer)) + { + return; + } + + IAlfContainer* container = data->container(); + + //if all item are not present, throw + if (container->count() != 7) + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, + "AlfLineVisualAttributeSetter" ); + } + + IAlfVariantType* arcOriginXValue = container->item(0); + IAlfVariantType* arcOriginYValue = container->item(1); + IAlfVariantType* archorzradiusValue = container->item(2); + IAlfVariantType* arcvertradiusValue = container->item(3); + IAlfVariantType* arcstartangleValue = container->item(4); + IAlfVariantType* arcendangleValue = container->item(5); + IAlfVariantType* arclengthValue = container->item(6); + + float originx = this->floatOrIntFromData( arcOriginXValue); + float originy = this->floatOrIntFromData( arcOriginYValue); + float horzradius = this->floatOrIntFromData( archorzradiusValue); + float vertradius = this->floatOrIntFromData( arcvertradiusValue); + float startangle = float(arcstartangleValue->real()); + float endangle = float(arcendangleValue->real()); + float len = float(arclengthValue->real()); + TRAPD(err1, + curve->AppendArcL(TAlfRealPoint(originx,originy), + TAlfRealSize(horzradius,vertradius), + startangle,endangle,len)) + + throwIfErr(err1); + } + + else + { + AlfCommonVisualAttributeSetter::handleStaticDataAttribute( + aVisual, aAttr, aContainer, aData ); + } + } + + } + + +// --------------------------------------------------------------------------- +// Creates and returns a toolkit defined mappping function based on the +// attribute contents +// assumption: +// The int value-mapping function mapping is the following: +// 0 - KConstMappingFunction +// 1 - duiuimodel::nodetypes::KLinearMappingFunction +// 2 - KSineMappingFunction +// 3 - KCosineMappingFunction +// --------------------------------------------------------------------------- +// +MAlfMappingFunction* AlfLineVisualAttributeSetter::getMappingFunction( + AlfAttribute& aAttribute, + CAlfEnv& aEnv) + { + MAlfMappingFunction* func=0; + int intValue = aAttribute.realValue(0); + + switch (intValue) + { + case 0: + { + if (aAttribute.getTargetValueCount() == 2) + { + TRAPD(err1,func = CAlfConstantMappingFunction::NewL(aEnv, + aAttribute.realValue(1))) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfConstantMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 1: + { + if (aAttribute.getTargetValueCount() == 3) + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv, + aAttribute.realValue(1), + aAttribute.realValue(2))) + throwIfErr(err1); + } + + else if (aAttribute.getTargetValueCount() == 2) + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv, + aAttribute.realValue(1))) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 2: + { + if (aAttribute.getTargetValueCount() == 3) + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv, + aAttribute.realValue(1), + aAttribute.realValue(2))) + throwIfErr(err1); + } + + else if (aAttribute.getTargetValueCount() == 2) + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv, + aAttribute.realValue(1))) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 3: + { + if (aAttribute.getTargetValueCount() == 3) + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv, + aAttribute.realValue(1), + aAttribute.realValue(2))) + throwIfErr(err1); + } + + else if (aAttribute.getTargetValueCount() == 2) + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv, + aAttribute.realValue(1))) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + default: + break; + + } + + return func; + } + + +// --------------------------------------------------------------------------- +// Creates and returns a toolkit defined mappping function based on the +// container contents +// assumption: +// The int value-mapping function mapping is the following: +// 0 - KConstMappingFunction +// 1 - duiuimodel::nodetypes::KLinearMappingFunction +// 2 - KSineMappingFunction +// 3 - KCosineMappingFunction +// --------------------------------------------------------------------------- +// +MAlfMappingFunction* AlfLineVisualAttributeSetter:: + getMappingFunctionFromContainer(IAlfContainer* aContainer, CAlfEnv& aEnv) + { + MAlfMappingFunction* func=0; + + if (IAlfVariantType::EInt != aContainer->item(0)->type()) + { + return func; + } + + switch (aContainer->item(0)->integer()) + { + case 0: + { + if (aContainer -> count() == 2) + { + TRAPD(err1,func = CAlfConstantMappingFunction::NewL(aEnv, + aContainer->item(1)->real())) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfConstantMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 1: + { + if (aContainer -> count() == 3) + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv, + aContainer->item(1)->real(), + aContainer->item(2)->real())) + throwIfErr(err1); + } + + else if (aContainer -> count() == 2) + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv, + aContainer->item(1)->real())) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfLinearMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 2: + { + if (aContainer -> count() == 3) + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv, + aContainer->item(1)->real(), + aContainer->item(2)->real())) + throwIfErr(err1); + } + + else if (aContainer -> count() == 2) + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv, + aContainer->item(1)->real())) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfSineMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + case 3: + { + if (aContainer -> count() == 3) + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv, + aContainer->item(1)->real(), + aContainer->item(2)->real())) + throwIfErr(err1); + } + + else if (aContainer -> count() == 2) + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv, + aContainer->item(1)->real())) + throwIfErr(err1); + } + + else + { + TRAPD(err1,func = CAlfCosineMappingFunction::NewL(aEnv)) + throwIfErr(err1); + } + } + break; + + default: + break; + + } + + return func; + } + + +// --------------------------------------------------------------------------- +// If the line visual already has a path set to it, it is retrived. +// Else a new instance is created +// --------------------------------------------------------------------------- +// +CAlfCurvePath* AlfLineVisualAttributeSetter::getCurvePath( + CAlfLineVisual* aLineVisual) + { + CAlfCurvePath* curve = 0; + if(aLineVisual) + { + curve = aLineVisual->Path(); + + if (!curve) + { + TRAPD(err1,curve = CAlfCurvePath::NewL(aLineVisual->Env())) + throwIfErr(err1); + + aLineVisual->SetPath( curve, EAlfHasOwnership); + } + } + return curve; + } + +// --------------------------------------------------------------------------- +// Check if data in the attribute is int or float. +// Return the value as a float value +// --------------------------------------------------------------------------- +// +float AlfLineVisualAttributeSetter::floatOrInt( + const AlfAttribute& aAttr, + int aIndex) + { + if (aAttr.type(aIndex) == AlfAttributeValueType::EInt) + { + return float(aAttr.intValue(aIndex)); + } + else if (aAttr.type(aIndex) == AlfAttributeValueType::EFloat) + { + return aAttr.realValue(aIndex); //will throw an exception i + } + else + { + ALF_THROW ( AlfAttributeException, ECommonError, + "AlfLineVisualAttributeSetter" ); + } + } + +// --------------------------------------------------------------------------- +// Check if data in the variant type is int or float. +// Return the value as a float value +// --------------------------------------------------------------------------- +// +float AlfLineVisualAttributeSetter::floatOrIntFromData(IAlfVariantType* aData) + { + if (IAlfVariantType::EInt == aData->type()) + { + return float(aData->integer()); + } + else if (IAlfVariantType::EReal == aData->type()) + { + return aData->real();; //will throw an exception i + } + else + { + ALF_THROW ( AlfAttributeException, ECommonError, + "AlfLineVisualAttributeSetter" ); + } + } + + }// namespace Alf +// End of file + + + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfmeshvisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfmeshvisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,537 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for MeshVisual. +* +*/ + + + +#include "alf/alfattribute.h" +#include "alf/alfmeshvisualattributesetter.h" +#include "alf/alfattributevaluetype.h" +#include +#include +#include +#include "alf/alfattributecontainer.h" +#include +#include +#include "alf/attrproperty.h" +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include +#include +#include + + +using namespace osncore; + +using namespace duiuimodel::meshvisualattributes; +using namespace duiuimodel::commonvisualattributes; + +namespace Alf + { + +class AlfMeshVisualAttributeSetterImpl + { +public: + AlfMeshVisualAttributeSetterImpl(); + ~AlfMeshVisualAttributeSetterImpl(); +public: + //Keep track of loaded texture for imagevisuals. + //Texture manager doesn't unload the texture from memory untill Env is deleted. + //Hence need to unload them once attribute setter is deleted. + AlfPtrVector mLoadedTextures; + //Env needed to access TextureManager while unloading textures. + CAlfEnv* mEnv; + }; + +AlfMeshVisualAttributeSetterImpl::AlfMeshVisualAttributeSetterImpl() + { + //Do not delete textures here as they may be in use by the visuals that have not been deleted. + mEnv = CAlfEnv::Static(); + mLoadedTextures.setAutoDelete(false); + } + +AlfMeshVisualAttributeSetterImpl::~AlfMeshVisualAttributeSetterImpl() + { + //Unload all loaded textures created by this attributesetter to free up the memory. + for (int i =0;iTextureManager().UnloadTexture(Texture->Id()); + } + mLoadedTextures.clear(); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfMeshVisualAttributeSetter::AlfMeshVisualAttributeSetter() + { + mImpl.reset(new (EMM) AlfMeshVisualAttributeSetterImpl()); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfMeshVisualAttributeSetter::~AlfMeshVisualAttributeSetter() + { + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +IAlfVariantType* AlfMeshVisualAttributeSetter::getData(AlfAttribute& aAttr, IAlfMap* aData) + { + IAlfVariantType* data = 0; + const char* dataField = aAttr.getDataField(); + if (dataField) + { + data = aData->item(UString(dataField)); + } + return data; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +int AlfMeshVisualAttributeSetter::getTime(const AlfAttribute& aAttr, bool aImmediate) + { + int time = 0; + if (!aImmediate) + { + time = aAttr.getTime(); + } + + return time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// + +void AlfMeshVisualAttributeSetter::handleDynamicDataAttribute(CAlfVisual & aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData) + { + if (!doHandleDynamicDataAttribute(aVisual, aAttr, aContainer, aData)) + { + AlfCommonVisualAttributeSetter::handleDynamicDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfMeshVisualAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + CAlfMeshVisual* meshVisual = dynamic_cast(&aVisual); + if (!meshVisual) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfMeshVisualAttributeSetter" ) + } + if (!aData) ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfMeshVisualAttributeSetter" ) + + const char* dataField = aAttr.getDataField(); + if ( !dataField ) ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfMeshVisualAttributeSetter" ) + + IAlfVariantType* data = aData->item ( UString(dataField)); + + const char* attrName = aAttr.name(); + + if (data) + { + if (!strcmp(attrName,KMeshType)) + { + if (data->type() == IAlfVariantType::EInt) + { + int val = data->integer(); + TRAPD(err,meshVisual->CreateMeshL(val)); + if (err!=KErrNone) + { + ALF_THROW ( AlfDataException, err, "AlfMeshVisualAttributeSetter") + } + } + } + else if (!strcmp(attrName, KImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + + HandleImagePathAttribute( src, meshVisual, primary ); + } + } + else if (!strcmp(attrName,KSecondaryImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + + HandleImagePathAttribute( src, meshVisual, secondary ); + } + } + else if (!strcmp(attrName,KSpecularImagePath)) + { + if (data->type() == IAlfVariantType::EString) + { + TPtrC8 src; + src.Set((TUint8*)data->string().getUtf8()); + + HandleImagePathAttribute( src, meshVisual, specular ); + } + } + else + { + //check, if dynamic attribute(but set by user as static), if so, set attributes immediately. + //If not, the function will call baseclass SetAttributeValue. + if (!doHandleDynamicDataAttribute(aVisual, aAttr, aContainer, aData, true)) + { + AlfCommonVisualAttributeSetter::handleStaticDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfMeshVisualAttributeSetter::handleDynamicAttribute(CAlfVisual &aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer)) + { + AlfCommonVisualAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfMeshVisualAttributeSetter::handleStaticAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer) + { + CAlfMeshVisual* meshVisual = dynamic_cast(&aVisual); + if(!meshVisual) + { + return; + } + const char* attrName = aAttr.name(); + + // meshVisual attributes + if (!strcmp(attrName,KMeshType)) + { + int val = aAttr.intValue(); + TRAPD(err,meshVisual->CreateMeshL(val)); + if (err!=KErrNone) + { + ALF_THROW(AlfDataException, err, "AlfMeshVisualAttributeSetter"); + } + } + else if (!strcmp(attrName,KImagePath)) + { + TPtrC8 src((TUint8*)aAttr.stringValue().getUtf8()); + HandleImagePathAttribute( src, meshVisual, primary ); + } + else if (!strcmp(attrName,KSecondaryImagePath)) + { + TPtrC8 src((TUint8*)aAttr.stringValue().getUtf8()); + HandleImagePathAttribute( src, meshVisual, secondary ); + } + else if (!strcmp(attrName,KSpecularImagePath)) + { + TPtrC8 src((TUint8*)aAttr.stringValue().getUtf8()); + HandleImagePathAttribute( src, meshVisual, specular ); + } + else + { + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer, true)) + { + AlfCommonVisualAttributeSetter::handleStaticAttribute(aVisual, aAttr, aContainer); + } + } + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMeshVisualAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData) + { + CAlfMeshVisual* meshVisual = dynamic_cast(&aVisual); + if (!meshVisual) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfMeshVisualAttributeSetter") + } + + AlfCommonVisualAttributeSetter::setAttributeValue( + aVisual, aContainer, aData); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfMeshVisualAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMeshVisualAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + + // Call the base class implementation.It goes through its loop and checks if there are attributes + // that it handles. + AlfCommonVisualAttributeSetter::createAndSendCommands( + aVisual, + aContainer, + aRefVisual ); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// + +bool AlfMeshVisualAttributeSetter::doHandleDynamicDataAttribute(CAlfVisual & aVisual, + AlfAttribute& aAttr, AlfAttributeContainer& /*aContainer*/, IAlfMap* aData, bool aImmediate) + { + bool handled = true; + + if (!aData) + { + ALF_THROW ( AlfDataException, EInvalidVariantDataType, "AlfMeshVisualAttributeSetter" ) + } + else + { + CAlfMeshVisual* meshVisual = dynamic_cast(&aVisual); + if(!meshVisual) + { + return false; + } + const char* attrName = aAttr.name(); + + if ( !strcmp( attrName, KSecondaryAlpha ) ) + { + const IAlfVariantType* data = getData(aAttr, aData); + if (data && data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue tVal(data->real(), getTime(aAttr, aImmediate)); + tVal.SetStyle(aAttr.getInterpolationStyle()); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetSecondaryAlpha( tVal ); + } + } + else if ( !strcmp( attrName, KYawAngle ) ) + { + const IAlfVariantType* data = getData(aAttr, aData); + if (data && data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue tVal(data->real(), getTime(aAttr, aImmediate)); + tVal.SetStyle(aAttr.getInterpolationStyle()); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetYawAngle( tVal ); + } + } + else if ( !strcmp( attrName, KPitchAngle ) ) + { + const IAlfVariantType* data = getData(aAttr, aData); + if (data && data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue tVal(data->real(), getTime(aAttr, aImmediate)); + tVal.SetStyle(aAttr.getInterpolationStyle()); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetPitchAngle( tVal ); + } + } + else if ( !strcmp( attrName, KScale ) ) + { + const IAlfVariantType* data = getData(aAttr, aData); + if (data && data->type() == IAlfVariantType::EReal) + { + TAlfTimedValue tVal(data->real(), getTime(aAttr, aImmediate)); + tVal.SetStyle(aAttr.getInterpolationStyle()); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetScale( tVal ); + } + } + else + { + handled = false; + } + } + + return handled; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +bool AlfMeshVisualAttributeSetter::doHandleDynamicAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& /*aContainer*/, bool aImmediate) + { + CAlfMeshVisual* meshVisual = dynamic_cast(&aVisual); + if(!meshVisual) + { + return false; + } + + const char* attrName = aAttr.name(); + bool handled = true; + + // KSecondaryAlpha + if (!strcmp(attrName, KSecondaryAlpha)) + { + TAlfTimedValue tVal(aAttr.getSourceValue()->realValue()); + tVal.SetTarget(aAttr.getTargetValue()->realValue(),getTime(aAttr, aImmediate)); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetSecondaryAlpha( tVal ); + } + //KYawAngle + else if (!strcmp(attrName, KYawAngle)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(),getTime(aAttr, aImmediate)); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetYawAngle( tVal ); + } + //KPitchAngle + else if (!strcmp(attrName, KPitchAngle)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(),getTime(aAttr, aImmediate)); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId() ); + meshVisual->SetPitchAngle( tVal ); + } + //KScale + else if (!strcmp(attrName,KScale)) + { + TAlfTimedValue tVal((TReal32)aAttr.getSourceValue()->realValue()); + tVal.SetTarget((TReal32)aAttr.getTargetValue()->realValue(),getTime(aAttr, aImmediate)); + tVal.SetStyle( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier( aAttr.getMappingFunctionId()); + meshVisual->SetScale( tVal ); + } + else // Call the base class implementation also. + //It goes through the same loop again and checks if there are attributes that it handles. + { + handled = false; + } + + return handled; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void AlfMeshVisualAttributeSetter::HandleImagePathAttribute( + const TPtrC8& aStringValue, + CAlfMeshVisual* aVisual, + imageCategory aImageCategory ) + { + auto_ptr DesC; + TRAPD( err, DesC.reset(CnvUtfConverter::ConvertToUnicodeFromUtf8L(aStringValue))); + if ( err != KErrNone ) + { + ALF_THROW( AlfDataException, err, "AlfMeshVisualAttributeSetter" ); + } + + // check if the texture is already loaded + const TInt existingTextureId = aVisual->Env().TextureManager().TextureId(*(DesC.get())); + if ( existingTextureId != KErrNotFound ) + { + const CAlfTexture* texture = aVisual->Env().TextureManager().Texture( existingTextureId ); + + if ( aImageCategory == primary ) + { + aVisual->SetImage(TAlfImage(*texture)); + } + else if ( aImageCategory == secondary ) + { + aVisual->SetSecondaryImage(TAlfImage(*texture)); + } + else // specular image + { + aVisual->SetSpecularImage(TAlfImage(*texture)); + } + } + else + { + mImpl->mLoadedTextures.resize(mImpl->mLoadedTextures.count()+1); + + CAlfTexture* texture = NULL; + TRAP( err, texture = &(aVisual->Env().TextureManager().LoadTextureL( + *(DesC.get()), EAlfTextureFlagDefault, KAlfAutoGeneratedTextureId))); + + if ( err != KErrNone ) + { + ALF_THROW( AlfDataException, err, "AlfMeshVisualAttributeSetter" ); + } + + // This cannot fail because the array has already been resized + mImpl->mLoadedTextures.insert(mImpl->mLoadedTextures.count(),texture); + + if ( aImageCategory == primary ) + { + aVisual->SetImage(TAlfImage(*texture)); + } + else if ( aImageCategory == secondary ) + { + aVisual->SetSecondaryImage(TAlfImage(*texture)); + } + else // specular image + { + aVisual->SetSpecularImage(TAlfImage(*texture)); + } + } + } + + + }// Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfmodel.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,487 @@ +/* +* Copyright (c) 2006 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: Model Class used by widgets. +* +*/ + + + + +//INCLUDES +#include +#include +#include + +#include +#include "alf/alfmodeloperation.h" +#include +#include +//#include "alf/alfperf.h" +#include + +using osncore::AlfPtrVector; +using std::auto_ptr; + +// Forward declared inside the Alf namespace +namespace Alf + { + + +class AlfModelImpl + { +public : + AlfModelImpl():mDataSource(0) + { + } + + ~AlfModelImpl() + { + delete mDataSource; + mObserverArray.clear(); + } + + /** + * Array of Observers for the Model individual observers not owned + */ + AlfPtrVector mObserverArray; + + /** + * Data Source for the Model owned + */ + IAlfVariantType* mDataSource; + }; + + +////////////////////// AlfModel ////////////////////// + +// ============================ MEMBER FUNCTIONS ============================== + + +// --------------------------------------------------------------------------- +// Description : Constructor - +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfModel::AlfModel() + { + } + +// --------------------------------------------------------------------------- +// Description : Constructor - +// Data Source for the model is passed +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfModel::AlfModel( IAlfVariantType* aDataSource ) + { + mData.reset( new(EMM) AlfModelImpl() ); + mData->mDataSource = aDataSource; + mData->mObserverArray.setAutoDelete(false); + } + +// --------------------------------------------------------------------------- +// Description : Class Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfModel::~AlfModel() + { + } + +// --------------------------------------------------------------------------- +// Description : Adds model change observers +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfModel::addModelChangeObserver( + IAlfModelChangeObserver& aObserver) + { + if(mData->mObserverArray.findRef(&aObserver)<0) + { + mData->mObserverArray.resize(mData->mObserverArray.count()+1); + mData->mObserverArray.insert(mData->mObserverArray.count(), + &aObserver); + aObserver.modelChanged( *this ); + } + } + + + +// --------------------------------------------------------------------------- +// Description : Removes model change observers +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfModel::removeModelChangeObserver( + IAlfModelChangeObserver& aObserver) + { + for ( int i = 0; i < mData->mObserverArray.count(); ++i ) + { + if(mData->mObserverArray[i]==&aObserver) + { + mData->mObserverArray.remove( i ); + return; + } + } + } + + +// --------------------------------------------------------------------------- +// Description : Sets the data for the model +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfModel::setData(IAlfVariantType* aData) + { + if( mData->mDataSource != 0 ) + { + delete mData->mDataSource; + mData->mDataSource=0; + } + mData->mDataSource = aData; + + for ( int i = 0; i < mData->mObserverArray.count(); ++i ) + { + mData->mObserverArray[i]->modelChanged( *this ); + } + } + +// --------------------------------------------------------------------------- +// Description : Returns the Data Source +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* AlfModel::data() const + { + return mData->mDataSource; + } + +// --------------------------------------------------------------------------- +// Description : notifies, that the model is changed. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfModel::notifyModelChanged() + { + //Notify all the observers + for ( int i = 0; i < mData->mObserverArray.count(); ++i ) + { + mData->mObserverArray[i]->modelChanged(*this); + } + } + +// --------------------------------------------------------------------------- +// Description : Clears the Data Source +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfModel::clearModel() + { + //Delete the Model + if( mData->mDataSource != 0 ) + { + delete mData->mDataSource; + mData->mDataSource=0; + } + //Notify all the observers + for ( int i = 0; i < mData->mObserverArray.count(); ++i ) + { + mData->mObserverArray[i]->modelChanged(*this); + } + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Static getter for interfaces provided by the widget, +// the control, or the model. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfModel::makeInterface( const IfId& aType) + { + UString param(aType.mImplementationId); + if ( param == IAlfModel::type().mImplementationId ) + { + return this; + } + return 0; + } + +//---------------------------------------------------------------------------- +//Add a number of data fields in the model data. All model change +//observers are notified about the change. Internal API not exported +//----------------------------------------------------------------------------- +void AlfModel::addData(AlfModelOperation* aAddOperation) + { + IAlfVariantType* newData = 0; + IAlfVariantType* parentData = 0; + try + { + //ALF_PERF_START( perfdata, "AlfModel-AddData-Adding") + newData = aAddOperation->getNewData(); + parentData = aAddOperation->parentData(*data()); + int index = aAddOperation->index(); + + if(parentData->type()== IAlfVariantType::EBranch && + newData->type() == IAlfVariantType::EMap ) + { + // This is actually the same as updating the data, + // since we can not have multiple branch or child data maps + if ( index == 0 ) + { + // Set data for the branch + parentData->branch()->setData( newData->map() ); + } + else if ( index == 1 ) + { + // Set data for the branch children + parentData->branch()->setChildData( newData->map() ); + } + } + else if(parentData->type()== IAlfVariantType::EMap) + { + parentData->map()->addItem( newData, + aAddOperation->newDataName() ); + } + else if(parentData->type()== IAlfVariantType::EContainer ) + { + parentData->container()->addItem(index, newData); + } + //ALF_PERF_STOP( perfdata, "AlfModel-AddData-Adding") + } + catch(AlfDataException& e) + { + newData = 0; + parentData = 0; + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModel") + // Note the aAddOperation is not deleted. In case of exception the user + // should delete this object + } + } + +//----------------------------------------------------------------------------- +//Remove a number of data fields in the model data. All model change +//observers are notified about the change. +//----------------------------------------------------------------------------- +void AlfModel::removeData(AlfModelOperation* aRemoveOperation) + { + IAlfVariantType* parentData = 0; + + try + { + //ALF_PERF_START( perfdata, "AlfModel-RemoveData-Removing") + parentData = aRemoveOperation->parentData(*data()); + int index = aRemoveOperation->index(); + + if(parentData->type()== IAlfVariantType::EBranch ) + { + if ( index == 0 ) + { + // Remove the branch data + parentData->branch()->setData( 0 ); + } + else if ( index == 1 ) + { + // Remove the branch children data + parentData->branch()->setChildData( 0 ); + } + } + else if(parentData->type()== IAlfVariantType::EMap) + { + parentData->map()->removeItem(index); + } + else if(parentData->type()== IAlfVariantType::EContainer ) + { + parentData->container()->removeItem(index); + } + //ALF_PERF_STOP( perfdata, "AlfModel-RemoveData-Removing") + } + catch(AlfDataException& e) + { + parentData = 0; + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModel") + // Note the aRemoveOperation is not deleted. In case of exception the + // user should delete this object + } + } + + +void AlfModel::updateData(AlfModelOperation* aUpdateOperation) + { + IAlfVariantType* newData = 0; + IAlfVariantType* parentData = 0; + + try + { + //ALF_PERF_START( perfdata, "AlfModel-UpdateData-Updating") + newData= aUpdateOperation->getNewData(); + + parentData = aUpdateOperation->parentData(*data()); + int index = aUpdateOperation->index(); + + if(parentData->type()== IAlfVariantType::EBranch && + newData->type() == IAlfVariantType::EMap ) + { + if ( index == 0 ) + { + // Update the branch data + parentData->branch()->setData( newData->map() ); + } + else if ( index == 1 ) + { + // Update the data for the branch children + parentData->branch()->setChildData( newData->map() ); + } + } + else if(parentData->type()== IAlfVariantType::EMap) + { + parentData->map()->replaceItem(index, newData); + } + else if(parentData->type()== IAlfVariantType::EContainer ) + { + parentData->container()->replaceItem(index,newData); + } + //ALF_PERF_STOP( perfdata, "AlfModel-UpdateData-Updating") + } + catch(AlfDataException& e) + { + parentData=0; + newData=0; + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModel") + //Note the aUpdateOperation is not deleted. In case of exception the user should delete this object + } + } + +//---------------------------------------------------------------------------- +//Add a number of data fields in the model data. All model change +//observers are notified about the change. +//----------------------------------------------------------------------------- +OSN_EXPORT void AlfModel::addData( + int aNumContainerIndices, int* aContainerIndices, IAlfVariantType* aData) + { + auto_ptr op( AlfModelOperation::create( + AlfModelOperation::EOperationAdd, + aNumContainerIndices, + aContainerIndices, + aData ) ); + + executeOperation( op.get() ); + } + +//----------------------------------------------------------------------------- +//Remove a number of data fields in the model data. All model change +//observers are notified about the change. +//----------------------------------------------------------------------------- +OSN_EXPORT void AlfModel::removeData( + int aNumContainerIndices, int* aContainerIndices) + { + auto_ptr op( AlfModelOperation::create( + AlfModelOperation::EOperationRemove, + aNumContainerIndices, + aContainerIndices ) ); + + executeOperation( op.get() ); + } + +//----------------------------------------------------------------------------- +//Remove a number of data fields in the model data. All model change +//observers are notified about the change. +//----------------------------------------------------------------------------- +OSN_EXPORT void AlfModel::updateData( + int aNumContainerIndices, int* aContainerIndices, IAlfVariantType* aData) + { + auto_ptr op( AlfModelOperation::create( + AlfModelOperation::EOperationUpdate, + aNumContainerIndices, + aContainerIndices, + aData ) ); + + executeOperation( op.get() ); + } + +//----------------------------------------------------------------------------- + /** + * Api for executing batch operations + * + * @param aOperationsArray - An RPOinterArray containing the list of + * operations to be executed in batch. + * @since S60 ?S60_version + */ +//----------------------------------------------------------------------------- +OSN_EXPORT void AlfModel::executeOperations( + AlfPtrVector& aOperationsArray) + { + int index = 0; + int count = aOperationsArray.count(); + int obsvrCount = mData->mObserverArray.count(); + AlfModelOperation* tempOperation=0; + + for ( index = 0; index < obsvrCount; index++ ) + { + mData->mObserverArray[index]->dataChanging( aOperationsArray ); + } + + for ( index = 0; index < count; index++ ) + { + tempOperation = aOperationsArray[index]; + switch( tempOperation->operation() ) + { + case AlfModelOperation::EOperationAdd: + this->addData( tempOperation ); + break; + case AlfModelOperation::EOperationRemove: + this->removeData( tempOperation ); + break; + case AlfModelOperation::EOperationUpdate: + this->updateData( tempOperation ); + default: + break; + + } + } + + for ( index = 0; index < obsvrCount; index++ ) + { + mData->mObserverArray[index]->dataChanged(); + } + } + +//----------------------------------------------------------------------------- + /** + * Api for executing one operation at a Time + * + * @param aOperation - An Operation to be executed on the model. + * @since S60 ?S60_version + */ +//----------------------------------------------------------------------------- +OSN_EXPORT void AlfModel::executeOperation(AlfModelOperation* aOperation) + { + int index = 0; + int obsvrCount = mData->mObserverArray.count(); + + for ( index = 0; index < obsvrCount; index++ ) + { + mData->mObserverArray[index]->dataChanging( *aOperation ); + } + + switch(aOperation->operation()) + { + case AlfModelOperation::EOperationAdd: + this->addData(aOperation); + break; + case AlfModelOperation::EOperationRemove: + this->removeData(aOperation); + break; + case AlfModelOperation::EOperationUpdate: + this->updateData(aOperation); + default: + break; + } + + for ( index = 0; index < obsvrCount; index++ ) + { + mData->mObserverArray[index]->dataChanged(); + } + } +} // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfmodeloperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfmodeloperation.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 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: This file implements the various types of operations to be performed on model. +* +*/ + + + + +//INCLUDES +#include "alf/alfmodeloperation.h" +#include +#include +#include + +using namespace Alf; + + +OSN_EXPORT AlfModelOperation* AlfModelOperation::create( + OperationType aOperation, int aNumContainerIndices, + int* aContainerIndices, IAlfVariantType* aData ) + { + return new( EMM ) AlfModelOperation( + aOperation, aNumContainerIndices, aContainerIndices, aData ); + } + + +OSN_EXPORT AlfModelOperation* AlfModelOperation::create( OperationType aOperation, int aNumContainerIndices, + int* aContainerIndices, IAlfVariantType* aData, + const UString& aDataName ) + { + return new( EMM ) AlfModelOperation( + aOperation, aNumContainerIndices, aContainerIndices, aData, aDataName ); + } + +AlfModelOperation::AlfModelOperation( + OperationType aOperation, int aNumContainerIndices, + int* aContainerIndices, IAlfVariantType* aData ) + { + mOperation = aOperation ; + mNumContainerIndices = aNumContainerIndices; + mContainerIndices = aContainerIndices ; + mData = aData; + } + + +AlfModelOperation::AlfModelOperation( OperationType aOperation, int aNumContainerIndices, + int* aContainerIndices, IAlfVariantType* aData, + const UString& aDataName ) + { + mOperation = aOperation ; + mNumContainerIndices = aNumContainerIndices; + mContainerIndices = aContainerIndices ; + mDataName = aDataName; + mData = aData; + } + + +OSN_EXPORT AlfModelOperation::~AlfModelOperation() + { + delete mData; + delete [] mContainerIndices; + } + +OSN_EXPORT IAlfVariantType& AlfModelOperation::newData() const + { + if(mOperation == EOperationRemove) + { + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModelOperation") + } + return *mData; + } + +OSN_EXPORT const UString& AlfModelOperation::newDataName() const + { + if(mOperation == EOperationRemove) + { + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModelOperation") + } + return mDataName; + } + +OSN_EXPORT IAlfVariantType* AlfModelOperation::getNewData() + { + if(mOperation == EOperationRemove) + { + ALF_THROW(AlfDataException,EInvalidModelOperation,"AlfModelOperation") + } + IAlfVariantType* data = mData; + mData = NULL; + return data; + } + +OSN_EXPORT AlfModelOperation::OperationType AlfModelOperation::operation() const + { + return mOperation; + } + + +OSN_EXPORT IAlfVariantType* AlfModelOperation::parentData( IAlfVariantType& aRoot ) const + { + try + { + if ( mNumContainerIndices == 0 ) + { + return NULL; + } + IAlfVariantType* current = &aRoot; + for ( int i = 0; current && i < mNumContainerIndices - 1; ++i ) + { + if ( current->type() == IAlfVariantType::EContainer && + mContainerIndices[i] < current->container()->count() ) + { + current = current->container()->item( mContainerIndices[i] ); + } + else if ( current->type() == IAlfVariantType::EMap && + mContainerIndices[i] < current->map()->count() ) + { + current = current->map()->item( mContainerIndices[i] ); + } + else if ( current->type() == IAlfVariantType::EBranch ) + { + if ( mContainerIndices[i] == 0 ) + { + // Index 0 is for the parent data + current = current->branch()->data(); + } + else if ( mContainerIndices[i] == 1 ) + { + // Index 1 is for the child data + current = current->branch()->childData(); + } + } + else + { + // Not found + return NULL; + } + } + return current; + } + catch(AlfDataException& aException) + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfModelOperation") + } + } + +OSN_EXPORT int AlfModelOperation::index() const + { + return mContainerIndices[mNumContainerIndices - 1]; + } + +OSN_EXPORT int AlfModelOperation::numContainerIndices() const + { + return mNumContainerIndices; + } + +OSN_EXPORT int AlfModelOperation::containerIndex( int aIndex ) const + { + return mContainerIndices[aIndex]; + } + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfrealvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfrealvalue.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2007 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: Real Value for attribute Value type. +* +*/ + + +#include +#include "alfrealvalue.h" + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfRealValue::AlfRealValue(float aValue, TAlfUnit aUnit) + { + mReal = aValue; + mUnit = aUnit; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfRealValue::~AlfRealValue() + { + + } + +// --------------------------------------------------------------------------- +// Gets the real value. +// --------------------------------------------------------------------------- +// +float AlfRealValue::realValue() const + { + return mReal; + } + +// --------------------------------------------------------------------------- +// Gets the type of the atrribute value. +// --------------------------------------------------------------------------- +// +AlfAttributeValueType::Type AlfRealValue::type() const + { + return EFloat; + } + +// --------------------------------------------------------------------------- +// Gets the unit. +// --------------------------------------------------------------------------- +// +TAlfUnit AlfRealValue::unit() const + { + return mUnit; + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfrecyclinggridelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfrecyclinggridelement.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2007 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: The implementation for grid element with recycling of visuals supported. +* +*/ + +#include "alf/alfrecyclinggridelement.h" +#include "alfrecyclinggridelementimpl.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include "alf/ialfvisualtemplate.h" +#include +#include +#include +#include +#include +#include + +using namespace osncore; + +namespace Alf + { + +//---------------------------------------------------------------- +// 1st phase Constructor. Leaves the newly created object +// on the cleanup stack +//---------------------------------------------------------------- +OSN_EXPORT AlfRecyclingGridElement::AlfRecyclingGridElement( + CAlfWidgetControl& aControl, + const char* aName, + int aNumColumns, + int aNumRows) + { + construct(aControl,aName); + + mImpl.reset( new( EMM ) AlfRecyclingGridElementImpl( + *this, aNumColumns, aNumRows ) ); + + control().addEventHandler(this); + } + +//---------------------------------------------------------------- +// Class Destructor +//---------------------------------------------------------------- +OSN_EXPORT AlfRecyclingGridElement::~AlfRecyclingGridElement() + { + control().removeEventHandler(*this); + } + +//---------------------------------------------------------------- +// Sets the fill style for the Recycle grid element +//---------------------------------------------------------------- +OSN_EXPORT void AlfRecyclingGridElement::setFillStyle(FillStyle aFillStyle, int aFillStyleParam) + { + mImpl->setFillStyle( aFillStyle, aFillStyleParam ); + } + + +OSN_EXPORT void AlfRecyclingGridElement::setAnimationTimes( + int aScrollingTime, int aFadeInTime, int aFadeInDelay, + int aFadeOutTime, int aFadeOutDelay ) + { + mImpl->setAnimationTimes( + aScrollingTime, aFadeInTime, aFadeInDelay, + aFadeOutTime, aFadeOutDelay ); + } + + +OSN_EXPORT CAlfVisual* AlfRecyclingGridElement::createVisualTree( + IAlfVariantType& aData, uint aDataID, CAlfLayout* aParentLayout, int aLayoutIndex ) + { + return mImpl->createVisualTree( + aData, aDataID, aParentLayout, aLayoutIndex ); + } + +// --------------------------------------------------------------------------- +// OfferEventL - Handle the Event. +// ?implementation_description +// --------------------------------------------------------------------------- +OSN_EXPORT AlfEventStatus AlfRecyclingGridElement::offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) + { + return mImpl->offerEvent( aControl, aEvent ) + ?EEventHandled:EEventNotHandled; + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfRecyclingGridElement::setActiveStates( unsigned int aStates ) + { + mImpl->setActiveStates( aStates ); + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// sets event handler data. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfRecyclingGridElement::setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ) + { + mImpl->setEventHandlerData(aData); + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// returns the eventhandlertype . +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType AlfRecyclingGridElement::eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// returns eventhandler excecutionphase. +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfRecyclingGridElement::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } +// returns event handler data. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidgetEventHandlerInitData* AlfRecyclingGridElement::eventHandlerData() + { + return mImpl->eventHandlerData(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfRecyclingGridElement::makeInterface( const IfId& aType ) + { + IAlfInterfaceBase* ret(0); + UString param(aType.mImplementationId); + + if (param == AlfRecyclingGridElement::type().mImplementationId ) + { + ret = static_cast(this); + } + else if (param == IAlfWidgetEventHandler::type().mImplementationId ) + { + ret = static_cast(this); + } + else + { + ret = AlfElement::makeInterface(aType); + } + return ret; + } + + +OSN_EXPORT bool AlfRecyclingGridElement::accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const + { + return mImpl->accept( aControl, aEvent ); + } + +OSN_EXPORT void AlfRecyclingGridElement::createChildVisualTree( + IAlfElement* aElement, IAlfVariantType& aChildData, + IAlfBranch& aData, int aIndex, uint aDataID ) + { + mImpl->createChildVisualTree( aElement, aChildData, aData, aIndex, aDataID ); + } + +OSN_EXPORT void AlfRecyclingGridElement::removeChildVisualTree( + IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ) + { + mImpl->removeChildVisualTree( aElement, aData, aIndex, aDataID ); + } + +// --------------------------------------------------------------------------- +// Description: Do not destroy visuals, because it's done elsewhere. +// --------------------------------------------------------------------------- +void AlfRecyclingGridElement::removeAndDestroyVisuals( int aTimeMilliseconds ) + { + mImpl->removeAndDestroyVisuals( aTimeMilliseconds ); + } + + } //Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfrecyclinggridelementimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfrecyclinggridelementimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,755 @@ +/* +* 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: Private Implementation file for AlfRecyclingGridElement. +* +*/ + + +#include "alfrecyclinggridelementimpl.h" +#include "autoarrayptr.h" +#include // Just for CHuiLayout::EExpandVertically +#include +#include +#include + +#include +#include +#include +#include + +#include "alf/ialfvisualtemplate.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace osncore; + +_LIT8(KMainLayoutName, "MainLayout"); +_LIT8(KScrollLayoutName, "ScrollLayout"); + +const int KDefaultScrollingTime = 400; + +using namespace Alf; + +AlfRecyclingGridElementImpl::AlfRecyclingGridElementImpl( + AlfRecyclingGridElement& aOwner, + int aNumColumns, + int aNumRows) : mOwner( aOwner ) + { + mNumVisibleColumns = aNumColumns; + mNumVisibleRows = aNumRows; + mNumColumns = 0; + mNumRows = 0; + mFillStyle = AlfRecyclingGridElement::AlfRecyclingGridElement::EColumnsFirst; + mFillStyleParam = 0; + mScrollingTime = KDefaultScrollingTime; + mFadeInTime = KDefaultScrollingTime / 2.f; + mFadeInDelay = KDefaultScrollingTime / 2.f; + mFadeOutTime = KDefaultScrollingTime / 2.f; + mFadeOutDelay = 0; + mScrollOffset.iX = 0; + mScrollOffset.iY = 0; + mHorizontalOffset = false; + mVerticalOffset = false; + + setFillStyle(AlfRecyclingGridElement::AlfRecyclingGridElement::EColumnsFirst, aNumColumns); + } + +//---------------------------------------------------------------- +// Class Destructor +//---------------------------------------------------------------- +AlfRecyclingGridElementImpl::~AlfRecyclingGridElementImpl() + { + } + +//---------------------------------------------------------------- +// Sets the fill style for the Recycle grid element +//---------------------------------------------------------------- +void AlfRecyclingGridElementImpl::setFillStyle(AlfRecyclingGridElement::FillStyle aFillStyle, int aFillStyleParam) + { + mFillStyle = aFillStyle; + mFillStyleParam = aFillStyleParam; + mNumRows = mNumVisibleRows; + mNumColumns = mNumVisibleColumns; + if (mFillStyle == AlfRecyclingGridElement::EColumnsFirst || + (mFillStyle == AlfRecyclingGridElement::ERowsFirst && mFillStyleParam > mNumRows)) + { + mNumRows++; // 1 extra row for scrolling + } + if (mFillStyle == AlfRecyclingGridElement::ERowsFirst || + (mFillStyle == AlfRecyclingGridElement::EColumnsFirst && mFillStyleParam > mNumColumns)) + { + mNumColumns++; // 1 extra column for scrolling + } + } + + +void AlfRecyclingGridElementImpl::setAnimationTimes( + int aScrollingTime, int aFadeInTime, int aFadeInDelay, + int aFadeOutTime, int aFadeOutDelay ) + { + mScrollingTime = aScrollingTime; + mFadeInTime = aFadeInTime; + mFadeInDelay = aFadeInDelay; + mFadeOutTime = aFadeOutTime; + mFadeOutDelay = aFadeOutDelay; + } + + +CAlfVisual* AlfRecyclingGridElementImpl::createVisualTree( + IAlfVariantType& aData, uint aDataID, CAlfLayout* aParentLayout, int aLayoutIndex ) + { + CAlfLayout *main = NULL; + CAlfGridLayout *grid = NULL; + CAlfVisual* visualTree = mOwner.findVisual(aDataID); + + if ( visualTree ) + { + main = (CAlfLayout *)visualTree; + grid = (CAlfGridLayout *)&main->Visual( 0 ); + } + else + { + main = CAlfLayout::AddNewL((CAlfControl &)mOwner.control()); + main->SetTagL(KMainLayoutName); + + // Create grid layout + grid = CAlfGridLayout::AddNewL((CAlfControl&)mOwner.control(),mNumColumns, mNumRows, main); + + // Scroll layout for additional content, + // created by the visual template or other elements. + CAlfLayout *scroll = CAlfLayout::AddNewL((CAlfControl&)mOwner.control(), main); + scroll->SetTagL(KScrollLayoutName); + + if (mOwner.getVisualTemplate()) + { + mOwner.getVisualTemplate()->createVisualTree( + mOwner.control(), aData.branch()->data(), scroll, scroll->Count()); + } + if (aParentLayout) + { + aParentLayout->Insert(main, aLayoutIndex ); + } + } + + TAlfRealPoint size = main->Size().ValueNow(); + TAlfRealPoint itemSize(size.iX / (TReal)mNumVisibleColumns,size.iY / (TReal)mNumVisibleRows); + TAlfRealPoint gridSize(itemSize.iX * mNumColumns, itemSize.iY * mNumRows); + grid->SetSize(gridSize); + + mOwner.addVisualTree(main, aDataID); + + CAlfLayout *parent = NULL; + if (mFillStyle == AlfRecyclingGridElement::EColumnsFirst) + { + // No reordering needed, add directly to the grid layout + parent = grid; + } + CAlfVisual** array = new( EMM ) CAlfVisual*[mNumColumns * mNumRows]; + + // Ownership transferred to the autoptr. + auto_arrayptr arrayCleanup( array ); + + int childIndex = 0; + // Create the children visual trees + if ( aData.type() == IAlfVariantType::EBranch && + aData.branch()->childrenCount()) + { + IAlfBranch* branch = aData.branch(); + TPoint childPos = calculateChildPos(0); + int maxColumn = mScrollOffset.iX + mNumColumns; + int maxRow = mScrollOffset.iY + mNumRows; + for (int i = 0; i < branch->childrenCount() && + ( childPos.iX < maxColumn || childPos.iY < maxRow); ++i) + { + childPos = calculateChildPos(i); + if (childPos.iX >= mScrollOffset.iX && childPos.iX < maxColumn && + childPos.iY >= mScrollOffset.iY && childPos.iY < maxRow) + { + IAlfElement* child = mOwner.control().findElement( aData.branch()->childName(i).getUtf8()); + uint childID = mOwner.control().elementDataId(*child, i, aDataID); + array[childIndex] = child->createVisualTree( + *branch->childData( i ), *branch, i, aDataID, parent, childIndex ); + childIndex++; + } + + } + } + + // Reorder and insert to the grid layout + if (mFillStyle == AlfRecyclingGridElement::ERowsFirst) + { + for (int i = 0; i < mNumRows && childIndex >= 0; ++i) + { + for (int j = 0; j < mNumColumns && childIndex >= 0; ++j) + { + int err=grid->Append(array[j * mNumRows + i]); + if(err!=KErrNone) + { + ALF_THROW ( AlfVisualException, err, "Grid Append Failed" ) + } + childIndex--; + } + } + } + + return main; + } + + +//---------------------------------------------------------------- +// Gets the Point of a child at a given index +//---------------------------------------------------------------- +TPoint AlfRecyclingGridElementImpl::calculateChildPos(int aInd) const + { + if (mFillStyle == AlfRecyclingGridElement::EColumnsFirst) + { + return TPoint(aInd % mFillStyleParam, aInd / mFillStyleParam); + } + else if (mFillStyle == AlfRecyclingGridElement::ERowsFirst) + { + return TPoint(aInd / mFillStyleParam, aInd % mFillStyleParam); + } + return TPoint(0, 0); + } + +//---------------------------------------------------------------- +// Gets the Index of a child at a given point +//---------------------------------------------------------------- +int AlfRecyclingGridElementImpl::calculateChildInd(TPoint aPos) const + { + if (aPos.iX < 0 || aPos.iY < 0) + { + return -1; // Does not exist + } + if (mFillStyle == AlfRecyclingGridElement::EColumnsFirst) + { + if (aPos.iX >= mFillStyleParam) + { + return -1; // Does not exist + } + return aPos.iY * mFillStyleParam + aPos.iX; + } + else if (mFillStyle == AlfRecyclingGridElement::ERowsFirst) + { + if (aPos.iY >= mFillStyleParam) + { + return -1; // Does not exist + } + return aPos.iX * mFillStyleParam + aPos.iY; + } + return 0; + } + + + +// --------------------------------------------------------------------------- +// OfferEventL - Handle the Event. +// ?implementation_description +// --------------------------------------------------------------------------- +bool AlfRecyclingGridElementImpl::offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) + { + + if ( !accept( aControl, aEvent ) ) + { + return false; + } + uint aEventID = aEvent.CustomParameter(); + + if ( aEventID == EEventScrollPrimaryNext ) + { + aEventID = ( mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollDown : EEventScrollRight ); + } + else if ( aEventID == EEventScrollPrimaryPrev ) + { + aEventID = ( mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollUp : EEventScrollLeft ); + } + else if ( aEventID == EEventScrollSecondaryNext ) + { + aEventID = ( mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollRight : EEventScrollDown ); + } + else if ( aEventID == EEventScrollSecondaryPrev ) + { + aEventID = ( mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollLeft : EEventScrollUp ); + } + + if ((int)aEventID == (int)EEventScrollPageDown ) + { + int iter=0; + if ((int)mFillStyle == (int)AlfRecyclingGridElement::EColumnsFirst ) + { + iter = mNumRows-1 ; + } + else + { + iter = mNumColumns-1 ; + } + + for (int i=0;iVisual(0); + CAlfLayout *scroll = (CAlfGridLayout *)&main->Visual(1); + + + TSize size; + + // Grid/scroll layout movement + TPoint layoutMovement(0, 0); + + // New number of the new items to reveal (and old items to hide) + int numNewItems = 0; + + // Starting indices and increment step for recycling visuals + int recycleSrcInd = 0, recycleDstInd = 0; + int recycleIndStep = 0; + + // Starting indices and increment step for fading in/out visuals + int fadeInInd = 0, fadeOutInd = 0; + int fadeIndStep = 0; + + // Is recycling required? + bool recycle = false; + + // Index of the first new child visual + TPoint firstNewChildPos(0, 0); + + // Increment step for the new child indices + TPoint childPosStep(0, 0); + + if (aEventID == EEventScrollUp) // Up + { + firstNewChildPos = mScrollOffset + TPoint(mHorizontalOffset ? -1 : 0, -1); + childPosStep = TPoint(1, 0); + mScrollOffset.iY--; + numNewItems = mNumColumns; + fadeInInd = mNumColumns - 1; + fadeOutInd = grid->Count() - 1; + recycleSrcInd = grid->Count() - mNumColumns; + recycleIndStep = 1; + fadeIndStep = -1; + grid->ChildSize(recycleDstInd, size); + layoutMovement.iY = -size.iHeight; + recycle = !mVerticalOffset; + mVerticalOffset = false; + + } + else if (aEventID == EEventScrollDown) // Down + { + firstNewChildPos = mScrollOffset + TPoint(mHorizontalOffset ? -1 : 0, mNumRows - 1); + childPosStep = TPoint(1, 0); + mScrollOffset.iY++; + numNewItems = mNumColumns; + recycleDstInd = grid->Count()- 1; + fadeInInd = grid->Count() - mNumColumns; + fadeIndStep = 1; + grid->ChildSize(recycleDstInd, size); + layoutMovement.iY = size.iHeight; + + recycle = mVerticalOffset; + mVerticalOffset = true; + + + } + else if (aEventID == EEventScrollLeft) // Left + { + firstNewChildPos = mScrollOffset + TPoint(-1, mVerticalOffset ? -1 : 0); + childPosStep = TPoint(0, 1); + mScrollOffset.iX--; + numNewItems = mNumRows; + fadeOutInd = recycleSrcInd = mNumColumns - 1; + fadeIndStep = recycleIndStep = mNumColumns; + grid->ChildSize(recycleDstInd, size); + layoutMovement.iX = -size.iWidth; + recycle = !mHorizontalOffset; + mHorizontalOffset = false; + + } + + else if (aEventID == EEventScrollRight) // Right + { + firstNewChildPos = mScrollOffset + TPoint(mNumColumns - 1, mVerticalOffset ? -1 : 0); + childPosStep = TPoint(0, 1); + mScrollOffset.iX++; + numNewItems = mNumRows; + fadeInInd = recycleDstInd = mNumColumns - 1; + fadeIndStep = recycleIndStep = mNumColumns; + grid->ChildSize(recycleDstInd, size); + layoutMovement.iX = size.iWidth; + recycle = mHorizontalOffset; + mHorizontalOffset = true; + } + + IAlfVariantType *recyclingGridData = aControl.elementData(mOwner, 0); + if ( recyclingGridData->type()!= IAlfVariantType::EBranch) + { + return ; + } + + aControl.Env().PauseRefresh(); + + // Perform scrolling + if (aEventID == EEventScrollPageDown || aEventID == EEventScrollPageUp || aEventID == EEventScrollUp || aEventID == EEventScrollDown ||aEventID == EEventScrollLeft || aEventID == EEventScrollRight) + { + if (recycle) + { + // Move the layout + grid->SetPos(grid->Pos().Target() + layoutMovement); + // Recycle visual trees + for (int i = 0; i < numNewItems; ++i) + { + CAlfVisual &visual = grid->Visual(recycleSrcInd + i * recycleIndStep); + grid->Reorder(visual, recycleDstInd + i * recycleIndStep); + TPoint childPos = firstNewChildPos + TPoint(i * childPosStep.iX, i * childPosStep.iY); + int childInd = calculateChildInd(childPos); + if (childInd >= 0 && childInd < recyclingGridData->branch()->childrenCount()) + { + IAlfVariantType *recyclingGridChildData = recyclingGridData->branch()->childData(childInd); + + const UString& childName = recyclingGridData->branch()->childName(childInd); + IAlfElement *childElement = mOwner.control().findElement(childName.getUtf8()); + if (childElement!=NULL) + { + int newDataID= mOwner.control().elementDataId(*childElement,childInd, 0); + childElement->replaceVisualTree( + *recyclingGridChildData,newDataID ,childElement->dataID(visual)); + } + } + } + } + else + { + scroll->SetPos(scroll->Pos().Target() - layoutMovement, mScrollingTime); + } + // Fade in / out + for (int i = 0; i < numNewItems; ++i) + { + // Fade out the old items + CAlfVisual &oldItem = grid->Visual(fadeOutInd + i * fadeIndStep); + if ( mFadeOutDelay == 0 ) + { + TAlfTimedValue zero; + zero.SetValueNow(1.f); + zero.SetTarget(0.f, mFadeOutTime); + oldItem.SetOpacity(zero); + } + else + { + TAlfValueCommand cmd((void*)&oldItem, EAlfValueCommandVisualSetOpacity, 0.f, mFadeOutTime); + aControl.Env().Send(cmd, mFadeOutDelay); + } + // Fade in the new items + CAlfVisual &newItem = grid->Visual(fadeInInd + i * fadeIndStep); + TAlfTimedValue zero2; + zero2.SetValueNow(0.f); + zero2.SetTarget(0.f, 0); + newItem.SetOpacity(zero2); + TPoint childPos = firstNewChildPos + TPoint(i * childPosStep.iX, i * childPosStep.iY); + int childInd = calculateChildInd(childPos); + IAlfVariantType *recyclingGridChildData = recyclingGridData->branch()->childData(childInd); + if (childInd >= 0 && recyclingGridChildData!=NULL) + { + if ( mFadeInDelay == 0 ) + { + TAlfTimedValue one; + one.SetValueNow(0.f); + one.SetTarget(1.f, mFadeInTime); + newItem.SetOpacity(one); + } + else + { + TAlfValueCommand cmd((void*)&newItem, EAlfValueCommandVisualSetOpacity, 1.f, mFadeInTime); + aControl.Env().Send(cmd, mFadeInDelay); + } + } + else + { + newItem.SetOpacity( TAlfTimedValue(0) ); + } + } + // Animate layout scrolling + grid->SetPos(grid->Pos().Target() - layoutMovement, mScrollingTime); + } + + aControl.Env().ContinueRefresh(); + } + +// --------------------------------------------------------------------------- +// OfferEventL - Handle the Event. +// ?implementation_description +// --------------------------------------------------------------------------- +bool AlfRecyclingGridElementImpl::moveSingleRowOrColumn( CAlfWidgetControl& aControl, bool aPageUp) + { + uint aEventID; + + if (!aPageUp) + { + aEventID = (mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollDown : EEventScrollRight); + } + else + { + aEventID = (mFillStyle == AlfRecyclingGridElement::EColumnsFirst ? EEventScrollUp : EEventScrollLeft); + } + + doPositioningAndScrolling(aControl,aEventID); + return true; + } + + +bool AlfRecyclingGridElementImpl::accept( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) const + { + + uint aEventID; + if (!aEvent.IsCustomEvent()) + { + return false; + } + aEventID = aEvent.CustomParameter(); + if ( aEventID == EEventScrollPrimaryNext || aEventID == EEventScrollPrimaryPrev || + aEventID == EEventScrollSecondaryNext || aEventID == EEventScrollSecondaryPrev || + aEventID == EEventScrollToFirst || aEventID == EEventScrollToLast || + aEventID == EEventScrollUp || aEventID == EEventScrollDown || + aEventID == EEventScrollLeft || aEventID == EEventScrollRight || + aEventID == EEventScrollPageDown || aEventID == EEventScrollPageUp) + { + return true; + } + + return false; + } + + +void AlfRecyclingGridElementImpl::createChildVisualTree( + IAlfElement* aElement, IAlfVariantType& aChildData, + IAlfBranch& aData, int aIndex, uint aDataID ) + { + int firstVisibleInd=0, lastVisibleInd=0; + int firstVisibleDataId=0, lastVisibleDataId=0; + CAlfLayout *main = (CAlfLayout *)mOwner.findVisual(0); + CAlfGridLayout *grid = (CAlfGridLayout *)&main->Visual(0); + + if (grid->Count() > 0) + { + CAlfVisual &first = grid->Visual( 0 ); + CAlfVisual &last = grid->Visual( grid->Count() - 1 ); + + firstVisibleDataId= aElement->dataID(first); + lastVisibleDataId= aElement->dataID(last); + + firstVisibleInd= mOwner.control().dataIdToIndex(*aElement, firstVisibleDataId); + lastVisibleInd= mOwner.control().dataIdToIndex(*aElement, lastVisibleDataId); + + // Replace the visual tree + IAlfElement* child = mOwner.control().findElement( aData.branch()->childName(0).getUtf8()); + + + if (aData.childrenCount()>= mNumColumns*mNumRows) + { + // Check that the child index is in the visible area + if ( aIndex >= firstVisibleInd && aIndex <= lastVisibleInd ) + { + CAlfVisual &last = grid->Visual( grid->Count()-1 ); + + // Move the last visual to the right position + grid->Reorder( last, aIndex - firstVisibleInd); + + + // Update data IDs + child->updateDataIDs( aData, aIndex, 1, aDataID, aDataID ); + + int oldElementDataID = aElement->dataID( last ); + int newElementDataID = mOwner.control().elementDataId( *aElement, aIndex - firstVisibleInd, aDataID ); + + child->replaceVisualTree( aChildData, newElementDataID ,oldElementDataID ); + } + } + else + { + int newElementDataID = mOwner.control().elementDataId( *aElement, aIndex - firstVisibleInd, aDataID ); + + //Update data IDs + child->updateDataIDs( aData, aIndex, 1, aDataID, aDataID ); + + //CAlfVisual* newItem = child->createVisualTree(aChildData, aData,aData.childrenCount(), aDataID, static_cast(grid )); + CAlfVisual* newItem = child->createVisualTree(aChildData, newElementDataID,static_cast(grid ),grid->Count()-1); + + // Move the last visual to the right position + grid->Reorder( *newItem, aIndex - firstVisibleInd); + } + } + else + { + aElement->createVisualTree( aChildData, aData, aIndex, aDataID, grid, aIndex ); + } + } + +void AlfRecyclingGridElementImpl::removeChildVisualTree( + IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ) + { + int firstVisibleInd=0, lastVisibleInd=0; + int firstVisibleDataId=0, lastVisibleDataId=0; + CAlfLayout *main = (CAlfLayout *)mOwner.findVisual(0); + CAlfGridLayout *grid = (CAlfGridLayout *)&main->Visual(0); + + CAlfVisual &first = grid->Visual( 0 ); + + if (aData.childrenCount()-1 > (grid->Count() - 1) ) + { + CAlfVisual &last = grid->Visual( grid->Count() - 1 ); + firstVisibleDataId= aElement->dataID(first); + lastVisibleDataId= aElement->dataID(last); + + firstVisibleInd= mOwner.control().dataIdToIndex(*aElement, firstVisibleDataId); + lastVisibleInd= mOwner.control().dataIdToIndex(*aElement, lastVisibleDataId); + + /*Check that the child index is in the visible area*/ + if ( aIndex >= firstVisibleInd && aIndex <= lastVisibleInd ) + { + // Find the visual to be removed - it's used to show the next visual tree below the visible area + CAlfVisual &removed = grid->Visual( aIndex - firstVisibleInd ); + + // Move it to the end of the grid + grid->Reorder( removed, grid->Count() - 1 ); + + + // Replace the visual tree + IAlfElement* child = mOwner.control().findElement( aData.branch()->childName(0).getUtf8()); + + IAlfVariantType* data =NULL; + data = aData.childData( lastVisibleInd + 1 ); + + int oldElementDataID = aElement->dataID( removed ); + + int newElementDataID ; + newElementDataID = mOwner.control().elementDataId( *aElement, lastVisibleInd + 1, aDataID ); + + if (data!=NULL) + { + child->replaceVisualTree(*data, newElementDataID, oldElementDataID); + } + + if (aData.childrenCount()-1 <= (grid->Count() - 1 )) + { + child->removeVisualTree(aData, aData.childrenCount()-1,aDataID); + } + + // Update data IDs + child->updateDataIDs( aData, aIndex, -1, aDataID, aDataID ); + } + } + else + { + CAlfVisual &last = grid->Visual(aData.childrenCount()-1); + firstVisibleDataId= aElement->dataID(first); + lastVisibleDataId= aElement->dataID(last); + + firstVisibleInd= mOwner.control().dataIdToIndex(*aElement, firstVisibleDataId); + lastVisibleInd= mOwner.control().dataIdToIndex(*aElement, lastVisibleDataId); + + + /*Check that the child index is in the visible area*/ + if ( aIndex >= firstVisibleInd && aIndex <= lastVisibleInd ) + { + // Find the visual to be removed - it's used to show the next visual tree below the visible area + CAlfVisual &removed = grid->Visual( aIndex - firstVisibleInd ); + + grid->Reorder( removed, aData.childrenCount()-1); + + // Replace the visual tree + IAlfElement* child = mOwner.control().findElement( aData.branch()->childName(0).getUtf8()); + + IAlfVariantType* data =NULL; + data = aData.childData( aData.childrenCount() -1 ); + + // Replace the visual tree + + CAlfVisual &last = grid->Visual( aData.childrenCount()-1 ); + + int oldElementDataID = aElement->dataID( removed ); + + int newElementDataID ; + newElementDataID = mOwner.control().elementDataId( *aElement, aData.childrenCount()-1, aDataID ); + + if (data!=NULL) + { + child->replaceVisualTree(*data, newElementDataID, oldElementDataID); + } + + if (aData.childrenCount()-1 <= (grid->Count() - 1 )) + { + child->removeVisualTree(aData, aData.childrenCount()-1,aDataID); + } + + // Update data IDs + child->updateDataIDs( aData, aIndex, -1, aDataID, aDataID ); + } + } + } +// --------------------------------------------------------------------------- +// Description: Do not destroy visuals, because it's done elsewhere. +// --------------------------------------------------------------------------- +void AlfRecyclingGridElementImpl::removeAndDestroyVisuals( int /*aTimeMilliseconds*/ ) + { + } + +// End of File. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfreferencetovisual.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfreferencetovisual.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2007 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: Visual class for alfred widget model. + This class queries the visual by name and ID. +* +*/ + + + + +//INCLUDES + +#include "alf/alfreferencetovisual.h" +#include +#include +#include "alf/alfelement.h" +#include +#include +#include + +//using namespace osncore; + +namespace Alf + { +////////////////////// CAlfReferenceToVisual ////////////////////// + + +// ============================ MEMBER FUNCTIONS =============================== + +OSN_EXPORT AlfReferenceToVisual* AlfReferenceToVisual::create( + const char *aElementName, + const char *aVisualName, + bool aUseDataID) + { + return new( EMM ) AlfReferenceToVisual( aElementName, aVisualName, aUseDataID ); + } + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +// +AlfReferenceToVisual::AlfReferenceToVisual(const char *aElementName, + const char *aVisualName, bool aUseDataID) + { + mUseDataID = aUseDataID; + mElementName = UString(aElementName); + mVisualName = UString(aVisualName); + } + +// --------------------------------------------------------------------------- +// Description : Class Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfReferenceToVisual::~AlfReferenceToVisual() + { + + } + +// --------------------------------------------------------------------------- +// Description :Find the referenced visual according to the given data ID. +// --------------------------------------------------------------------------- +// +OSN_EXPORT CAlfVisual *AlfReferenceToVisual::resolve(CAlfWidgetControl &aControl, unsigned int aDataID) + { + // Find the element. + CAlfVisual* visual = NULL; + IAlfElement *element = aControl.findElement(mElementName.getUtf8()); + if (element) + { + unsigned int dataID = aDataID; + + // Find the visual. + visual = element->findVisual(mVisualName.getUtf8(), dataID); + if (!visual) + { + // maybe global visual. + visual = element->findVisual(mVisualName.getUtf8(), 0); + } + } + return visual; + } + +// --------------------------------------------------------------------------- +// Description :Finds the referenced visual according to the given pointer. +// --------------------------------------------------------------------------- +// +OSN_EXPORT CAlfVisual *AlfReferenceToVisual::resolve(CAlfWidgetControl &aControl, CAlfVisual* aSourceVisual) + { + // Find the element. + CAlfVisual* visual = NULL; + //Get the element with the name stored herein + IAlfElement *element = aControl.findElement(mElementName.getUtf8()); + if (element) + { + //is passed visual part of the element + if (element->contains(*aSourceVisual)) + { + HBufC8 *buf8 = NULL; + TRAPD(error,buf8 = aSourceVisual->Tag().AllocL()); + if (error != KErrNone) + { + ALF_THROW(AlfVisualException,ECommonError,"AlfReferenceToVisual") + } + + UString sourceTag((const char*)buf8->Des().PtrZ()); + if (mVisualName.compare(sourceTag)==0) //Is this visual same as what was stored herein? + { + visual = aSourceVisual; + } + delete buf8; + } + } + return visual; + } + + } // namespace Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfsort.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfsort.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2006 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: sorting routine. uses Symbian services: User::QuickSort +* +*/ + + +//INCLUDES +#include +#include +#include +#include +//#include "alf/alfperf.h" +#include "alfsort.h" + +using namespace Alf; + +/** +* Defines the characteristics of a key used +* to access the elements of an array. Used for sort. +* @since S60 ?S60_version +*/ +NONSHARABLE_CLASS(AlfSortKey) : public TKey + { +public: + + /** + * constructor + * + * @since S60 ?S60_version + * @param aSortFunction callback interface for sort. + * @param aArr array to sort. + * @param aCount. count of items in the array. + */ + AlfSortKey( const IAlfSortFunction& aSortFunction, + IAlfVariantType** aArr, uint aCount ); + + /** + * returns data from array + * + * @since S60 ?S60_version + * @param anIndex index to element to return + * @return element at index anIndex. + */ + TAny *At(TInt anIndex) const; + + /** + * compares two items. + * + * @since S60 ?S60_version + * @param aLeft index to the array for left parameter. + * @return the value returned from sort function: + * < 0, if aFirst is less than aSecond, + * > 0 if aFirst is more than aSecond, + * 0, if aFirst equals aSecond. + */ + TInt Compare(TInt aLeft, TInt aRight) const; +private: + + //sort function not owned. + const IAlfSortFunction& iSortFunction; + + //array to sort. not owned + IAlfVariantType** iArr; + + //count of items in array. + uint iCount; + }; + +/** +* Defines the basic behaviour for swapping two elements of an array. +* Used for sort +* @since S60 ?S60_version +*/ +NONSHARABLE_CLASS(AlfSortSwap) : public TSwap + { +public: + + /** + * constructor + * + * @since S60 ?S60_version + * @param aArr array, which elements are to be swapped. + * @param aCount. count of items in the array. + */ + AlfSortSwap( IAlfVariantType** aArr, uint aCount ); + + /** + * swaps two items in the array. + * + * @since S60 ?S60_version + * @param aLeft left index + * @param aRight right index. + */ + void Swap(TInt aLeft, TInt aRight) const; +private: + + //array, which elements are to be swapped. Not owned. + IAlfVariantType** iArr; + + //count of items in the array. + uint iCount; + }; + +// --------------------------------------------------------------------------- +// Description : constructor +// --------------------------------------------------------------------------- +// +AlfSortKey::AlfSortKey( const IAlfSortFunction& aSortFunction, + IAlfVariantType** aArr, uint aCount ) : + iSortFunction(aSortFunction), iArr(aArr), iCount(aCount) + { + } + +// --------------------------------------------------------------------------- +// Description : return element from index anIndex. +// --------------------------------------------------------------------------- +// +TAny *AlfSortKey::At(TInt anIndex) const + { + return iArr[anIndex]; + } + +// --------------------------------------------------------------------------- +// Description : compares two items. +// --------------------------------------------------------------------------- +// +TInt AlfSortKey::Compare(TInt aLeft, TInt aRight) const + { + const IAlfMap* leftMap = iArr[aLeft]->map(); + const IAlfMap* rightMap = iArr[aRight]->map(); + return iSortFunction.compareLeafs( leftMap, rightMap ); + } + +// --------------------------------------------------------------------------- +// Description : constructor +// --------------------------------------------------------------------------- +// +AlfSortSwap::AlfSortSwap( IAlfVariantType** aArr, uint aCount ) : + iArr(aArr), iCount(aCount) + { + } + +// --------------------------------------------------------------------------- +// Description : swaps two items +// --------------------------------------------------------------------------- +// +void AlfSortSwap::Swap(TInt aLeft, TInt aRight) const + { + IAlfVariantType* tmp = iArr[aLeft]; + iArr[aLeft] = iArr[aRight]; + iArr[aRight] = tmp; + } + +// --------------------------------------------------------------------------- +// Description : The sorting routine. +// --------------------------------------------------------------------------- +// +void AlfSort::sort(IAlfVariantType** aArr, uint aCount, + const IAlfSortFunction& aSortFunction ) + { + //ALF_PERF_START( perfdata, "AlfSort-Sort-Sorting") + AlfSortKey key(aSortFunction, aArr, aCount); + AlfSortSwap swap(aArr, aCount); + User::QuickSort( aCount, key, swap ); + //ALF_PERF_STOP( perfdata, "AlfSort-Sort-Sorting") + } + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfstringvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfstringvalue.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007 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: StringType attribute Value. +* +*/ + + +#include +#include + +#include "alfstringvalue.h" + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfStringValue::AlfStringValue(const UString& aValue) + { + mString = aValue; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfStringValue::~AlfStringValue() + { + + } + +// --------------------------------------------------------------------------- +// Gets the string value. +// --------------------------------------------------------------------------- +// +const UString& AlfStringValue::stringValue() const + { + return mString; + } + +// --------------------------------------------------------------------------- +// Gets the type of the atrribute value. +// --------------------------------------------------------------------------- +// +AlfAttributeValueType::Type AlfStringValue::type() const + { + return EString; + } + +// --------------------------------------------------------------------------- +// Gets the unit. +// --------------------------------------------------------------------------- +// +TAlfUnit AlfStringValue::unit() const + { + ALF_THROW(AlfDataException,EInvalidAttributeValue,"AlfStringValue") + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alftextvisualattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alftextvisualattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,661 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for text. +* +*/ + + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattributevaluetype.h" +#include "alf/alfattribute.h" +#include "alf/alftextvisualattributesetter.h" +#include +#include +#include +#include + + +//osn includes +#include + +//alf includes +#include +#include +#include +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include +#include + + +//namespaces +using namespace osncore; +using namespace duiuimodel::textvisualattributes; +using namespace duiuimodel::commonvisualattributes; +using namespace duiuimodel::layoutattributes; + +namespace Alf + { + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfTextVisualAttributeSetter::AlfTextVisualAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfTextVisualAttributeSetter::~AlfTextVisualAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Sets Attribute Value. Delegates based on attribute Category. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfTextVisualAttributeSetter::setAttributeValue ( + CAlfVisual &aVisual, + AlfAttributeContainer* aContainer, + IAlfMap* aData ) + { + CAlfTextVisual* textVisual = dynamic_cast ( &aVisual ); + + if ( !textVisual ) + { + ALF_THROW ( AlfVisualException, EInvalidVisual, "AlfTextVisualAttributeSetter" ) + } + + AlfCommonVisualAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Deprecated +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfTextVisualAttributeSetter::createCommand ( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/ ) + { + //deprecated + TAlfCommand* cmd = NULL; + return cmd; + } + +// --------------------------------------------------------------------------- +// Sends a command to Env +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfTextVisualAttributeSetter::createAndSendCommands ( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + //ShadowOpacity command can be sent as a TAlfCustomEventCommand + + AlfCommonVisualAttributeSetter::createAndSendCommands ( + aVisual, aContainer, aRefVisual ); + } + + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::handleDynamicAttribute ( CAlfVisual &aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + const char* attrName = aAttr.name(); + CAlfTextVisual* textVisual = dynamic_cast ( &aVisual ); + if(textVisual == 0) + { + return; + } + + if ( !strcmp ( attrName, KShadowOpacity ) ) + { + TAlfTimedValue tVal ( ( TReal32 ) aAttr.getSourceValue()->realValue() ); + tVal.SetTarget ( ( TReal32 ) aAttr.getTargetValue()->realValue(), ( TInt ) aAttr.getTime() ); + tVal.SetStyle ( aAttr.getInterpolationStyle() ); + tVal.SetMappingFunctionIdentifier ( aAttr.getMappingFunctionId()); + textVisual->SetShadowOpacity ( tVal ); + } + else + { + AlfCommonVisualAttributeSetter::handleDynamicAttribute( aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::handleStaticAttribute( CAlfVisual& aVisual, + AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + const char* attrName = aAttr.name(); + CAlfTextVisual* textVisual = dynamic_cast ( &aVisual ); + if (!textVisual) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + if ( !strcmp ( attrName, KLineWrap ) ) + { + textVisual->SetWrapping ( (CAlfTextVisual::TLineWrap)aAttr.intValue() ); + } + + else if ( !strcmp ( attrName, KLineSpacing ) ) + { + try + { + AlfAttribute* linespacingunitsAttr = &aContainer.getAttributeByName ( KLineSpacingUnits ); + + //a line spacing units attribute was found + textVisual->SetLineSpacing ( aAttr.intValue(), + (CAlfTextVisual::TLineSpacingUnits)linespacingunitsAttr->intValue() ); + } + + catch ( AlfDataException& e ) + { + //a line spacing units attribute was not found or it was of invalid data type... Use default... + textVisual->SetLineSpacing ( aAttr.intValue() ); + } + } + + else if ( !strcmp ( attrName, KPreconfiguredStyle ) ) + { + try + { + AlfAttribute* backgroundtypeAttr = &aContainer.getAttributeByName ( KBackgroundType ); + + //a background type attribute was found + textVisual->SetStyle ( ( TAlfPreconfiguredTextStyle ) aAttr.intValue(), + (TAlfBackgroundType)backgroundtypeAttr->intValue() ); + } + catch ( AlfDataException& e ) + { + //no background type attribute found or it was of invalid data type... Use default... + textVisual->SetStyle ( ( TAlfPreconfiguredTextStyle ) aAttr.intValue() ); + } + } + else if ( !strcmp ( attrName, KText ) ) + { + TPtrC8 src; + src.Set ( ( TUint8* ) aAttr.stringValue().getUtf8() ); + HBufC* desC = NULL; + + TRAPD(err1, desC = CnvUtfConverter::ConvertToUnicodeFromUtf8L ( src )); + if (err1 != KErrNone) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + if ( desC ) + { + TRAPD(err2, textVisual->SetTextL ( *desC )); + delete desC; + if (err2 != KErrNone) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + } + } + else if ( !strcmp ( attrName, KTextSkinColorId ) ) + { + + + // Retrieve Skin Color Table index + try + { + // colorIndex will not be null. Throws if attribute not found. + AlfAttribute* colorIndex = &aContainer.getAttributeByName ( KTextColorSkinIndex ); + setTextSkinColor(*textVisual, aAttr.stringValue().getUtf8(), colorIndex->stringValue().getUtf8()); + } + catch(AlfDataException& e) + { + // Error in getting the color index. use default value. + setTextSkinColor(*textVisual, aAttr.stringValue().getUtf8()); + } + + } + else if (!strcmp (attrName, KLocalisationText) ) // Support for Localised text + { + + AlfAttribute* langAttr=NULL; + AlfAttribute* varArgsAttr=NULL; + + // Get the language attribute + try + { + // Retrieve the language attribute. + langAttr = &aContainer.getAttributeByName ( KLang ); + } + catch(AlfDataException& e) + { + // Nothing to do here. just continue. + } + + // Get the varargs attribute. + try + { + varArgsAttr = &aContainer.getAttributeByName ( KVarArgs ); + } + catch(AlfDataException& e) + { + // Nothing to do here. just continue. + } + setLocalisedText(*textVisual,aAttr.stringValue().getUtf8(),langAttr,varArgsAttr); + + } + else if ( !strcmp ( attrName, KTextColor ) ) + { + if ( 4 == aAttr.getTargetValueCount() && AlfAttributeValueType::EInt == aAttr.type(0) && + AlfAttributeValueType::EInt == aAttr.type(1) && AlfAttributeValueType::EInt == aAttr.type(2) && + AlfAttributeValueType::EInt == aAttr.type(3)) + { + TRgb color ( aAttr.intValue(0), aAttr.intValue(1), aAttr.intValue(2), aAttr.intValue(3) ); + textVisual->SetColor( color ); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, "AlfTextVisualAttributeSetter" ); + } + } + else if ( !strcmp ( attrName, KTextColorSkinIndex ) ) + { + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KTextSkinColorId + } + else if ( !strcmp ( attrName, KBackgroundType ) ) + { + // Can not do anything with background type alone. + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KPreconfiguredStyle + } + else if ( !strcmp ( attrName, KLineSpacingUnits ) ) + { + // Can not do anything with line spacing units alone. + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KLineSpacing + } + else if ( !strcmp ( attrName, KStyle ) ) + { + textVisual->SetTextStyle ( aAttr.intValue() ); + } + else if ( !strcmp ( attrName, KFont ) ) + { + //not supported, no API in textvisual + } + else if ( !strcmp ( attrName, KVerticalAlign ) ) + { + AlfAttribute* horzalignAttr = &aContainer.getAttributeByName ( KHorizontalAlign ); + //will throw if attribute is not found + + textVisual->SetAlign ( ( TAlfAlignHorizontal ) horzalignAttr->intValue(), + ( TAlfAlignVertical ) aAttr.intValue() ); + } + else if ( !strcmp ( attrName, KHorizontalAlign ) ) + { + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KVerticalAlign + } + else if ( !strcmp ( attrName, KMaxLineCount ) ) + { + if (aAttr.type(0) == AlfAttributeValueType::EInt) + { + textVisual->SetMaxLineCount ( aAttr.intValue() ); + } + else if (aAttr.type(0) == AlfAttributeValueType::EFloat) + { + textVisual->SetMaxLineCount ( aAttr.realValue() ); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttribute, "AlfTextVisualAttributeSetter" ); + } + + } + else if ( !strcmp ( attrName, KEnableShadow ) ) + { + int enableShadow = aAttr.intValue(); + TBool flag = ETrue; //Assume true for any non-zero value. + if ( 0 == enableShadow ) + { + flag = EFalse; + } + textVisual->EnableShadow ( flag ); + } + else + { + AlfCommonVisualAttributeSetter::handleStaticAttribute( + aVisual, aAttr, aContainer); + } + } + +// --------------------------------------------------------------------------- +// Sets dynamic attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::handleDynamicDataAttribute ( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + //Shadow opacity can be supported + AlfCommonVisualAttributeSetter::handleDynamicDataAttribute(aVisual, aAttr, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// Sets static attributes to visual from data +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ) + { + const char* dataField = aAttr.getDataField(); + + // throw if datafield name or data is not set + if ( !dataField ) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + if (!aData) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + IAlfVariantType* data = aData->item ( UString(dataField)); + const char* attrName = aAttr.name(); + + CAlfTextVisual* textVisual = dynamic_cast ( &aVisual ); + if(textVisual == 0) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + if ( !strcmp ( attrName, KLineWrap ) ) + { + if ( data && data->type() == IAlfVariantType::EInt ) + { + textVisual->SetWrapping ( ( CAlfTextVisual::TLineWrap ) data->integer() ); + } + } + else if ( !strcmp ( attrName, KText ) ) + { + if ( data && data->type() == IAlfVariantType::EString ) + { + TPtrC8 src; + src.Set ( ( TUint8* ) data->string().getUtf8() ); + HBufC* desC = NULL; + TRAPD(err1, desC = CnvUtfConverter::ConvertToUnicodeFromUtf8L ( src )); + if (err1 != KErrNone) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + + if ( desC ) + { + TRAPD(err2, textVisual->SetTextL ( *desC )); + delete desC; + if (err2 != KErrNone) + { + ALF_THROW ( AlfDataException, ECommonError, "AlfTextVisualAttributeSetter" ) + } + } + } + } + else if (!strcmp (attrName, KLocalisationText) ) // Support for Localised text + { + + AlfAttribute* langAttr=NULL; + AlfAttribute* varArgsAttr=NULL; + + // Retrieve the language attribute. + if ( data && data->type() == IAlfVariantType::EString ) + { + + try + { + langAttr = &aContainer.getAttributeByName ( KLang ); + } + catch(AlfDataException& e) + { + // Nothing to do here .Just continue. + } + try + { + varArgsAttr = &aContainer.getAttributeByName ( KVarArgs ); + } + catch(AlfDataException& e) + { + // Nothing to do here .Just continue. + } + setLocalisedText(*textVisual, data->string().getUtf8(),langAttr,varArgsAttr); + } + + } + + else if ( !strcmp ( attrName, KTextColor ) ) + { + if ( data && data->type() == IAlfVariantType::EContainer ) + { + IAlfContainer* dataContainer = data->container(); + + if ( 4 != dataContainer -> count() ) + { + ALF_THROW ( AlfDataException, EInvalidAttribute, "AlfTextVisualAttributeSetter" ) + } + + IAlfVariantType* red = dataContainer->item ( 0 ); //red + IAlfVariantType* green = dataContainer->item ( 1 ); //green + IAlfVariantType* blue = dataContainer->item ( 2 ); //blue + IAlfVariantType* alpha = dataContainer->item ( 3 ); //alpha + + if ( red && IAlfVariantType::EInt == red->type() && + green && IAlfVariantType::EInt == green->type() && + blue && IAlfVariantType::EInt == blue->type() && + alpha && IAlfVariantType::EInt == alpha->type() ) + { + TRgb color ( red->integer(), green->integer(), blue->integer(), alpha->integer() ); + textVisual->SetColor ( color ); + } + } + } + else if ( !strcmp ( attrName, KTextSkinColorId ) ) + { + if ( data && data->type() == IAlfVariantType::EString ) + { + + try + { + // Retrieve skin color table index + AlfAttribute* colorIndex = &aContainer.getAttributeByName( + KTextColorSkinIndex); // colorIndex will not be null. Throws if not found. + + const char* colorIndexDataField = colorIndex->getDataField(); + IAlfVariantType* colorIndexData = + aData->item(UString(colorIndexDataField)); + if(colorIndexData && colorIndexData->type() == IAlfVariantType::EString) + { + setTextSkinColor(*textVisual, data->string().getUtf8(), + colorIndexData->string().getUtf8()); + } + } + catch(AlfDataException& e) + { + // No color index found. Use default value. + setTextSkinColor(*textVisual, data->string().getUtf8()); + } + + } + } + else if ( !strcmp ( attrName, KTextColorSkinIndex ) ) + { + // Handled in KTextSkinColorId case above. + } + else if ( !strcmp ( attrName, KPreconfiguredStyle ) ) + { + try + { + AlfAttribute* backgroundtypeAttribute = &aContainer.getAttributeByName ( KBackgroundType ); + const char* backgroundDataField = backgroundtypeAttribute->getDataField(); + IAlfVariantType* backgroundData = aData->item ( UString(backgroundDataField) ); + + if ( data && data->type() == IAlfVariantType::EInt && backgroundData && backgroundData->type() == IAlfVariantType::EInt ) + { + //a valid background type attribute was found + textVisual->SetStyle ( ( TAlfPreconfiguredTextStyle ) data->integer(), ( TAlfBackgroundType ) data->integer() ); + } + } + catch ( AlfDataException& e ) + { + if ( data && data->type() == IAlfVariantType::EInt ) + { + //no valid background type attribute found... Use default... + textVisual->SetStyle ( ( TAlfPreconfiguredTextStyle ) data->integer() ); + } + } + } + else if ( !strcmp ( attrName, KBackgroundType ) ) + { + // Can not do anything with background type alone. + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KPreconfiguredStyle + } + else if ( !strcmp ( attrName, KLineSpacing ) ) + { + try + { + AlfAttribute* linespacingunitsAttribute = &aContainer.getAttributeByName ( KBackgroundType ); + const char* linespacingunitsDataField = linespacingunitsAttribute->getDataField(); + IAlfVariantType* linespacingunitsData = aData->item ( UString(linespacingunitsDataField) ); + + if ( data && data->type() == IAlfVariantType::EInt && linespacingunitsData && linespacingunitsData->type() == IAlfVariantType::EInt ) + { + //a valid line spacing units attribute was found + textVisual->SetLineSpacing ( data->integer(), ( CAlfTextVisual::TLineSpacingUnits ) linespacingunitsData->integer() ); + } + } + catch ( AlfDataException& e ) + { + if ( data && data->type() == IAlfVariantType::EInt ) + { + //a valid line spacing units attribute was not found... Use default... + textVisual->SetLineSpacing ( data->integer() ); + } + } + } + else if ( !strcmp ( attrName, KLineSpacingUnits ) ) + { + // Can not do anything with line spacing units alone. + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KLineSpacing + } + else if ( !strcmp ( attrName, KStyle ) ) + { + if ( data && data->type() == IAlfVariantType::EInt ) + { + textVisual->SetTextStyle ( data->integer() ); + } + } + else if ( !strcmp ( attrName, KFont ) ) + { + //not supported, no API in textvisual + } + else if ( !strcmp ( attrName, KVerticalAlign ) ) + { + //will throw if horizontal align is not found + AlfAttribute* horzAlignAttribute = &aContainer.getAttributeByName ( KHorizontalAlign ); + const char* horzAlignDataField = horzAlignAttribute->getDataField(); + IAlfVariantType* horzAlignData = aData->item ( UString(horzAlignDataField) ); + + if ( data && data->type() == IAlfVariantType::EInt && horzAlignData && horzAlignData->type() == IAlfVariantType::EInt ) + { + textVisual->SetAlign ( ( TAlfAlignHorizontal ) horzAlignData->integer(), + ( TAlfAlignVertical ) data->integer() ); + } + } + else if ( !strcmp ( attrName, KHorizontalAlign ) ) + { + // Do nothing. + // This attribute will be used in some other iteration in the + // else-if block that uses KVerticalAlign + } + else if ( !strcmp ( attrName, KMaxLineCount ) ) + { + if ( data && data->type() == IAlfVariantType::EInt ) + { + textVisual->SetMaxLineCount ( data->integer() ); + } + + } + else if ( !strcmp ( attrName, KEnableShadow ) ) + { + if ( data && data->type() == IAlfVariantType::EBool ) + { + textVisual->EnableShadow ( data->boolean() ); + } + } + else + { + AlfCommonVisualAttributeSetter::handleStaticDataAttribute ( + aVisual, aAttr, aContainer, aData ); + } + } + + +// --------------------------------------------------------------------------- +// Localisation attribute setter helper method. Helper Method. +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::setLocalisedText(CAlfVisual& /*aVisual*/,const char* /*aLocId*/,AlfAttribute* /*aLangAttr*/,AlfAttribute* /*aVarArgsAttr*/) + { + } + + + +// --------------------------------------------------------------------------- +// Helper Method for setting skin color. +// --------------------------------------------------------------------------- +// +void AlfTextVisualAttributeSetter::setTextSkinColor(CAlfTextVisual& /*aTextVisual*/, const Utf8* /*aColorTable*/, + const char* /*aColorIndex*/) + { + } + + } // namespace Alf + +// End of file diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfthememanagerutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfthememanagerutil.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006-2007 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: Implementation of AlfThemeManagerUtil class, the class +* which is an interface to the ThemeManager component +* +*/ + +#include "alf/alfthememanagerutil.h" + + +#include "tm/themeitemmapper.h" +#include "tm/thememanager.h" +#include "tm/themeexception.h" +using namespace Alf; + +#include + +namespace Alf + { + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfThemeManagerUtil::AlfThemeManagerUtil() + { + mThemeManager=NULL; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfThemeManagerUtil::~AlfThemeManagerUtil() + { + if(mThemeManager) + { + ThemeManager::deleteThemeManager(); + mThemeManager = NULL; + } + } + +// --------------------------------------------------------------------------- +// Get Skin Image parameters. Given the logical name this method returns the skinid. +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAknsItemID AlfThemeManagerUtil::getSkinId(const Utf8* aSkinLogicalName) + { + + TAknsItemID skinid; + skinid.Set(0,0); + + // Create ThemeManager instance + if(!mThemeManager) + { + mThemeManager = ThemeManager::createThemeManager(); + } + + // Query ThemeManager for an ItemMapper interface + IThemeItemMapper* itemMapper=NULL; + // Get Image data + ThemeItemDef item; + + try + { + mThemeManager->getItemMapperInterface(&itemMapper); + UString alfSkinLogicalname(aSkinLogicalName); + if(itemMapper) + { + item= itemMapper->findItem(alfSkinLogicalname); + } + } + catch(ThemeException& ex) + { + if(itemMapper) + mThemeManager->releaseItemMapperInterface(); + throw ex; + } + + skinid.iMajor= item.getMajorId(); + skinid.iMinor= item.getMinorId(); + + // Done with ItemMapper interface, release it + if(itemMapper) + mThemeManager->releaseItemMapperInterface(); + return skinid; + } + + } diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfvarianttype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfvarianttype.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1646 @@ +/* +* Copyright (c) 2006 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: Impelements Variants for widgetmodel data. +* +*/ + + + +//INCLUDES + + +#include +#include +#include +#include +#include +#include +#include +//#include "alf/alfperf.h" +#include +#include "alfsort.h" + +using osncore::UString; +using osncore::AlfPtrVector; + +using std::auto_ptr; + + +// Forward declared inside the Alf namespace +namespace Alf + { + + union UData + { + bool mBool; // Boolean + int mInt; // 32-bit integer + uint mUint; // 32-bit unsigned integer + double mReal; // 64-bit real + UString* mString; + Alf::IAlfModelBase* mBasePtr; + }; + + + +//Internal class used to store the VariantData type +//These classes are not exposed. +class AlfVariantDataImpl +{ +public: + //Default Constructor + AlfVariantDataImpl() + { + mData.mString = NULL; + } + //Destructor + ~AlfVariantDataImpl() + { + if(mType == IAlfVariantType::EString) + { + if(mData.mString) + { + delete mData.mString; + mData.mString = NULL; + } + } + if(mType == IAlfVariantType::ECustomData) + { + if(mData.mBasePtr) + { + delete mData.mBasePtr; + mData.mBasePtr = NULL; + } + } + + } + //Union that actually stores the variant Data + uint8 mType; + UData mData; +}; + + +//Internal class used to store the Conatiner Data type +//These classes are not exposed. +class AlfContainerDataImpl +{ +public: + //Default Constructor + AlfContainerDataImpl() + { + mArray.setAutoDelete(); + } + //Destructor + ~AlfContainerDataImpl() + { + mArray.clear(); + } + AlfPtrVector mArray; + +}; + + + +//Internal class used to store the Conatiner Data type +//These classes are not exposed. +class MapItem +{ +public: + //Default Constructor + MapItem():mData(0),mName(0) + { + + } + //Destructor + ~MapItem() + { + if(mData) + { + delete mData; + mData = NULL; + } + if(mName) + { + delete mName; + mName = NULL; + } + } + IAlfVariantType* mData; + UString* mName; +}; + +//Internal class used to store the Branch Data type +//These classes are not exposed. +class AlfMapDataImpl +{ +public: + AlfMapDataImpl() + { + + } + ~AlfMapDataImpl() + { + + mArray.clear(); + } + //Array to hold the Map Item + AlfPtrVector mArray; +}; + +//owned +class AlfBranchDataImpl +{ +public: + AlfBranchDataImpl():mCurrentData(0),mChildData(0) + { + + } + ~AlfBranchDataImpl() + { + if(mCurrentData) + { + delete mCurrentData; + mCurrentData=NULL; + } + + if(mChildData) + { + delete mChildData; + mChildData=NULL; + } + } + IAlfMap* mCurrentData; + IAlfMap* mChildData; +}; + + +////////////////////// AlfVariantType ////////////////////// + +// --------------------------------------------------------------------------- +// Description :Initialize the VarianType with an Unsigned 8 bit Integer Value +// --------------------------------------------------------------------------- +// + +void AlfVariantType::construct(Type aType) + { + mVarData.reset( new (EMM) AlfVariantDataImpl() ); + mVarData->mType = aType; + } + +OSN_EXPORT AlfVariantType::AlfVariantType() + { + mVarData.reset( new (EMM) AlfVariantDataImpl() ); + } + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Integer +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(IAlfModelBase* aValue) + { + construct(ECustomData); + mVarData->mData.mBasePtr = aValue; + } + + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Integer +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(const UString& aValue) + { + construct(EString); + mVarData->mData.mString = new(EMM) UString(aValue); + } + + + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Integer value +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(const int& aValue) + { + construct(EInt); + mVarData->mData.mInt = aValue; + } + + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Unsigned Int value +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(const uint& aValue) + { + construct(EUint); + mVarData->mData.mUint = aValue; + } + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Double value +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(const double& aValue) + { + construct(EReal); + mVarData->mData.mReal = aValue; + } + +// --------------------------------------------------------------------------- +// Description : Parameterized Constructor for an Bool value +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::AlfVariantType(const bool& aValue) + { + construct(EBool); + mVarData->mData.mBool = aValue; + } + + +// --------------------------------------------------------------------------- +// Description : Class Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfVariantType::~AlfVariantType() + { + } + +// --------------------------------------------------------------------------- +// Description : Sets Data to be stored in the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfVariantType::set(IAlfVariantType& aValue) + { + if( mVarData->mType == EString) + { + delete mVarData->mData.mString; + mVarData->mData.mString = 0; + } + + // Set the type + mVarData->mType = aValue.type(); + + // Copy/create the new data + if (aValue.type() == EBool) + { + mVarData->mData.mBool = aValue.boolean(); + } + else if (aValue.type() <= EInt) + { + mVarData->mData.mInt = aValue.integer(); + } + else if (aValue.type() <= EUint) + { + mVarData->mData.mUint = aValue.uinteger(); + } + else if (aValue.type() <= EReal) + { + mVarData->mData.mReal = aValue.real(); + } + else if (aValue.type() == EString) + { + mVarData->mData.mString = new (EMM) UString(aValue.string()); + } + else if (aValue.type() == ECustomData) + { + mVarData->mData.mBasePtr = aValue.customData(); + } + else + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + } + +// --------------------------------------------------------------------------- +// Description : Gets the Type of the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType::Type AlfVariantType::type() const + { + return (Type)mVarData->mType; + } + + +// --------------------------------------------------------------------------- +// Description : Returns the Boolean value if the data type in the variant +// structure is a bool +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfVariantType::boolean() const + { + if (type() != EBool) + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return mVarData->mData.mBool; + } + + +// --------------------------------------------------------------------------- +// Description : Returns the int value if the data type in the variant +// structure is a int +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfVariantType::integer() const + { + if (type() != EInt && type() != EUint) // Signed-unsigned conversion allowed + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return mVarData->mData.mInt; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Unsigned value if the data type in the variant +// structure is a unsigned int +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint AlfVariantType::uinteger() const + { + if (type() != EInt && type() != EUint) // Signed-unsigned conversion allowed + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return mVarData->mData.mUint; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Real value if the data type in the variant +// structure is a Real data +// --------------------------------------------------------------------------- +// +OSN_EXPORT double AlfVariantType::real() const + { + if (type() != EReal) + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return mVarData->mData.mReal; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Descriptor value if the data type in the variant +// structure is a string data +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfVariantType::string() const + { + if (type() != EString) + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return *mVarData->mData.mString; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Container if the data type in the variant +// structure is a collection +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* AlfVariantType::container() + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + + +// --------------------------------------------------------------------------- +// Description : Returns the Map if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfVariantType::map() + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Branch if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* AlfVariantType::branch() + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + +// --------------------------------------------------------------------------- +// Description : Returns the User Defined Data Pointer if the data type in the variant +// structure is IAlfModelBase +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfModelBase* AlfVariantType::customData() + { + if (type() != ECustomData) + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + } + return mVarData->mData.mBasePtr; + } + +// --------------------------------------------------------------------------- +// Description : Returns true, if objects are equal, false otherwise. +// --------------------------------------------------------------------------- +// + +OSN_EXPORT bool AlfVariantType::operator==(const IAlfVariantType &aOther) const + { + // Set the type + bool equals = false; + if (type() == aOther.type() ) + { + switch( type() ) + { + case EBool: + equals = ( bool() == aOther.boolean() ); + break; + case EInt: + equals = ( int() == aOther.integer() ); + break; + case EUint: + equals = ( uint() == aOther.uinteger() ); + break; + case EReal: + equals = ( real() == aOther.real() ); + break; + case EString: + equals = ( string() == aOther.string() ); + break; + case ECustomData: //not known how to compare. + break; + default: + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfVariantType") + + } + } + + return equals; + } + +////////////////////// AlfContainer ////////////////////// + + + +// ============================ MEMBER FUNCTIONS =============================== + + +// --------------------------------------------------------------------------- +// Description : Default Constructor for the Container Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfContainer::AlfContainer() + { + construct(); + } + + +// --------------------------------------------------------------------------- +// Description : Default Construtor +// --------------------------------------------------------------------------- +// +void AlfContainer::construct() + { + mContainerData.reset( new( EMM ) AlfContainerDataImpl() ); + } + +// --------------------------------------------------------------------------- +// Description : Class Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfContainer::~AlfContainer() + { + } + +// --------------------------------------------------------------------------- +// Description : Adds an AlfVariantType into the container +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::addItem(IAlfVariantType* aData) + { + mContainerData->mArray.resize(mContainerData->mArray.count()+1); + mContainerData->mArray.insert(mContainerData->mArray.count(),aData); + } + +// --------------------------------------------------------------------------- +// Description : Adds an AlfVariantType into the container +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::addItem(uint aIndex, IAlfVariantType* aData) + { + if( aIndex > mContainerData->mArray.count() ) + { + ALF_THROW(AlfDataException,EInvalidArrayIndex,"AlfContainer") + } + else + { + mContainerData->mArray.resize(mContainerData->mArray.count()+1); + mContainerData->mArray.insert(aIndex, aData); + } + } + +// --------------------------------------------------------------------------- +// Description : Gets the Size of the container +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfContainer::count() + { + return mContainerData->mArray.count(); + } + +// --------------------------------------------------------------------------- +// Description : Gets the Item at a given index in the container +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* AlfContainer::item(uint aIndex) + { + uint cmpIndex =0; //To remove RVCT compiler warning + if(aIndex < mContainerData->mArray.count() && aIndex >= cmpIndex ) + { + return mContainerData->mArray[aIndex]; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// Description : Clones the existing conatiner and returns a new COntainer +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* AlfContainer::clone() + { + try + { + //ALF_PERF_START( perfdata, "AlfContainer-Clone-Cloning Container") + auto_ptr clone( new( EMM ) AlfContainer() ); + auto_ptr childData; + + for ( int i = 0; i < mContainerData->mArray.count(); ++i ) + { + if( mContainerData->mArray[i]->type()== IAlfVariantType::EInt ) + { + childData.reset( new(EMM) AlfVariantType(mContainerData->mArray[i]->integer()) ); + } + else if( mContainerData->mArray[i]->type()== IAlfVariantType::EUint ) + { + childData.reset( new(EMM) AlfVariantType(mContainerData->mArray[i]->uinteger()) ); + } + else if(mContainerData->mArray[i]->type()== IAlfVariantType::EBool) + { + childData.reset( new (EMM) AlfVariantType(mContainerData->mArray[i]->boolean()) ); + } + else if( mContainerData->mArray[i]->type()== IAlfVariantType::EReal ) + { + childData.reset( new(EMM) AlfVariantType(mContainerData->mArray[i]->real()) ); + } + else if( mContainerData->mArray[i]->type()== IAlfVariantType::EString ) + { + childData.reset( new(EMM) AlfVariantType(mContainerData->mArray[i]->string()) ); + } + else if( mContainerData->mArray[i]->type()== IAlfVariantType::EMap ) + { + childData.reset( (IAlfMap*)(mContainerData->mArray[i]->map())->clone() ); + } + else if( mContainerData->mArray[i]->type()== IAlfVariantType::EContainer ) + { + childData.reset( (IAlfContainer*)(mContainerData->mArray[i]->container())->clone() ); + } + else if ( mContainerData->mArray[i]->type()== IAlfVariantType::EBranch ) + { + childData.reset( mContainerData->mArray[i]->branch()->clone() ); + } + else + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfContainer") + } + clone->mContainerData->mArray.resize( clone->mContainerData->mArray.count() + 1 ); + clone->mContainerData->mArray.insert( clone->mContainerData->mArray.count(), childData.get() ); + childData.release(); // ownership was transferred. + } + //ALF_PERF_STOP( perfdata, "AlfContainer-Clone-Cloning Container") + return clone.release(); + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + } + +// --------------------------------------------------------------------------- +// Description : Sorts the container using user defined callback method +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::sort( const IAlfSortFunction& aSortFunction ) + { + IAlfVariantType** d = mContainerData->mArray.data(); + AlfSort::sort( d, mContainerData->mArray.count(), aSortFunction ); + } + +// --------------------------------------------------------------------------- +// Description : Sets Data to be stored in the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::set(IAlfVariantType& /*aValue*/) + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Gets the Type of the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType::Type AlfContainer::type() const + { + return IAlfVariantType::EContainer; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Boolean value if the data type in the variant +// structure is a bool +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfContainer::boolean() const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns the int value if the data type in the variant +// structure is a int +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfContainer::integer() const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Unsigned value if the data type in the variant +// structure is a unsigned int +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint AlfContainer::uinteger() const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Real value if the data type in the variant +// structure is a Real data +// --------------------------------------------------------------------------- +// +OSN_EXPORT double AlfContainer::real() const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Descriptor value if the data type in the variant +// structure is a string data +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfContainer::string() const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer"); + } + +// --------------------------------------------------------------------------- +// Description : Returns the Container if the data type in the variant +// structure is a collection +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* AlfContainer::container() + { + return this; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Map if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfContainer::map() + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Branch if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* AlfContainer::branch() + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + + +// --------------------------------------------------------------------------- +// Description : Returns the User Defined Data Pointer if the data type in the variant +// structure is IAlfModelBase +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfModelBase* AlfContainer::customData() + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } +////////////////////// AlfContainer ////////////////////// + + + + +// --------------------------------------------------------------------------- +// Description : Remove a item from the Container +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::removeItem(uint aIndex) + { + uint cmpIndex=0; + if(aIndex >= mContainerData->mArray.count() || (aIndex < cmpIndex)) + { + ALF_THROW(AlfDataException,EInvalidArrayIndex,"AlfContainer") + } + + mContainerData->mArray.remove(aIndex); + } + + +// --------------------------------------------------------------------------- +// Description : Clears the contents of the Container +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::clear() +{ + mContainerData->mArray.clear(); +} + + +// --------------------------------------------------------------------------- +// Description : Replaces the items of the container at a given index with the new data +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfContainer::replaceItem(uint aIndex, IAlfVariantType* aNewData ) + { + if((aIndex < mContainerData->mArray.count()) && aNewData) + { + try + { + mContainerData->mArray.remove(aIndex); + mContainerData->mArray.insert(aIndex,aNewData); + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + } + else + ALF_THROW(AlfDataException,EInvalidArrayIndex,"AlfContainer") + } + +// --------------------------------------------------------------------------- +// Description : Returns true, if objects are equal, false otherwise. +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfContainer::operator==(const IAlfVariantType &/*aOther*/) const + { + ALF_THROW(AlfDataException,EInvalidContainerOperation,"AlfContainer") + } + + +////////////////////// AlfMap ////////////////////// + +// ============================ MEMBER FUNCTIONS =============================== + + + +// --------------------------------------------------------------------------- +// Description : 1st Phase Constructor. Leaves the object onto the cleanup stack +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfMap::AlfMap() + { + construct(); + } + +// --------------------------------------------------------------------------- +// Description : Map Constructor +// --------------------------------------------------------------------------- +// +void AlfMap::construct() + { + mMapDataImpl.reset( new (EMM) AlfMapDataImpl() ); + } + +// --------------------------------------------------------------------------- +// Description : Sets Data to be stored in the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::set(IAlfVariantType& aValue) + { + (void)aValue; + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Gets the Type of the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType::Type AlfMap::type() const + { + return IAlfVariantType::EMap; + } + + +// --------------------------------------------------------------------------- +// Description : Returns the Boolean value if the data type in the variant +// structure is a bool +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfMap::boolean() const + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + + +// --------------------------------------------------------------------------- +// Description : Returns the int value if the data type in the variant +// structure is a int +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfMap::integer() const + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Unsigned value if the data type in the variant +// structure is a unsigned int +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint AlfMap::uinteger() const + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Real value if the data type in the variant +// structure is a Real data +// --------------------------------------------------------------------------- +// +OSN_EXPORT double AlfMap::real() const + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Descriptor value if the data type in the variant +// structure is a string data +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfMap::string() const + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Container if the data type in the variant +// structure is a collection +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* AlfMap::container() + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + + +// --------------------------------------------------------------------------- +// Description : Returns the Map if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfMap::map() + { + return this; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Branch if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* AlfMap::branch() + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +// --------------------------------------------------------------------------- +// Description : Returns the User Defined Data Pointer if the data type in the variant +// structure is IAlfModelBase +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfModelBase* AlfMap::customData() + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + +////////////////////// AlfContainer ////////////////////// + + + + + +// --------------------------------------------------------------------------- +// Description : Map Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfMap::~AlfMap() + { + } + + +// --------------------------------------------------------------------------- +// Description : APi to get the name of the data item in the map +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfMap::name(uint aIndex) const + { + uint cmpIndex=0; + if( aIndex >= mMapDataImpl->mArray.count() || (aIndex < cmpIndex)) + { + ALF_THROW(AlfDataException,EInvalidArrayIndex,"AlfMap") + } + return *mMapDataImpl->mArray[aIndex]->mName; + } + + +// --------------------------------------------------------------------------- +// Description : APi to add an VariantData into the map +// --------------------------------------------------------------------------- +// +void AlfMap::addItem(IAlfVariantType* aData, const UString &aName) + { + auto_ptr item( new( EMM ) MapItem() ); + + item->mName = new( EMM ) UString( aName ); + + mMapDataImpl->mArray.resize( mMapDataImpl->mArray.count() + 1 ); + mMapDataImpl->mArray.insert( mMapDataImpl->mArray.count(), item.get() ); + + // Take the ownership only if there was no exception. + // Otherwise the client is resp. of cleaning up the object. + item->mData = aData; + item.release(); + } + +// --------------------------------------------------------------------------- +// Description : APi to add an VariantData into the map +// --------------------------------------------------------------------------- +// +void AlfMap::addItem(uint aIndex, IAlfVariantType* aData, const UString& aName) + { + if( aIndex > mMapDataImpl->mArray.count() ) + { + ALF_THROW(AlfDataException,EInvalidArrayIndex,"AlfMap") + } + else + { + auto_ptr item( new( EMM ) MapItem() ); + + item->mName = new( EMM ) UString( aName ); + + mMapDataImpl->mArray.resize( mMapDataImpl->mArray.count() + 1 ); + mMapDataImpl->mArray.insert( aIndex, item.get() ); + + // Take the ownership only if there was no exception. + // Otherwise the client is resp. of cleaning up the object. + item->mData = aData; + item.release(); + } + } + + +// --------------------------------------------------------------------------- +// Description : Gets the size of the map +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfMap::count() const + { + return mMapDataImpl->mArray.count(); + } + + +// --------------------------------------------------------------------------- +// Description : Gets the Element at a given index +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* AlfMap::item(uint aIndex) + { + uint cmpIndex=0; + if( aIndex >= mMapDataImpl->mArray.count() || aIndex mArray[aIndex]->mData; + } + } + + +// --------------------------------------------------------------------------- +// Description : Clones the map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfMap::clone() + { + try + { + //ALF_PERF_START( perfdata, "AlfContainer-Clone-Cloning Map") + auto_ptr clone( new(EMM) AlfMap() ); + auto_ptr cloneItem; + + for (int i = 0; i < mMapDataImpl->mArray.count(); ++i) + { + cloneItem.reset( new(EMM) MapItem() ); + if( !(mMapDataImpl->mArray[i]->mName->getUtf8() == "")) + { + cloneItem->mName = new(EMM) UString(*(mMapDataImpl->mArray[i]->mName)); + } + if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EInt) + { + cloneItem->mData = new(EMM) AlfVariantType(mMapDataImpl->mArray[i]->mData->integer()); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EUint) + { + cloneItem->mData = new(EMM) AlfVariantType(mMapDataImpl->mArray[i]->mData->uinteger()); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EBool) + { + cloneItem->mData = new (EMM)AlfVariantType(mMapDataImpl->mArray[i]->mData->boolean()); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EReal) + { + cloneItem->mData = new(EMM) AlfVariantType(mMapDataImpl->mArray[i]->mData->real()); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EString) + { + cloneItem->mData = new(EMM) AlfVariantType(mMapDataImpl->mArray[i]->mData->string()); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EMap) + { + cloneItem->mData = (IAlfMap*)(mMapDataImpl->mArray[i]->mData->map())->clone(); + } + else if(mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EContainer) + { + cloneItem->mData = (IAlfContainer*)(mMapDataImpl->mArray[i]->mData->container())->clone(); + } + else if (mMapDataImpl->mArray[i]->mData->type()== IAlfVariantType::EBranch) + { + cloneItem->mData = mMapDataImpl->mArray[i]->mData->branch()->clone(); + } + else + { + ALF_THROW(AlfDataException,EInvalidVariantDataType,"AlfMap") + } + + clone->mMapDataImpl->mArray.resize(clone->mMapDataImpl->mArray.count()+1); + clone->mMapDataImpl->mArray.insert(clone->mMapDataImpl->mArray.count(),cloneItem.get() ); + cloneItem.release(); + } + //ALF_PERF_STOP( perfdata, "AlfContainer-Clone-Cloning Map") + + return clone.release(); + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + } + + +// --------------------------------------------------------------------------- +// Description : Gets the map item with the given name +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* AlfMap::item(const UString &aName) + { + for (int i = 0; i < mMapDataImpl->mArray.count(); ++i) + { + if ( *mMapDataImpl->mArray[i]->mName == aName) + { + return mMapDataImpl->mArray[i]->mData; + } + } + return NULL; + } + +// --------------------------------------------------------------------------- +// Description : Gets the index of the map item with the given name +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfMap::itemIndex(const UString &aName) + { + for (int i = 0; i < mMapDataImpl->mArray.count(); ++i) + { + if ( *mMapDataImpl->mArray[i]->mName == aName) + { + return i; + } + } + return -1; + } + + +// --------------------------------------------------------------------------- +// Description : Remove a item from the Map at a given index +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::removeItem(uint aIndex) + { + try + { + uint cmpIndex =0; + if(aIndex < mMapDataImpl->mArray.count() && aIndex>= cmpIndex ) + { + mMapDataImpl->mArray.remove(aIndex); + } + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + } + + +// --------------------------------------------------------------------------- +// Description : Clears the contents of the Map +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::clear() + { + mMapDataImpl->mArray.clear(); + } + + +// --------------------------------------------------------------------------- +// Description : Replaces the items of the container at a given index with the new data +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::replaceItem(uint aIndex, IAlfVariantType* aNewData ) + { + try + { + uint cmpIndex =0; + if ( aIndex < mMapDataImpl->mArray.count()&& aIndex >= cmpIndex ) + { + auto_ptr newData( new( EMM ) MapItem() ); + newData.get()->mData = aNewData; + newData.get()->mName = new( EMM ) UString( + *( mMapDataImpl->mArray[aIndex]->mName ) ); + + mMapDataImpl->mArray.remove(aIndex); + mMapDataImpl->mArray.insert(aIndex,newData.get()); + + newData.release(); // ownership transferred away + } + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + } + + +// --------------------------------------------------------------------------- +// Description : Replaces the items of the container at a given index with the Given name +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::replaceItem(const UString &aName,IAlfVariantType* aNewData) + { + + try + { + for (int i = 0; i < mMapDataImpl->mArray.count(); ++i) + { + if ( *mMapDataImpl->mArray[i]->mName == aName) + { + auto_ptr newData( new( EMM ) MapItem() ); + + newData.get()->mData = aNewData; + newData.get()->mName = new( EMM ) UString(*(mMapDataImpl->mArray[i]->mName)); + + mMapDataImpl->mArray.remove(i); + mMapDataImpl->mArray.insert(i,newData.get()); + + newData.release(); // ownership transferred away + break; + } + } + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + //aNewData might not have been deleted. In case of this exception the user should delete the variant data passed + } + + } + + +// --------------------------------------------------------------------------- +// Description : Remove a item from the Map with a given name +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfMap::removeItem(const UString &aName) + { + try + { + for(int i=0; i< mMapDataImpl->mArray.count();i++) + { + if ( *mMapDataImpl->mArray[i]->mName == aName) + { + mMapDataImpl->mArray.remove(i); + break; + } + } + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + + } + +////////////////////// AlfBranch ////////////////////// + +// --------------------------------------------------------------------------- +// Description : 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void AlfBranch::construct( IAlfMap* aData, IAlfMap* aChildData) + { + mBranchData.reset( new( EMM ) AlfBranchDataImpl() ); + + // Take the ownership of the parameter objects + mBranchData->mCurrentData = aData; + mBranchData->mChildData = aChildData; + // No throwing code after the ownership has been transferred, + // it would result to double deletion crash. + + } + +// --------------------------------------------------------------------------- +// Description : 1st Phase Constructor. Leaves the object onto the cleanup stack +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfBranch::AlfBranch(IAlfMap* aData, IAlfMap* aChildData) + { + construct( aData, aChildData ); + } + +// --------------------------------------------------------------------------- +// Description : Default Construtor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfBranch::AlfBranch() + { + mBranchData.reset( new(EMM) AlfBranchDataImpl() ); + } + +// --------------------------------------------------------------------------- +// Description : Map Destructor +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfBranch::~AlfBranch() + { + } + +// --------------------------------------------------------------------------- +// Description : Sorts the branch using user defined callback method +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfBranch::sort( const IAlfSortFunction& aSortFunction ) + { + try + { + for (int i = 0; i < mBranchData->mChildData->count(); ++i) + { + if (mBranchData->mChildData->item(i)->type() == EContainer) + { + IAlfContainer* container = + mBranchData->mChildData->item(i)->container(); + container->sort(aSortFunction); + } + } + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidMapOperation,"AlfMap") + } + } +// --------------------------------------------------------------------------- +// Description : returns the data for this branch as a IAlfMap interface +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfBranch::data() + { + return mBranchData->mCurrentData; + } + + +// --------------------------------------------------------------------------- +// Description : Set the data for this branch +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfBranch::setData( IAlfMap* aData ) + { + delete mBranchData->mCurrentData; + mBranchData->mCurrentData = aData; + } + +// --------------------------------------------------------------------------- +// Description : returns the child data at the given index +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType* AlfBranch::childData(int aIndex) + { + if(aIndex <0 || mBranchData->mChildData->count() <=0) + return NULL; + + int count = 0; + + // Start counting from the first child (item number 1) + for (int i = 0; i < mBranchData->mChildData->count(); ++i) + { + + if ( mBranchData->mChildData->item(i)->type() == IAlfVariantType::EMap || mBranchData->mChildData->item(i)->type() == IAlfVariantType::EBranch ) + { + // Map contains the data for a single child + + if(count == aIndex) + { + return mBranchData->mChildData->item(aIndex); + } + count++; + } + + if (mBranchData->mChildData->item(i)->type() == IAlfVariantType::EContainer) + { + IAlfContainer* container = mBranchData->mChildData->item(i)->container(); + for ( int j = 0; j < container->count(); ++j ) + { + // Container contains data for multiple children + + if(count == aIndex) + { + return mBranchData->mChildData->item(i)->container()->item(aIndex); + } + count ++; + } + } + } + + return NULL; + } + + + +// --------------------------------------------------------------------------- +// Description : returns the child name at the given index +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfBranch::childName(int aIndex) + { + + int count = 0; + + // Start counting from the first child (item number 1) + for (int i = 0; i < mBranchData->mChildData->count(); ++i) + { + + if ( mBranchData->mChildData->item(i)->type() == IAlfVariantType::EMap || mBranchData->mChildData->item(i)->type() == IAlfVariantType::EBranch ) + { + // Map contains the data for a single child + + if(count == aIndex) + { + return mBranchData->mChildData->name(i); + } + count++; + } + if (mBranchData->mChildData->item(i)->type() == IAlfVariantType::EContainer) + { + IAlfContainer* container = mBranchData->mChildData->item(i)->container(); + + if(aIndex >= count && aIndex < (count + container->count()) ) + { + return mBranchData->mChildData->name(i); + } + count+= container->count(); + + } + } + UString* ret(0); + return *ret; + } + + + +// --------------------------------------------------------------------------- +// Description : returns the Data for all childs +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfBranch::childData() + { + return mBranchData->mChildData; + } + +// --------------------------------------------------------------------------- +// Description : Set the data for children of this branch +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfBranch::setChildData( IAlfMap* aChildData ) + { + delete mBranchData->mChildData; + mBranchData->mChildData = aChildData; + } + +// --------------------------------------------------------------------------- +// Description : Api to get the Number of children of a branch +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint AlfBranch::childrenCount() + { + + uint count = 0; + + // Start counting from the first child (item number 1) + for (int i = 0; i < mBranchData->mChildData->count(); ++i) + { + if ( mBranchData->mChildData->item(i)->type() == IAlfVariantType::EMap || + mBranchData->mChildData->item(i)->type() == IAlfVariantType::EBranch ) + { + // Map contains the data for a single child + count++; + } + if (mBranchData->mChildData->item(i)->type() == IAlfVariantType::EContainer) + { + // Container contains data for multiple children + count += mBranchData->mChildData->item(i)->container()->count(); + } + } + + return count; + } + +// --------------------------------------------------------------------------- +// Description : Sets Data to be stored in the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfBranch::set(IAlfVariantType& aValue) + { + (void)aValue; + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Gets the Type of the Variant Data Type +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfVariantType::Type AlfBranch::type() const + { + return IAlfVariantType::EBranch; + } + +// --------------------------------------------------------------------------- +// Description : Returns the Boolean value if the data type in the variant +// structure is a bool +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfBranch::boolean() const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the int value if the data type in the variant +// structure is a int +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfBranch::integer() const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Unsigned value if the data type in the variant +// structure is a unsigned int +// --------------------------------------------------------------------------- +// +OSN_EXPORT uint AlfBranch::uinteger() const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Real value if the data type in the variant +// structure is a Real data +// --------------------------------------------------------------------------- +// +OSN_EXPORT double AlfBranch::real() const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Descriptor value if the data type in the variant +// structure is a string data +// --------------------------------------------------------------------------- +// +OSN_EXPORT const UString& AlfBranch::string() const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Container if the data type in the variant +// structure is a collection +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainer* AlfBranch::container() + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + + +// --------------------------------------------------------------------------- +// Description : Returns the Map if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfMap* AlfBranch::map() + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +// --------------------------------------------------------------------------- +// Description : Returns the Branch if the data type in the variant +// structure is a map +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* AlfBranch::branch() + { + return this; + } + + +// --------------------------------------------------------------------------- +// Description : Returns the User Defined Data Pointer if the data type in the variant +// structure is IAlfModelBase +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfModelBase* AlfBranch::customData() + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } +// --------------------------------------------------------------------------- +// Description : Clones the branch +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfBranch* AlfBranch::clone() + { + try + { + auto_ptr currentData( mBranchData->mCurrentData->clone() ); + auto_ptr childData( mBranchData->mChildData->clone() ); + IAlfBranch* clone = new(EMM) AlfBranch( currentData.get(), childData.get() ); + currentData.release(); // ownership transferred away + childData.release(); // ownership transferred away + + return clone; + } + catch(...) + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + } + +// --------------------------------------------------------------------------- +// Description : Returns true, if objects are equal, false otherwise. +// --------------------------------------------------------------------------- +// +OSN_EXPORT bool AlfBranch::operator==(const IAlfVariantType &/*aOther*/) const + { + ALF_THROW(AlfDataException,EInvalidBranchOperation,"AlfBranch") + } + +} // namespace Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfviewportlayoutattributesetter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfviewportlayoutattributesetter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,432 @@ +/* +* Copyright (c) 2007 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: Implements attributesetters for ViewPortLayout. +* +*/ + + + +//includes + +//widget model includes +#include "alf/alfattributecontainer.h" +#include "alf/alfattribute.h" +#include "alf/alfviewportlayoutattributesetter.h" +#include +#include +#include + +//osn includes +#include + +//alf includes +#include +#include + +//dui includes +#include "alf/attrproperty.h" + +//other includes +#include + + + +//namespaces +using namespace osncore; +using namespace duiuimodel::layoutattributes::viewport; + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfViewportLayoutAttributeSetter::AlfViewportLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfViewportLayoutAttributeSetter:: + ~AlfViewportLayoutAttributeSetter() + { + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +IAlfVariantType* AlfViewportLayoutAttributeSetter::getData( + AlfAttribute& aAttr, IAlfMap* aData) + { + IAlfVariantType* data = 0; + const char* dataField = aAttr.getDataField(); + if (dataField) + { + data = aData->item(UString(dataField)); + } + return data; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +int AlfViewportLayoutAttributeSetter::getTime( + const AlfAttribute& aAttr, bool aImmediate) + { + int time = 0; + if (!aImmediate) + { + time = aAttr.getTime(); + } + return time; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfViewportLayoutAttributeSetter::setAttributeValue( + CAlfVisual &aVisual, AlfAttributeContainer* aContainer, IAlfMap* aData) + { + CAlfViewportLayout* viewportLayout = + dynamic_cast(&aVisual); + if (!viewportLayout) + { + ALF_THROW (AlfVisualException, EInvalidVisual, "AlfViewportLayoutAttributeSetter") + } + AlfCommonLayoutAttributeSetter::setAttributeValue(aVisual, + aContainer, aData); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT TAlfCommand* AlfViewportLayoutAttributeSetter::createCommand( + CAlfVisual& /*aVisual*/, AlfAttributeContainer* /*aContainer*/, + IAlfMap* /*aData*/, int /*aTransitionTime*/, CAlfVisual* /*aRefVisual*/) + { + TAlfCommand* cmd = 0; + return cmd; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfViewportLayoutAttributeSetter::createAndSendCommands( + CAlfVisual& aVisual, + AlfAttributeContainer* aContainer, + CAlfVisual* aRefVisual ) + { + // Call the base class implementation. + // It goes through its loop and checks if there are attributes that it + // handles. + AlfCommonLayoutAttributeSetter::createAndSendCommands(aVisual, + aContainer,aRefVisual); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfViewportLayoutAttributeSetter::handleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + if (!doHandleDynamicDataAttribute(aVisual, aAttr, aContainer, aData)) + { + AlfCommonLayoutAttributeSetter::handleDynamicDataAttribute(aVisual, + aAttr, aContainer, aData); + } + } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +bool AlfViewportLayoutAttributeSetter::doHandleDynamicDataAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate) + { + CAlfViewportLayout* viewportLayout = + dynamic_cast(&aVisual); + if (!viewportLayout) + { + ALF_THROW (AlfVisualException, EInvalidVisual, "AlfViewportLayoutAttributeSetter") + } + bool handled = true; + if (!aData) + { + ALF_THROW (AlfDataException, EInvalidVariantDataType, "AlfViewportLayoutAttributeSetter" ) + } + else + { + const char* attrName = aAttr.name(); + if (!strcmp( attrName, KVirtualHeight)) //also handles: KVirtualWidth + { + // item for both virtual height and virtual width should be there. + const IAlfVariantType* virtualHeight = getData(aAttr, aData); + const IAlfVariantType* virtualWidth = + getData(aContainer.getAttributeByName(KVirtualWidth), aData); + + if (virtualHeight && + virtualHeight->type() == IAlfVariantType::EReal && + virtualWidth && virtualWidth->type() == IAlfVariantType::EReal) + { + viewportLayout->SetVirtualSize( + TAlfRealSize(virtualWidth->real(),virtualHeight->real()), + getTime(aAttr, aImmediate)); + } + else + { + ALF_THROW(AlfDataException, EInvalidVariantDataType, "AlfViewportLayoutAttributeSetter") + } + + } + else if (!strcmp( attrName, KVirtualWidth)) + { + // both virtual height and virtual width should be there + // if attribute for virtual height exists,don't do anything as this + // will be taken care while looking for attribute for virtual + // height, else throw exception + try + { + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KVirtualHeight ); + } + + catch (...) + { + ALF_THROW(AlfDataException, EIncompleteAttributeValues, "AlfViewportLayoutAttributeSetter") + } + } + //also handles: KViewportWidth + else if (!strcmp( attrName, KViewportHeight)) + { + // item for both viewport window height and viewport window width + // should be there. + const IAlfVariantType* viewportHeight = getData(aAttr, aData); + const IAlfVariantType* viewportWidth = + getData(aContainer.getAttributeByName(KViewportWidth), aData); + + if (viewportHeight && + viewportHeight->type() == IAlfVariantType::EReal && + viewportWidth && + viewportWidth->type() == IAlfVariantType::EReal) + { + viewportLayout->SetViewportSize( + TAlfRealSize(viewportWidth->real(),viewportHeight->real()), + getTime(aAttr, aImmediate)); + } + else + { + ALF_THROW(AlfDataException, EInvalidVariantDataType, "AlfViewportLayoutAttributeSetter") + } + } + else if (!strcmp( attrName, KViewportWidth)) + { + // both viewport height and viewport width should be there + // if attribute for viewport height exists,don't do anything as + // this will be taken care while looking for attribute for + // virtual height, else throw exception + try + { + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KViewportHeight ); + } + + catch (...) + { + ALF_THROW(AlfDataException, EIncompleteAttributeValues, "AlfViewportLayoutAttributeSetter") + } + } + //also handles: KViewportPositionY + else if (!strcmp( attrName, KViewportPositionX)) + { + // item for both viewport window X-position and Y-position + // should be there. + const IAlfVariantType* viewportPosX = getData(aAttr, aData); + const IAlfVariantType* viewportPosY = + getData(aContainer.getAttributeByName(KViewportPositionY), + aData); + + if (viewportPosX && + viewportPosX->type() == IAlfVariantType::EReal && + viewportPosY && viewportPosY->type() == IAlfVariantType::EReal) + { + viewportLayout->SetViewportPos( + TAlfRealPoint(viewportPosX->real(),viewportPosY->real()), + getTime(aAttr, aImmediate)); + } + else + { + ALF_THROW(AlfDataException, EInvalidVariantDataType, "AlfViewportLayoutAttributeSetter") + } + } + else if (!strcmp( attrName, KViewportPositionY)) + { + // both viewport window X-position and Y-position should be there + // if attribute for viewport window X-position exists,don't do + // anything as this will be taken care while looking for attribute + // for viewport window X-position, else throw exception + try + { + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KViewportPositionX ); + } + + catch (...) + { + ALF_THROW(AlfDataException, EIncompleteAttributeValues, "AlfViewportLayoutAttributeSetter") + } + } + else + { + handled = false; + } + } + return handled; + } + +void AlfViewportLayoutAttributeSetter::handleStaticDataAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, IAlfMap* aData) + { + // viewport layout does not have any static attribute of its own + // check, if dynamic attribute(but set by user as static), if so, + // set attributes immediately. + if (!doHandleDynamicDataAttribute(aVisual, aAttr,aContainer, aData, true)) + { + AlfCommonLayoutAttributeSetter::handleStaticDataAttribute( + aVisual, aAttr, aContainer, aData); + } + } + +void AlfViewportLayoutAttributeSetter::handleDynamicAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer)) + { + AlfCommonLayoutAttributeSetter::handleDynamicAttribute( + aVisual, aAttr, aContainer); + } + } + +bool AlfViewportLayoutAttributeSetter::doHandleDynamicAttribute( + CAlfVisual &aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer, bool aImmediate) + { + CAlfViewportLayout* viewportLayout = + dynamic_cast(&aVisual); + if (!viewportLayout) + { + ALF_THROW (AlfVisualException, EInvalidVisual, "AlfViewportLayoutAttributeSetter") + } + + bool handled = true; + const char* attrName = aAttr.name(); + if (!strcmp(attrName, KVirtualHeight)||!strcmp(attrName, KVirtualWidth)) + { + // both virtual height and virtual width should be there. + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KVirtualWidth ); + AlfAttribute& attrHt = aContainer.getAttributeByName (KVirtualHeight ); + if(attrWidth.type() == AlfAttributeValueType::EFloat && + attrHt.type() == AlfAttributeValueType::EFloat ) + { + float height = attrHt.realValue(); + float width = attrWidth.realValue(); + viewportLayout->SetVirtualSize( + TAlfRealSize(width,height),getTime(attrHt, aImmediate)); + attrHt.setDirty(false); + attrWidth.setDirty(false); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfViewportLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName, KViewportHeight)|| + !strcmp(attrName, KViewportWidth)) + { + // both viewport window height and width should be there. + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KViewportWidth ); + AlfAttribute& attrHt = + aContainer.getAttributeByName (KViewportHeight ); + if(attrWidth.type() == AlfAttributeValueType::EFloat && + attrHt.type() == AlfAttributeValueType::EFloat ) + { + float height = attrHt.realValue(); + float width = attrWidth.realValue(); + viewportLayout->SetViewportSize( + TAlfRealSize(width,height),getTime(attrHt, aImmediate)); + attrHt.setDirty(false); + attrWidth.setDirty(false); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfViewportLayoutAttributeSetter"); + } + } + else if (!strcmp(attrName, KViewportPositionX)|| + !strcmp(attrName, KViewportPositionY)) + { + // both viewport window X-position and Y-position should be there. + AlfAttribute& attrWidth = + aContainer.getAttributeByName (KViewportPositionY ); + AlfAttribute& attrHt = + aContainer.getAttributeByName (KViewportPositionX ); + if(attrWidth.type() == AlfAttributeValueType::EFloat && + attrHt.type() == AlfAttributeValueType::EFloat ) + { + float xPosition = attrHt.realValue(); + float yPosition = attrWidth.realValue(); + viewportLayout->SetViewportPos( + TAlfRealPoint(xPosition,yPosition),getTime(attrHt, aImmediate)); + attrHt.setDirty(false); + attrWidth.setDirty(false); + } + else + { + ALF_THROW ( AlfAttributeException, EInvalidAttributeValue, "AlfViewportLayoutAttributeSetter"); + } + } + else + { + handled = false; + } + + return handled; + } + +void AlfViewportLayoutAttributeSetter::handleStaticAttribute( + CAlfVisual& aVisual, AlfAttribute& aAttr, + AlfAttributeContainer& aContainer) + { + // viewport layout does not have any static attribute of its own + // check, if dynamic attribute(but set as static by the user), + // if so, set attributes immediately. + if (!doHandleDynamicAttribute(aVisual, aAttr, aContainer, true)) + { + AlfCommonLayoutAttributeSetter::handleStaticAttribute(aVisual, aAttr, + aContainer); + } + } + + } // Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfvisualtemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfvisualtemplate.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,671 @@ +/* +* Copyright (c) 2007 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: Visual template class for alfred widget model. +* This class creates and updates visual tree. +* +*/ + + + + +//INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include "alf/alfperf.h" +#include +#include +#include "alf/alfvisualtemplate.h" +#include "alf/alfvarianttype.h" +#include "alf/ialfattributesetter.h" +#include "alf/alfattributecontainer.h" +#include "alf/alfattribute.h" + +// The number of attribute setters is usually between 1 and 5 +static const int KAttributeArrayGranularity = 4; +static const int KContainerArrayGranularity = 4; + +namespace Alf + { + +struct DeleteTemplate +{ + void operator()(const IAlfVisualTemplate* aTemplate) const + { + delete aTemplate; + } +}; + +// ----------------------------------------------------------------------------- +// Helper function to iterate through a visual template hierarchy and +// investigate whether a given visual template exists in it. +// ----------------------------------------------------------------------------- +bool existsInHierarchy(IAlfVisualTemplate& aRoot, const IAlfVisualTemplate& aTemplate) + { + // Check the template against the root node. + if(&aTemplate == &aRoot) + { + return true; + } + + // Iterate through all the root's children + for(int i = 0; i < aRoot.numChildTemplates(); ++i) + { + if(existsInHierarchy(aRoot.childTemplate(i), aTemplate)) + { + return true; + } + } + + return false; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate* AlfVisualTemplate::create() + { + return new( EMM ) AlfVisualTemplate; + } + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate* AlfVisualTemplate::create(TAlfVisualType aType) + { + return new( EMM ) AlfVisualTemplate( aType ); + } + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate* AlfVisualTemplate::create(TAlfLayoutType aType) + { + return new( EMM ) AlfVisualTemplate( aType ); + } + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate::AlfVisualTemplate(): + mVisualType(EAlfVisualTypeVisual), + mAttributeArray(KAttributeArrayGranularity), + mContainerArray(KContainerArrayGranularity), + mSelectOneChild(false), + mOwner(0), + mParent(0) + { + } + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate::AlfVisualTemplate(TAlfVisualType aType): + mVisualType(aType), + mAttributeArray(KAttributeArrayGranularity), + mContainerArray(KContainerArrayGranularity), + mSelectOneChild(false), + mOwner(0), + mParent(0) + { + } + +// --------------------------------------------------------------------------- +// Description : Constructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate::AlfVisualTemplate(TAlfLayoutType aType): + mVisualType(-1 - aType), + mAttributeArray(KAttributeArrayGranularity), + mContainerArray(KContainerArrayGranularity), + mSelectOneChild(false), + mOwner(0), + mParent(0) + { + } + +// --------------------------------------------------------------------------- +// Description : Destructor +// --------------------------------------------------------------------------- +OSN_EXPORT AlfVisualTemplate::~AlfVisualTemplate() + { + mBrushArray.clear(); + mAttributeArray.clear(); + mContainerArray.clear(); + + // Remove this visual template from it's parent or owner + if(parent()) + { + parent()->removeChildTemplate(*this); + } + if(owner()) + { + owner()->removeVisualTemplate(); + } + + // Destroy child visual templates in two passes, since destructor of a child + // visual template could affect the content of the this visual template's child vector. + vector children(mChildren); + mChildren.clear(); + for_each(children.begin(), children.end(), DeleteTemplate()); + } + +// --------------------------------------------------------------------------- +// Description : Set the owner element. +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setOwner(IAlfElement* aOwner) throw() + { + if(aOwner != mOwner) + { + // Remove this visual template from it's parent. Parent and owner are + // mutually exclusive properties on a visual template. + if(aOwner && (parent() != 0)) + { + parent()->removeChildTemplate(*this); + } + + // Set the owner of this visual template. + mOwner = aOwner; + } + } + +OSN_EXPORT IAlfElement* AlfVisualTemplate::owner() const throw() + { + return mOwner; + } + +// --------------------------------------------------------------------------- +// Description : Set the name of the visual, i.e., the tag. +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setName(const char* aName) + { + mVisualName = UString(aName); + } + +// --------------------------------------------------------------------------- +// Description : Get the name of the visual, i.e., the tag. +// --------------------------------------------------------------------------- +OSN_EXPORT const char* AlfVisualTemplate::name() const throw() + { + return mVisualName.getUtf8(); + } + +// --------------------------------------------------------------------------- +// Description : Add a child visual template. +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::addChildTemplate(IAlfVisualTemplate& aChild) + { + insertChildTemplate(aChild, mChildren.size()); + } + +// --------------------------------------------------------------------------- +// Description : Inserts a child visual template at given index +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::insertChildTemplate(IAlfVisualTemplate& aChild, int aIndex) + { + if(!(aIndex >=0 && aIndex <= mChildren.size())) + ALF_THROW(AlfException, EInvalidArrayIndex, "AlfVisualTemplate::insertChildTemplate() - Index out of bounds."); + + // Verify that the given argument is valid + if(existsInHierarchy(*this, aChild)) + { + ALF_THROW(AlfException, EInvalidHierarchy, "AlfVisualTemplate::insertChildTemplate() - Adding a child visual template that is already in the hierarchy."); + } + if(existsInHierarchy(aChild, *this)) + { + ALF_THROW(AlfException, EInvalidHierarchy, "AlfVisualTemplate::insertChildTemplate() - Attempt to create a recursive visual template tree."); + } + if(layoutType() < 0) + { + ALF_THROW(AlfException, EInvalidHierarchy, "AlfVisualTemplate::insertChildTemplate() - Attempt to add a child visual into a non-layout visual template."); + } + + // Insert child visual template to the array + mChildren.insert(mChildren.begin() + aIndex, &aChild); + + // Remove child from previous hierarchy and add it under this visual template. + if(aChild.parent()) + { + // Visual template cannot have a parent and owner at the same time. + assert(aChild.owner() == 0); + aChild.parent()->removeChildTemplate(aChild); + } + if(aChild.owner()) + { + // Visual template cannot have a parent and owner at the same time. + assert(aChild.parent() == 0); + aChild.owner()->removeVisualTemplate(); + } + + // Set a new parent for this visual template. + aChild.setParent(this); + } + +// --------------------------------------------------------------------------- +// Description : Destroyes a child visual template at given index +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::destroyChildTemplate(int aIndex) throw() + { + // Remove and destroy a child template by the given index + if(aIndex >=0 && aIndex < mChildren.size()) + { + IAlfVisualTemplate* child = mChildren[aIndex]; + removeChildTemplate(*child); + delete child; + } + } + +// --------------------------------------------------------------------------- +// Description : Destroyes a child visual template.with the given name +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::destroyChildTemplate(const char* aName) throw() + { + // Search through the children for the given name. + for(int i = 0; i < mChildren.size() ;i++) + { + if(!strcmp(mChildren[i]->name(), aName)) + { + // Remove and destroy the found child visual template + IAlfVisualTemplate* child = mChildren[i]; + removeChildTemplate(*child); + delete child; + } + } + } + +// --------------------------------------------------------------------------- +// Description : Get the number of child visual templates. +// --------------------------------------------------------------------------- +OSN_EXPORT int AlfVisualTemplate::numChildTemplates() const throw() + { + return mChildren.size(); + } + +// --------------------------------------------------------------------------- +// Description : Get a child visual template. +// --------------------------------------------------------------------------- +OSN_EXPORT IAlfVisualTemplate& AlfVisualTemplate::childTemplate(int aIndex) const + { + if((aIndex < 0) || (aIndex >= numChildTemplates())) + { + ALF_THROW(AlfException, EInvalidArrayIndex, "AlfVisualTemplate::childTemplate() - Index out of bounds."); + } + return *mChildren[aIndex]; + } + +// ----------------------------------------------------------------------------- +// Description : Add a new visual attribute setter. The ownership is not passed. +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::addAttributeSetter( + IAlfAttributeSetter* aSetter, AlfAttributeContainer* aContainer ) + { + mAttributeArray.resize(mAttributeArray.count()+1); + mContainerArray.resize(mContainerArray.count()+1); + + mAttributeArray.insert(mAttributeArray.count(),aSetter); + mContainerArray.insert(mContainerArray.count(),aContainer); + } + +// ----------------------------------------------------------------------------- +// Description : Get the number of visual attribute setters. +// ----------------------------------------------------------------------------- +OSN_EXPORT int AlfVisualTemplate::numAttributeSetters() const throw() + { + return mAttributeArray.count(); + } + +// ----------------------------------------------------------------------------- +// Description : Get a visual attribute setter. +// ----------------------------------------------------------------------------- +OSN_EXPORT IAlfAttributeSetter& AlfVisualTemplate::attributeSetter(int aIndex) const + { + if((aIndex < 0) || (aIndex >= mAttributeArray.count())) + { + ALF_THROW(AlfException, EInvalidArrayIndex, "AlfVisualTemplate::attributeSetter() - Index out of bounds."); + } + return *mAttributeArray[aIndex]; + } + +// ----------------------------------------------------------------------------- +// Description : +// ----------------------------------------------------------------------------- +OSN_EXPORT AlfAttributeContainer& AlfVisualTemplate::attributeContainer(int aIndex) const + { + if((aIndex < 0) || (aIndex >= mContainerArray.count())) + { + ALF_THROW(AlfException, EInvalidArrayIndex, "AlfVisualTemplate::attributeContainer() - Index out of bounds."); + } + return *mContainerArray[aIndex]; + } + +// ----------------------------------------------------------------------------- +// Description : Update an existing visual tree with new values +// ----------------------------------------------------------------------------- +OSN_EXPORT CAlfVisual* AlfVisualTemplate::updateVisualTree(IAlfMap* aData, IAlfMap* aOldData, CAlfVisual& aVisual) + { + + CAlfVisual* retVisual = &aVisual; + // Update the attributes. + for (int i = 0; i < mAttributeArray.count(); ++i) + { + try + { + //ALF_PERF_START( perfdata, "AlfVisualTemplate-updateVisualTree-SetAttributeValue") + mAttributeArray[i]->setAttributeValue(aVisual, mContainerArray[i], aData); + //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-updateVisualTree-setAttributeValue") + } + catch (...) + { + ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate") + } + } + // Pass to children + if (mChildren.size()) + { + int ind = selectedChildInd( aData ); + if (ind >= 0 && ind < mChildren.size()) + { + CAlfLayout *layout = (CAlfLayout *)&aVisual; + int indOld = selectedChildInd( aOldData ); + if ( ind == indOld ) + { + mChildren[ind]->updateVisualTree( aData, aOldData, *layout ); + } + else + { + CAlfControl& c(aVisual.Owner()); + + //new visual tree is created. Replaces the current (now old) layout, + //which is removed from its parent and destroyed. + //new layout is returned from the function. + CAlfLayout* parentLayout = layout->Layout(); + TInt ind = parentLayout->FindVisual(layout); + parentLayout->Remove(layout); + layout->RemoveAndDestroyAllD(); + CAlfLayout* newLayout = (CAlfLayout *) createVisualTree(c, aData, parentLayout, ind); + retVisual = newLayout; + } + } + else + { + CAlfLayout *layout = (CAlfLayout *)&aVisual; + for (int i = 0; i < mChildren.size(); ++i) + { + mChildren[i]->updateVisualTree(aData, aOldData, layout->Visual(i)); + } + } + } + return retVisual; + } + +// ----------------------------------------------------------------------------- +// Description : create a new visual tree and initialize the visuals +// ----------------------------------------------------------------------------- +OSN_EXPORT CAlfVisual* AlfVisualTemplate::createVisualTree(CAlfControl& aControl, + IAlfMap* aData, CAlfLayout* aParentLayout, int aLayoutIndex) + { + // create the visual + CAlfVisual *result = NULL; + CAlfLayout *layout = NULL; + if (!mSelectOneChild) + { + if (mVisualType < 0) + { + //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout") + // create layout + result = layout = AlfVisualFactory::NewLayoutL( + (TAlfLayoutType)(-1 - mVisualType), aParentLayout, aControl, aControl.Env()); + //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout") + if (!result) + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate") + } + } + else + { + // create visual + //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual") + result = AlfVisualFactory::NewVisualL( + (TAlfVisualType)mVisualType, aParentLayout, aControl, aControl.Env()); + //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual") + if (!result) + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate") + } + + //Add the brushes to the visual + result->EnableBrushesL(true); + for (int i=0; i < mBrushArray.count(); i++) + { + result->Brushes()->AppendL(mBrushArray[i], EAlfDoesNotHaveOwnership); + } + } + if (aParentLayout && + aLayoutIndex >= 0 && aLayoutIndex <= aParentLayout->Count()) + { + //when aConstructedWithParentInformation- parameter is ETrue, + //no message sent to server + aParentLayout->Append(result, ETrue); + + //reorder, if needed. + if (aLayoutIndex != aParentLayout->Count() - 1) + { + aParentLayout->Reorder(*result, aLayoutIndex); + } + } + aControl.Append(result); + + if (mVisualName.isNull()) + mVisualName = UString(""); + result->SetTagL(TPtrC8((unsigned char*)mVisualName.getUtf8())); + + // Set the attributes + for (int i = 0; i < mAttributeArray.count(); ++i) + { + try + { + //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue") + // set dirtines of all attribute in createvisualtree + for(int j = 0; j < mContainerArray[i]->attributeCount() ;j++ ) + { + mContainerArray[i]->getAttribute(j).setDirty(true); + } + mAttributeArray[i]->setAttributeValue(*result, mContainerArray[i], aData); + //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue") + } + catch (...) + { + ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate") + } + } + } + + // Pass to children + int ind = selectedChildInd( aData ); + if (ind >= 0 && ind < mChildren.size()) + { + result = mChildren[ind]->createVisualTree(aControl, aData, aParentLayout, aLayoutIndex); + } + else if (!mSelectOneChild) + { + for (int i = 0; i < mChildren.size(); ++i) + { + mChildren[i]->createVisualTree(aControl, aData, layout, i); + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// reads and returns selected ind from data, if set. If not set returns -1. +// ----------------------------------------------------------------------------- +int AlfVisualTemplate::selectedChildInd( IAlfMap* aData ) + { + int ind = -1; + if (aData && mSelectOneChild) + { + IAlfVariantType* data = aData->item(mChildIndFieldName); + + //field value contains index to child array. + //if field contains no data and template has only one + // child, assume it's the child wanted. + bool valueIsEmpty = false; + if (!data) + { + valueIsEmpty = true; + } + else + { + switch ( data->type() ) + { + case IAlfVariantType::EInt: + ind = data->integer(); + break; + default: + break; + } + } + if ( valueIsEmpty && mChildren.size() == 1 ) + { + ind = 0; + } + } + return ind; + } + +// ----------------------------------------------------------------------------- +// Description : Removes a visual template from the child array without +// destroying the child template object. +// ----------------------------------------------------------------------------- +void AlfVisualTemplate::removeChildTemplate(IAlfVisualTemplate& aChild) throw() + { + std::vector::iterator it = find(mChildren.begin(), mChildren.end(), &aChild); + if(it != mChildren.end()) + { + mChildren.erase(it); + aChild.setParent(0); + } + } + +// ----------------------------------------------------------------------------- +// Description : Returns the parent visual template object +// ----------------------------------------------------------------------------- +OSN_EXPORT IAlfVisualTemplate* AlfVisualTemplate::parent() const throw() + { + return mParent; + } + +// ----------------------------------------------------------------------------- +// Description : Set the visual type +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setParent(IAlfVisualTemplate* aParent) throw() + { + mParent = aParent; + } + +// ----------------------------------------------------------------------------- +// Description : Set the visual type +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setVisualType(TAlfVisualType aType) + { + mVisualType = aType; + } + +// ----------------------------------------------------------------------------- +// Description : Get the visual type +// ----------------------------------------------------------------------------- +OSN_EXPORT int AlfVisualTemplate::visualType() const throw() + { + return mVisualType; + } +// ----------------------------------------------------------------------------- +// Description : Set the layout type +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setLayoutType(TAlfLayoutType aType) + { + mVisualType = -1 - aType; + } + +// ----------------------------------------------------------------------------- +// Description : Get the layout type +// ----------------------------------------------------------------------------- +OSN_EXPORT int AlfVisualTemplate::layoutType() const throw() + { + return -1 - mVisualType; + } + +// ----------------------------------------------------------------------------- +// Description : Adds brush to the brush array. +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::addBrush(CAlfBrush& aBrush) + { + mBrushArray.resize(mBrushArray.count()+1); + mBrushArray.insert(mBrushArray.count(),&aBrush); + } + +// ----------------------------------------------------------------------------- +// Description : Get the munber of brushes +// ----------------------------------------------------------------------------- +OSN_EXPORT int AlfVisualTemplate::numBrushes() const + { + return mBrushArray.count(); + } + +// ----------------------------------------------------------------------------- +// Description : Get a Brush +// ----------------------------------------------------------------------------- +OSN_EXPORT CAlfBrush& AlfVisualTemplate::brush(int aIndex) const + { + return *mBrushArray[aIndex]; + } + + +// ----------------------------------------------------------------------------- +// Description : puts the class in to selected child mode. +// ----------------------------------------------------------------------------- +OSN_EXPORT void AlfVisualTemplate::setSelectChildMode(bool aSelectChild, + const UString& aChildIndFieldName ) + { + mSelectOneChild = aSelectChild; + mChildIndFieldName = aChildIndFieldName; + } + + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the visual template. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfVisualTemplate::makeInterface( const IfId& aType ) + { + UString param(aType.mImplementationId); + if (param == IAlfVisualTemplate::type().mImplementationId) + { + return static_cast(this); + } + return NULL; + } + + } //Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidget.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,498 @@ +/* +* Copyright (c) 2007 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: The base class for all widgets. +* +*/ + + +#include +#include "alf/alfwidget.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "alf/alfattribute.h" +#include "alf/alfattributevaluetype.h" +#include "alf/ialfattributeowner.h" +#include +#include +#include +#include +#include +#include + +#include "alfwidgetimpl.h" +#include "alfwidgetattributeownerimpl.h" +#include "ialfhostapi.h" + +namespace Alf + { + +// ======== MEMBER FUNCTIONS ======== + +OSN_EXPORT AlfWidget::AlfWidget() + { + } + +OSN_EXPORT AlfWidget::AlfWidget(const char* aWidgetName) + { + mImpl.reset(new (EMM) AlfWidgetImpl()); + mImpl->setWidgetName(UString(aWidgetName)); + addCommonWidgetProperties(); + } + +OSN_EXPORT AlfWidget::AlfWidget(const char* aWidgetName, IAlfContainerWidget& aContainer, CAlfEnv& aEnv) + { + mImpl.reset(new (EMM) AlfWidgetImpl()); + mImpl->setWidgetName(UString(aWidgetName)); + addCommonWidgetProperties(); + + // Create default control for the widget so that widget containment hierarchy can be + // created. + if(!control()) + { + auto_ptr control(new (EMM) CAlfWidgetControl(aEnv)); + setControl(control.get(), false); + control.release(); + } + + // Add this widget to the container widget + aContainer.addWidget(*this); + } + +void AlfWidget::addCommonWidgetProperties() + { + } + +void AlfWidget::removeReferenceFromControl() + { + // Make sure that the widget's control is not pointing to this widget anymore + if(control() && (control()->widget() == this)) + { + control()->setOwnerWidget(0); + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidget::~AlfWidget() + { + + if( control() && control()->Host() ) + { + CAlfWidgetControl* parentControl = + dynamic_cast( control()->Host() ); + + if (control()->Focus()) + { + control()->CAlfWidgetControl::RelinquishFocus(); + } + + // This widget is now deleted and it needs to be removed from the + // container to avoid double deletion. + if (parentControl) + { + AlfWidget* widget = parentControl->widget(); + if (widget) + { + widget->removeWidget( *this ); + } + } + } + + // Delete and remove all the connected child widgets. + // AlfWidgetFactory::destroyWidget causes ~AlfWidget to be called for + // the child widget so this works recursively. Note that it also + // then removes the connection to the container widget in the beginning + // of ~AlfWidget destructor call. + + IAlfWidgetFactory& factory = AlfWidgetEnvExtension::widgetFactory(*(CAlfEnv::Static())); + + while ( widgetCount() ) + { + // Destroy the child widget and also remove it from the child widget + // array to make sure that this loop terminates. + // Normally also ~AlfWidget of the child widget removes the destroyed widget + // from this widget's child array, but that might not be the case + // if the child widget has not been added in the CAlfEnv + // (all widgets should always be added there). + // If not added in the env, destroyWidget does not delete the widget! + + IAlfWidget* child = mImpl->getWidget( 0 ); + + removeWidget( *child ); + IAlfWidget* actual = factory.findWidget( child->widgetName() ); + if( actual ) + { + factory.destroyWidget(actual); + } + } + + // Ensure that the control is not pointing back to this widget + removeReferenceFromControl(); + } + + +OSN_EXPORT CAlfWidgetControl* AlfWidget::control() const + { + return mImpl->control(); + } + +// --------------------------------------------------------------------------- +// return the parent container +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfContainerWidget* AlfWidget::parent() const + { + CAlfWidgetControl* ctrl = control(); + assert(ctrl); //should always be set. + + IAlfContainerWidget* containerWidget = 0; + CAlfWidgetControl* parentControl = + dynamic_cast(ctrl->Host()); + IAlfWidgetFactory& factory = AlfWidgetEnvExtension::widgetFactory(*(CAlfEnv::Static())); + if (parentControl) + { + IAlfWidget* widget = parentControl->widget(); + if (widget) + { + //control->widget may return wrong instance, temporary fix, + // find widget from the CAlfEnv. + const char* name = widget->widgetName(); + IAlfWidget* w = factory.findWidget(name); + containerWidget = + IAlfWidget::makeInterface(w); + assert(containerWidget); + } + } + + return containerWidget; + } + +// --------------------------------------------------------------------------- +// Sets the new control for this widget. The control will be automatically +// added as an observer for the model, and notified about any +// model changes (e.g., modelChangedL()). +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidget::setControl(CAlfWidgetControl* aControl, bool aDeletePreviousControl) + { + CAlfWidgetControl* myControl = control(); + if(aControl && (aControl != myControl)) + { + // Throw exception if the set control is still a control of another widget + if(aControl->widget()) + { + ALF_THROW(AlfException, EInvalidArgument, "AlfWidget::setControl() - Control is already set to another widget."); + } + + // Append control to widget's control group + if(myControl) + { + assert(myControl->ControlGroup() != 0); + aControl->resetControlGroup(*myControl->ControlGroup()); + + // Move connections from old control to new control + IAlfHostAPI& oldHostApi = myControl->hostAPI(); + IAlfHostAPI& newHostApi = aControl->hostAPI(); + + // Move old controls children under new control + int childCount = oldHostApi.getConnectionCount(); + while(childCount > 0) + { + newHostApi.setConnection(*oldHostApi.getConnection(0), EChild); + childCount--; + } + + //relinquishfocus or else pointer is left in roster, even though memory for it + //might be released. Must be called before connection removed. + if (myControl->Focus()) + { + myControl->RelinquishFocus(); + } + + // Move new control under the old control's parent and remove old control from the parent. + if(myControl->Host()) + { + CAlfWidgetControl* parent = dynamic_cast(myControl->Host()); + if(parent) + { + IAlfHostAPI& parentHostApi = parent->hostAPI(); + parentHostApi.setConnection(*aControl, EChild); + parentHostApi.removeConnection(*myControl); + } + } + } + + // Set the owner widget of the control to point to this widget + aControl->setOwnerWidget(this); + + // Remove reference to this widget from the previous control + removeReferenceFromControl(); + } + mImpl->setControl(aControl, aDeletePreviousControl); + } + +OSN_EXPORT IAlfModel* AlfWidget::model() + { + return mImpl->model(); + } + +// --------------------------------------------------------------------------- +// Sets the new model for this widget. If a control exists, it is automatically +// added as an observer for the model and notified for the model change. +// The old model is released. +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidget::setModel( IAlfModel* aModel,bool aTakeOwnerShip) + { + mImpl->setModel( aModel ,aTakeOwnerShip); + } + + +OSN_EXPORT const char* AlfWidget::widgetName() const + { + return mImpl->widgetName().getUtf8(); + } + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// Static getter for interfaces provided by the widget, the control, or the model. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfWidget::makeInterface( AlfWidget* aWidget, const IfId& aType ) + { + if ( !aWidget ) + { + return NULL; + } + else + { + return aWidget->makeInterface( aType ); + } + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the widget. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* AlfWidget::makeInterface( const IfId& aType ) + { + UString param(aType.mImplementationId); + if ( param == IAlfWidget::type().mImplementationId ) + { + return static_cast(this); + } + else if (param == IAlfAttributeOwner::type().mImplementationId ) + { + return static_cast(mImpl->getAttributeOwner()); + } + else if (param == IAlfContainerWidget::type().mImplementationId ) + { + return static_cast(this); + } + IAlfInterfaceBase* result = NULL; + if (control()) + { + result = control()->makeInterface(aType); + } + if (!result && model()) + { + result = model()->makeInterface(aType); + } + return result; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +OSN_EXPORT int AlfWidget::widgetCount() const + { + return mImpl->widgetCount(); + } + +// --------------------------------------------------------------------------- +// From class IAlfContainerWidget +// --------------------------------------------------------------------------- +OSN_EXPORT void AlfWidget::addWidget(IAlfWidget& aWidget) + { + // There should never be a situation where add widget is called on a + // widget without a control. + assert(aWidget.control() != 0); + assert(control() != 0); + assert(control()->ControlGroup() != 0); + + // Throw an exception if widget is added to itself. + IAlfWidget* self = static_cast(this); + if(self == &aWidget) + { + ALF_THROW(AlfException, EInvalidArgument, "Tried to add a widget to itself."); + } + + // Throw an exception if added widget is a view widget. + IAlfViewWidget* view = aWidget.makeInterface(&aWidget); + if(view != 0) + { + ALF_THROW(AlfException, EInvalidArgument, "Attempted to add a view widget into a container widget."); + } + + // Bail out if the given widget is already added in this widget. + if(mImpl->findWidget(static_cast(&aWidget)) != -1) + { + return; + } + + // Append the added widget and its children to widget's control group. + aWidget.control()->resetHierarchyControlGroup(*control()->ControlGroup()); + + // Append widget to widget array and remove widget from previous container's widget array. + mImpl->addWidget(static_cast(&aWidget)); + CAlfWidgetControl* parentControl = dynamic_cast(aWidget.control()->Host()); + if( parentControl ) + { + parentControl->widget()->removeWidget(aWidget); + } + + // Set connection to added widget's control + CAlfWidgetControl* cntrl = control(); + if (cntrl) + { + IAlfHostAPI& hostApi = cntrl->hostAPI(); + try + { + hostApi.setConnection(*aWidget.control(), EChild); + } + catch (AlfException &e) + { + removeWidget(aWidget); + // Attempt to add it back to the old. + if(parentControl) + { + parentControl->widget()->mImpl->addWidget(static_cast(&aWidget)); + hostApi.setConnection(*parentControl, EChild); + } + throw(e); + } + } + } + +OSN_EXPORT IAlfWidget* AlfWidget::getWidget(int aIndex) const + { + return mImpl->getWidget(aIndex); + } + +OSN_EXPORT int AlfWidget::getWidgetIndex(IAlfWidget& aWidget) const + { + return mImpl->findWidget(static_cast(&aWidget)); + } + +OSN_EXPORT void AlfWidget::removeWidget(int aIndex) + { + IAlfWidget* widget = getWidget(aIndex); //get the widget + CAlfWidgetControl* cntrl = control(); + if (widget && cntrl) + { + CAlfWidgetControl* childcontrol = widget->control(); + if(childcontrol) + { + if (childcontrol->Focus()) + { + try + { + childcontrol->RelinquishFocus(); + } + catch(...) + { + // ignore any problems with getting rid of focus + } + } + else if(childcontrol->isContainer()) + { + CAlfWidgetControl* focused = + dynamic_cast(childcontrol->FocusedConnection()); + if(focused) + { + try + { + control()->processEvent(TAlfEvent(EEventFocusNextWidget)); + } + catch(...) + { + // cannot fail because of event processing to get rid of focus + } + } + } + IAlfHostAPI& hostApi = cntrl->hostAPI(); + hostApi.removeConnection(*childcontrol); //remove from hierarchy + } + } + mImpl->removeWidget(aIndex); //remove it from array + } + +OSN_EXPORT void AlfWidget::applyLayout(IAlfLayoutManager& aLayout) + { + CAlfWidgetControl* cntrl = control(); + if (cntrl) + { + IAlfHostAPI& hostApi = cntrl->hostAPI(); + + //remove connections first + for (int i=0 ; i< widgetCount() ; i++) + { + IAlfWidget* widget = getWidget(i); + hostApi.removeConnection(*widget->control()); + } + + hostApi.setBaseLayout(aLayout); + + //add connections again, when new layout has been set. + for (int i=0 ; i< widgetCount() ; i++) + { + IAlfWidget* widget = getWidget(i); + hostApi.setConnection(*(widget->control()),EChild); + } + } + } + +OSN_EXPORT void AlfWidget::setChildFocus(bool /*aFocus*/) + { + + } + +OSN_EXPORT void AlfWidget::setPresentation(const char* /*aFilePath*/) + { + } + + +OSN_EXPORT void AlfWidget::removeWidget(IAlfWidget& aWidget) + { + for(int i = 0; i < mImpl->widgetCount(); ++i) + { + if(mImpl->getWidget(i) == &aWidget) + { + mImpl->removeWidget(i); + break; + } + } + } + + }//namespace Alf + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetattributeownerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetattributeownerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,515 @@ +/* +* Copyright (c) 2007 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: Implementation of the IAlfAttributeOwner interface +* for AlfWidget. +* +*/ + + +#include +#include "alf/alfattribute.h" +#include +#include +#include +#include "alf/attrproperty.h" +#include "alf/alfattributecontainer.h" +#include + + +#include "alfwidgetattributeownerimpl.h" + +using namespace duiuimodel; + +namespace Alf + { + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +AlfWidgetAttributeOwnerImpl::AlfWidgetAttributeOwnerImpl( + CAlfWidgetControl* aControl) : + mControl(aControl) + { + mAttributeList.setAutoDelete(true); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +AlfWidgetAttributeOwnerImpl::~AlfWidgetAttributeOwnerImpl() + { + mAttributeList.clear(); + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the widget. +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfWidgetAttributeOwnerImpl::makeInterface( + const IfId& aType) + { + UString param(aType.mImplementationId); + if (param == IAlfAttributeOwner::type().mImplementationId) + { + return static_cast(this); + } + return 0; + } + +// --------------------------------------------------------------------------- +// Get the number of available attributes. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +int AlfWidgetAttributeOwnerImpl::attributeCount() const + { + int count = mAttributeList.count(); + // Add control attribute count. + IAlfAttributeOwner* control = + IAlfInterfaceBase::makeInterface(mControl); + if (control) + { + count += control->attributeCount(); + // Add root element attribute count + for (int i = 0; i < mControl->numElements(); i++) + { + IAlfElement& element = mControl->element(i); + if (element.parentElement() == 0) + { + // Get the attribute interface + IAlfAttributeOwner* attributeOwner = + IAlfInterfaceBase::makeInterface(&element); + + if (attributeOwner) + { + count += attributeOwner->attributeCount(); + } + } + } + } + + return count; + } + +// --------------------------------------------------------------------------- +// Gets the attribute with the given name. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +const AlfAttribute* AlfWidgetAttributeOwnerImpl::getAttribute( + const UString& aAttribName) const + { + const AlfAttribute* attribute = 0; + + // Try to find from widget + for (int i = 0; i < mAttributeList.count(); i++) + { + if (!strcmp(aAttribName.getUtf8(), mAttributeList[i]->name())) + { + attribute = mAttributeList[i]; + break; + } + } + + if (!attribute) + { + // Try to find from control + IAlfAttributeOwner* control = + IAlfInterfaceBase::makeInterface(mControl); + + if (control) + { + attribute = control->getAttribute(aAttribName); + } + + if (!attribute) + { + // Try to find from root elements + for (int i = 0; i < mControl->numElements(); i++) + { + IAlfElement& element = mControl->element(i); + if (element.parentElement() == 0) + { + // Get the attribute interface + IAlfAttributeOwner* attributeOwner = + IAlfInterfaceBase::makeInterface(&element); + + if (attributeOwner) + { + attribute = attributeOwner->getAttribute(aAttribName); + if (attribute) + { + break; + } + } + } + } + } + + } + + return attribute; + } + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::setAttribute(const AlfAttribute& aAttribute) + { + // The attribute must have at least one value set. + if (!aAttribute.getTargetValueCount()) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfWidgetAttributeOwnerImpl") + } + + if (canHandleAttribute(aAttribute.name())) + { + // Check whether the attribute exists already. + int i = 0; + for (i = 0; i < mAttributeList.count() ; i++) + { + if (!strcmp(aAttribute.name(), mAttributeList[i]->name())) + { + // Attribute exists already, modify the contents. + *mAttributeList[i] = aAttribute; + handleAttribute(*mAttributeList[i]); + return true; + } + } + + // Attribute with the given name does not exist, + // clone the given attribute and insert it in the list. + mAttributeList.resize(mAttributeList.count() + 1); + // Insert cannot fail because already resized. + mAttributeList.insert(mAttributeList.count(), + const_cast(aAttribute).clone()); + handleAttribute(*mAttributeList[i]); + return true; + } + + bool supported(false); + bool sendevent(true); + + // Let the control try to handle attribute. + IAlfAttributeOwner* control = + IAlfInterfaceBase::makeInterface(mControl); + if (control) + { + supported = control->setAttribute(aAttribute); + } + + // Let the root elements try to handle attribute + if (!supported) + { + supported = handleElementAttribute(aAttribute); + sendevent = false; //event already sent + } + + //inform env of attribute setting + if (supported && sendevent) + { + UString target; + auto_ptr attribute(new (EMM) AlfAttribute()); + *attribute.get() = aAttribute; + TAlfWidgetAttributeCommand command(attribute.get(), target, mControl->widget()); + attribute.release(); + command.ExecuteL(mControl->Env()); + } + + return (supported); + } + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::setAttribute( + const UString& aAttribName, AlfAttributeValueType* aValue) + { + if (!aValue) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfWidgetAttributeOwnerImpl") + } + + // Create a new attribute. + auto_ptr attribute( + new (EMM) AlfAttribute(aAttribName.getUtf8(), AlfAttribute::EStatic)); + attribute->addTargetValue(aValue); + + return setAttribute(*attribute.get()); + } +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::setAttribute( const UString& aTargetId , + AlfAttribute& aAttribute ) + { + + bool supported(false); + + // The attribute must have at least one value set. + if (!aAttribute.getTargetValueCount()) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfWidgetAttributeOwnerImpl") + } + + if (!aTargetId.isEmpty() + && mControl) + { + + // Try to find from control + IAlfAttributeOwner* control = + IAlfInterfaceBase::makeInterface(mControl); + if (control) + { + supported = control->setAttribute(aTargetId, aAttribute); + } + + if (!supported) + { + // Try finding element class using targetId + IAlfElement* elem = mControl->findElement(aTargetId.getUtf8()); + if (elem) + { + IAlfAttributeOwner* elementOwner = IAlfInterfaceBase::makeInterface(elem); + if (elementOwner) + { + supported = elementOwner->setAttribute(aTargetId, aAttribute); + } + } + } + } + + //inform env of attribute change + if (supported) + { + UString target(aTargetId); + auto_ptr attribute(new (EMM) AlfAttribute()); + *attribute.get() = aAttribute; + TAlfWidgetAttributeCommand command(attribute.get(), target, mControl->widget()); + attribute.release(); + command.ExecuteL(mControl->Env()); + } + + return supported; + + } + +// --------------------------------------------------------------------------- +// Set a value of an attribute. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::setAttribute( const UString& aTargetId, + const UString& aAttribName, + AlfAttributeValueType* aValue ) + { + bool ret(false); + + if (!aValue) + { + ALF_THROW( + AlfAttributeException, EInvalidAttribute, "AlfWidgetAttributeOwnerImpl") + } + + if (!aTargetId.isEmpty()) + { + // Create a new static attribute. + auto_ptr attribute( + new (EMM) AlfAttribute(aAttribName.getUtf8(), AlfAttribute::EStatic)); + attribute->addTargetValue(aValue); + ret = setAttribute(aTargetId, *attribute.get()); + + } + + return ret; + + } + +// --------------------------------------------------------------------------- +// Gets the attribute with the given name. +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +const AlfAttribute* AlfWidgetAttributeOwnerImpl::getAttribute( const UString& aTargetId, + const UString& aAttribName ) const + { + const AlfAttribute* attr(0); + + if (!aTargetId.isEmpty() + && mControl) + { + + // Try to find from control + IAlfAttributeOwner* control = + IAlfInterfaceBase::makeInterface(mControl); + if (control) + { + attr = control->getAttribute(aTargetId, aAttribName); + } + + if (!attr) + { + // Try finding element class from control + IAlfElement* element = mControl->findElement(aTargetId.getUtf8()); + + if (element) + { + // Get the attribute interface + IAlfAttributeOwner* attributeOwner = + IAlfInterfaceBase::makeInterface(element); + + if (attributeOwner) + { + attr = attributeOwner->getAttribute(aTargetId, aAttribName); + } + } + } + } + + return attr; + + } + +// --------------------------------------------------------------------------- +// Sets the attributes from container +// From class IAlfAttributeOwner. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::setAttributeContainer( AlfAttributeContainer& aAttributeContainer ) + { + + bool ret(true); + + for (int i=0;inumElements(); + for (int i = 0; i < elementCount; i++) + { + IAlfElement& element = mControl->element(i); + if (element.parentElement() == 0) + { + // Get the attribute interface + IAlfAttributeOwner* attributeOwner = + IAlfInterfaceBase::makeInterface(&element); + + if (attributeOwner) + { + // let all IAlfAttributeOwners set the attribute + if (attributeOwner->setAttribute(aAttribute)) + { + UString target(element.name()); + auto_ptr attribute(new (EMM) AlfAttribute()); + *attribute.get() = aAttribute; + TAlfWidgetAttributeCommand command(attribute.get(), target, mControl->widget()); + attribute.release(); + command.ExecuteL(mControl->Env()); + supported = true; + } + } + } + } + + return supported; + } + +// --------------------------------------------------------------------------- +// Handles the attribute, sets proper values. +// --------------------------------------------------------------------------- +// +void AlfWidgetAttributeOwnerImpl::handleAttribute( + const AlfAttribute& /*aAttribute*/) + { + // Add common widget specific attribute handling here + } + +// --------------------------------------------------------------------------- +// Can attribute be handled with this widget. +// --------------------------------------------------------------------------- +// +bool AlfWidgetAttributeOwnerImpl::canHandleAttribute( + const char* /*aAttributeName*/) + { + bool canHandle(false); + // Add common wigdet specific attribute checking here like: +/* if (!strcmp(aAttributeName, commonvisualattributes::KOpacity)) + { + canHandle = true; + }*/ + return canHandle; + } + + } // namespace Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetcommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetcommand.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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: widget command implementation +* +*/ + + + +//INCLUDES +#include +#include +#include +#include "alf/alfwidget.h" +#include "alf/alfattribute.h" + +namespace Alf +{ +TAlfWidgetAttributeCommand::TAlfWidgetAttributeCommand( + AlfAttribute* aAttribute, + UString& aTarget, + AlfWidget* aRecipient + ) : TAlfObjectCommand(EAlfCommandTypeNone, aRecipient, EAlfOpNone), + mOwnedAttribute( aAttribute ), + mTarget( aTarget ) + { + } + +void TAlfWidgetAttributeCommand::ExecuteL(CAlfEnv& /*aEnv*/) const + { + TAlfEvent newEvent( EEventWidgetAttributeChanged, (TInt)this ); + AlfWidget* widget = ((AlfWidget*) Object()); + if (widget) + { + CAlfControl* control = widget->control(); // Widgets are guaranteed to have controls + control->OfferEventL(newEvent); + } + } + +TAlfWidgetAttributeCommand::~TAlfWidgetAttributeCommand() + { + delete mOwnedAttribute; + mOwnedAttribute = NULL; + } + +TInt TAlfWidgetAttributeCommand::Size() const + { + return sizeof(*this); + } + +}//namespace Alf; + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetcontrol.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,1954 @@ +/* +* Copyright (c) 2007 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: The base class for all widget controls. +* +*/ + + +#include + +#include "alf/alfwidget.h" +#include +#include +#include +#include "alf/alfelement.h" +#include +#include "alf/alfmodeloperation.h" +#include +#include +#include +#include +#include +#include +#include +#include "alf/ialfattributeowner.h" +#include +#include + +#include "alfhostapiimpl.h" +#include "alfwidgetcontroleventfilter.h" + +using namespace osncore; + +namespace Alf + { +// ======== INTERNAL DATA TYPES ======== + +// Forward declared inside the Alf namespace + + +//Internal Class to Store the Element Data +class ElementData + { +public: + //Default constructor + ElementData():mElement(0) + { + } + //Destructor + ~ElementData() + { + delete mElement; + } + /** + * The element. Own. + */ + IAlfElement* mElement; + + /** + * The data id range for the element. + */ + uint mDataIdRange; + }; + +class AlfWidgetControlImpl + { + +public: + AlfWidgetControlImpl():mWidget(0),mEventFilter(0),mAlfHostAPIImpl(0) + { + + } + ~AlfWidgetControlImpl() + { + + } +public: + /** + * The element data. Elements are owned by the control. + */ + AlfPtrVector mElementArray; + + /** + * The event handlers. Event handlers are owned by the control. + */ + AlfPtrVector mEventHandlerArray; + + /** + * The owner widget. + */ + AlfWidget* mWidget; + + /** + * PointerUp Event Filter. + */ + AlfWidgetControlEventFilter *mEventFilter; + + /** + * The state of the control. + * The state is a combination of binary state flags. + */ + uint mState; + /** + * AlfAPIImpl auto pointer. + * This will be used to provide container control's functionality by + * widget control.Owned. + */ + auto_ptr mAlfHostAPIImpl; + }; + +// ======== MEMBER FUNCTIONS ======== + +OSN_EXPORT CAlfWidgetControl::CAlfWidgetControl(CAlfEnv& aEnv) + { + construct(aEnv); + } + +OSN_EXPORT CAlfWidgetControl::CAlfWidgetControl() + { + } + +OSN_EXPORT void* CAlfWidgetControl::operator new( + size_t aSize, newarg /*aEnumVal*/) throw (std::bad_alloc) + { + void* ret = 0; + TRAPD(err, ret = CBase::operator new((TUint)aSize, ELeave)); + if(err != KErrNone) + { + throw std::bad_alloc(); + } + return ret; + } + +OSN_EXPORT void CAlfWidgetControl::construct( + CAlfEnv& aEnv) + { + mWdgtControlData.reset( new (EMM) AlfWidgetControlImpl() ); + mWdgtControlData->mWidget = 0; + //by default control is focusable and enabled + mWdgtControlData->mState = IAlfWidgetControl::Focusable | + IAlfWidgetControl::Enabled; + + // Call CAlfControl second phase constructor + TRAPD(err, CAlfControl::ConstructL( aEnv )); + if(err != KErrNone) + { + ALF_THROW(AlfException, err, "CAlfWidgetControl::construction failed."); + } + mWdgtControlData->mElementArray.setAutoDelete(true); + mWdgtControlData->mEventHandlerArray.setAutoDelete(true); + mWdgtControlData->mAlfHostAPIImpl.reset(0); + + // Instatiate Event filter + mWdgtControlData->mEventFilter = + new (EMM) AlfWidgetControlEventFilter(); + addEventHandler(mWdgtControlData->mEventFilter); + } + +OSN_EXPORT CAlfWidgetControl::~CAlfWidgetControl() + { + //release all connections + while (this->ConnectionCount()) + { + this->RemoveConnection(&(this->Connection(0))); + } + mWdgtControlData->mElementArray.setAutoDelete(true); + + for(int i = 0; i < mWdgtControlData->mElementArray.count(); ++i) + { + // Fetch the element + IAlfElement *element = mWdgtControlData->mElementArray[i]->mElement; + + // If the element is also an event handler + IAlfWidgetEventHandler* eventHandler = + IAlfInterfaceBase::makeInterface( element ); + int eventHandlerIndex = + mWdgtControlData->mEventHandlerArray.findRef( eventHandler ); + if ( eventHandler && eventHandlerIndex != KErrNotFound ) + { + //cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + mWdgtControlData->mEventHandlerArray.remove( eventHandlerIndex ); + //restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + } + } + + mWdgtControlData->mElementArray.clear(); + + mWdgtControlData->mEventHandlerArray.setAutoDelete(true); + mWdgtControlData->mEventHandlerArray.clear(); + + if(mWdgtControlData->mWidget) + { + // false: don't delete twice + mWdgtControlData->mWidget->setControl(0, false); + mWdgtControlData->mWidget = 0; + } + } + +OSN_EXPORT uint CAlfWidgetControl::state() const + { + // Verify that the internal state stored in the member variable + // is in sync with the CAlfWidget state. This might not be the case + // if someone has called CAlfWidget APIs, e.g. AcquireFocus(), directly. + + if ( Focus() ) + { + mWdgtControlData->mState |= IAlfWidgetControl::Focused; + } + else + { + mWdgtControlData->mState &= ~IAlfWidgetControl::Focused; + } + + return mWdgtControlData->mState; + } + +OSN_EXPORT void CAlfWidgetControl::setState( uint aState ) + { + // Checks the state invariants. Throws exceptions if not OK + checkStateInvariants(aState); + + // Visible + if ( aState & IAlfWidgetControl::Visible ) + { + enableStateVisible(); + } + else + { + disableStateVisible(); + } + + // Enabled + if ( aState & IAlfWidgetControl::Enabled ) + { + enableStateEnabled(); + } + else + { + disableStateEnabled(); + } + + // Focused + if ( aState & IAlfWidgetControl::Focused ) + { + enableStateFocused(); + } + else + { + disableStateFocused(); + } + + // Focusable + if ( aState & IAlfWidgetControl::Focusable ) + { + enableStateFocusable(); + } + else + { + disableStateFocusable(); + } + } + +OSN_EXPORT void CAlfWidgetControl::enableState( uint aState ) + { + // Predicts the state and checks the state invariants. + // Throws exceptions if not OK + predictAndCheckStateInvariants(aState, true); + + // Visible + if ( aState & IAlfWidgetControl::Visible ) + { + enableStateVisible(); + } + + // Enabled + if ( aState & IAlfWidgetControl::Enabled ) + { + enableStateEnabled(); + } + + // Set Focusable. This is done first, before putting on fucus + if ( aState & IAlfWidgetControl::Focusable ) + { + enableStateFocusable(); + } + + // Focused + if ( aState & IAlfWidgetControl::Focused ) + { + enableStateFocused(); + } + + } + +OSN_EXPORT void CAlfWidgetControl::disableState( uint aState ) + { + // Predicts the state and checks the state invariants. + // Throws exceptions if not OK + predictAndCheckStateInvariants(aState, false); + + // Visible + if ( aState & IAlfWidgetControl::Visible ) + { + disableStateVisible(); + } + + // Enabled + if ( aState & IAlfWidgetControl::Enabled ) + { + disableStateEnabled(); + } + + // Focused + if ( aState & IAlfWidgetControl::Focused ) + { + disableStateFocused(); + } + + // Focusable + if ( aState & IAlfWidgetControl::Focusable ) + { + disableStateFocusable(); + } + } + +OSN_EXPORT bool CAlfWidgetControl::checkState( uint aState ) const + { + return ( state() & aState ); + } + +OSN_EXPORT int CAlfWidgetControl::numEventHandlers() const + { + return mWdgtControlData->mEventHandlerArray.count(); + } + +OSN_EXPORT IAlfWidgetEventHandler& CAlfWidgetControl::eventHandler( + int aIndex ) + { + return *mWdgtControlData->mEventHandlerArray[aIndex]; + } + +OSN_EXPORT int CAlfWidgetControl::eventHandlerIndex( + IAlfWidgetEventHandler& aEventHandler ) const + { + for ( int i = 0; i < mWdgtControlData->mEventHandlerArray.count(); ++i ) + { + if ( mWdgtControlData->mEventHandlerArray[i] == &aEventHandler ) + { + return i; + } + } + return -1; + } + +OSN_EXPORT IAlfWidgetEventHandler* CAlfWidgetControl::findEventHandler( + const TAlfEvent& aEvent ) + { + for ( int i = 0; i < mWdgtControlData->mEventHandlerArray.count(); ++i ) + { + if ( mWdgtControlData->mEventHandlerArray[i]->accept( *this, aEvent ) ) + { + return mWdgtControlData->mEventHandlerArray[i]; + } + } + return 0; + } + +OSN_EXPORT void CAlfWidgetControl::addEventHandler( + IAlfWidgetEventHandler* aEventHandler, int aIndex ) + { + try + { + if ( mWdgtControlData->mEventHandlerArray.findRef( aEventHandler ) == + KErrNotFound ) + { + if ( aIndex == -1 ) + { + mWdgtControlData->mEventHandlerArray.resize( + mWdgtControlData->mEventHandlerArray.count()+1); + mWdgtControlData->mEventHandlerArray.insert( + mWdgtControlData->mEventHandlerArray.count(), + aEventHandler ); + } + else + { + mWdgtControlData->mEventHandlerArray.resize( + mWdgtControlData->mEventHandlerArray.count()+1); + mWdgtControlData->mEventHandlerArray.insert( aIndex, + aEventHandler); + } + } + } + catch (...) + { + ALF_THROW(AlfWidgetException,ECommonError,"CAlfWidgetControl: Adding event handler failed.") + } + } + +OSN_EXPORT void CAlfWidgetControl::removeAndDestroyEventHandler( + IAlfWidgetEventHandler& aEventHandler ) + { + + for (int i =0; imEventHandlerArray.count();i++) + { + if (mWdgtControlData->mEventHandlerArray[i] == &aEventHandler) + { + IAlfWidgetEventHandler *handler = + mWdgtControlData->mEventHandlerArray[i]; + //check if it is an eventhandler associated with presentation + if(handler->eventHandlerType() == + IAlfWidgetEventHandler::EPresentationEventHandler) + { + ElementData* elementData = 0; + // if the event handller is also an element, remove the + // corresponding element data from mEventHandlerArray + elementData = removePesentationElementData(*handler); + // if the element data does not exist, remove the event handler + // from mEventHandlerArray and destroy it + if(!elementData) + { + mWdgtControlData->mEventHandlerArray.remove( i ); + } + // remove the event hanlder from the array but dont destroy it, + // and then delete element data which in turn will destroy the + // element and thus the event handler + else + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + mWdgtControlData->mEventHandlerArray.remove( i ); + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + delete elementData; + } + } + else + { + mWdgtControlData->mEventHandlerArray.remove( i ); + } + return; + } + + } + + } + +OSN_EXPORT void CAlfWidgetControl::removeEventHandler( + IAlfWidgetEventHandler& aEventHandler ) + { + for (int i =0; imEventHandlerArray.count();i++) + { + if (mWdgtControlData->mEventHandlerArray[i] == &aEventHandler) + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + mWdgtControlData->mEventHandlerArray.remove( i ); + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + return; + } + } + } + +OSN_EXPORT void CAlfWidgetControl::removeAndDestroyEventHandler( + const UString& aHandlerId ) + { + for (int i =0; imEventHandlerArray.count();i++) + { + IAlfWidgetEventHandler* handler = + mWdgtControlData->mEventHandlerArray[i]; + AlfWidgetEventHandlerInitData* eventData = handler->eventHandlerData(); + if(eventData != 0) + { + //check for the event id/name + if (!aHandlerId.compare(eventData->mWidgetEventHandlerId)) + { + //check if it is an eventhandler associated with presentation + if(handler->eventHandlerType() == + IAlfWidgetEventHandler::EPresentationEventHandler) + { + ElementData* elementData = 0; + // if the event handller is also an element, remove the + // corresponding element data from mEventHandlerArray + elementData = removePesentationElementData(*handler); + // if the element data does not exist, remove the event + // handler from mEventHandlerArray and destroy it + if(!elementData) + { + // removes and destoys the event handler + mWdgtControlData->mEventHandlerArray.remove( i ); + } + // remove the event hanlder from the array but dont destroy + // it, and then delete element data which in turn will + // destroy the element and thus the event handler + else + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete( + false); + mWdgtControlData->mEventHandlerArray.remove( i ); + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + //delete element data + delete elementData; + } + } + else + { + mWdgtControlData->mEventHandlerArray.remove( i ); + } + return; + } + } + + } + } + +OSN_EXPORT void CAlfWidgetControl::removeAndDestroyPresentationEventHandlers() + { + int i=0; + while(imEventHandlerArray.count()) + { + IAlfWidgetEventHandler* handler = + mWdgtControlData->mEventHandlerArray[i]; + + //check if it is an eventhandler associated with presentation + if(handler->eventHandlerType() == + IAlfWidgetEventHandler::EPresentationEventHandler) + { + ElementData* elementData = 0; + // if the event handller is also an element, remove the + // corresponding element data from mEventHandlerArray + elementData = removePesentationElementData(*handler); + // if the element data does not exist, remove the event handler + // from mEventHandlerArray and destroy it + if(!elementData) + { + mWdgtControlData->mEventHandlerArray.remove( i ); + } + // remove the event hanlder from the array but dont destroy it, + // and then delete element data which in turn will destroy the + // element and thus the event handler + else + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + mWdgtControlData->mEventHandlerArray.remove( i ); + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + //delete element data + delete elementData; + } + } + else + { + i++; + } + } + + } + +OSN_EXPORT void CAlfWidgetControl::removePresentationEventHandlers() + { + int i=0; + // cache auto delete state. + bool autoDeleteState = mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + while(imEventHandlerArray.count()) + { + IAlfWidgetEventHandler* handler = + mWdgtControlData->mEventHandlerArray[i]; + //check if it is an eventhandler associated with presentation + if(handler->eventHandlerType() == + IAlfWidgetEventHandler::EPresentationEventHandler) + { + mWdgtControlData->mEventHandlerArray.remove( i ); + } + else + { + i++; + } + } + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete(autoDeleteState); + } + +ElementData* CAlfWidgetControl::removePesentationElementData( + IAlfWidgetEventHandler& aEventHandler ) + { + IAlfElement* element = + IAlfInterfaceBase::makeInterface( &aEventHandler ); + + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if ( mWdgtControlData->mElementArray[i]->mElement == element ) + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mElementArray.autoDelete(); + mWdgtControlData->mElementArray.setAutoDelete(false); + // Store the Element Data which is to be removed. + // This pointer will be returned to the caller + ElementData* elementData = mWdgtControlData->mElementArray[i]; + mWdgtControlData->mElementArray.remove( i ); + // restore auto delete state. + mWdgtControlData->mElementArray.setAutoDelete(autoDeleteState); + return elementData;; + } + } + return 0; + } + +OSN_EXPORT int CAlfWidgetControl::numElements() const + { + return mWdgtControlData->mElementArray.count(); + } + +OSN_EXPORT IAlfElement& CAlfWidgetControl::element( int aIndex ) + { + return *(mWdgtControlData->mElementArray[aIndex]->mElement); + } + +OSN_EXPORT IAlfElement* CAlfWidgetControl::findElement( const char* aName ) + { + UString name(aName); + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + IAlfElement* element = mWdgtControlData->mElementArray[i]->mElement; + if (name == UString(element->name())) + { + return element; + } + } + return 0; + } + +OSN_EXPORT void CAlfWidgetControl::addElement( IAlfElement* aElement ) + { + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if ( mWdgtControlData->mElementArray[i]->mElement == aElement ) + { + return; // Already exists + } + } + auto_ptr elemData( new (EMM) ElementData() ); + elemData->mElement = aElement; + elemData->mDataIdRange = 0xFFFFFFFF; + try + { + mWdgtControlData->mElementArray.resize( + mWdgtControlData->mElementArray.count()+1); + mWdgtControlData->mElementArray.insert( + mWdgtControlData->mElementArray.count(), + elemData.get() ); + elemData.release(); // ownership transferred + } + catch (...) + { + // change the element of element data to 0. + // this will ensure that the element does not get deleted when the + // elemData gets out of scope, since elemData was not successfully + // added to the array + elemData->mElement = 0; + ALF_THROW(AlfException,ECommonError,"AlfWidgetControl: Adding the element failed.") + } + } + +OSN_EXPORT void CAlfWidgetControl::removeAndDestroyElement( + const IAlfElement& aElement ) + { + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if (mWdgtControlData->mElementArray[i]) + { + if ( mWdgtControlData->mElementArray[i]->mElement == &aElement ) + { + // Remove the element + IAlfElement *element = + mWdgtControlData->mElementArray[i]->mElement; + + // If the element is also an event handler + IAlfWidgetEventHandler* eventHandler = + IAlfInterfaceBase::makeInterface( + element ); + int eventHandlerIndex = + mWdgtControlData->mEventHandlerArray.findRef( + eventHandler ); + if ( eventHandler && eventHandlerIndex != KErrNotFound ) + { + // cache auto delete state. + bool autoDeleteState = + mWdgtControlData->mEventHandlerArray.autoDelete(); + mWdgtControlData->mEventHandlerArray.setAutoDelete(false); + mWdgtControlData->mEventHandlerArray.remove( + eventHandlerIndex ); + // restore auto delete state. + mWdgtControlData->mEventHandlerArray.setAutoDelete( + autoDeleteState); + } + // remove and destroy the element + mWdgtControlData->mElementArray.remove( i ); + return; + } + + } + } + } + +OSN_EXPORT void CAlfWidgetControl::removeElement(const IAlfElement& aElement ) + { + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if (mWdgtControlData->mElementArray[i]) + { + if ( mWdgtControlData->mElementArray[i]->mElement == &aElement ) + { + // make the element pointer of elementData null, and then + // destroy elementData. This will ensure that the memory + // allocated for the elementData is freed but the element + // is not destroyed + mWdgtControlData->mElementArray[i]->mElement = 0; + mWdgtControlData->mElementArray.remove(i); + return; + } + } + } + } + +OSN_EXPORT uint CAlfWidgetControl::elementDataId( + const IAlfElement& aElement, + uint aIndex, + uint aParentDataId ) + { + uint range = dataIdRange( aElement ); + + if ( aIndex >= range ) + { + } + // In hierarchical element structures this may overflow + return aParentDataId * range + aIndex; + } + +OSN_EXPORT uint CAlfWidgetControl::parentElementDataId( + const IAlfElement& aElement, + uint aDataId ) + { + uint dataIdRng = dataIdRange( aElement ); + if (0 == dataIdRng) return(0xFFFFFFFF); + else + return (uint)( aDataId / dataIdRange( aElement ) ); + } + +OSN_EXPORT uint CAlfWidgetControl::dataIdToIndex( + const IAlfElement& aElement, + uint aDataId ) + { + uint dataIdRng = dataIdRange( aElement ); + if (0 == dataIdRng) return(0xFFFFFFFF); + else + return aDataId % dataIdRange( aElement ); + } + +OSN_EXPORT IAlfVariantType* CAlfWidgetControl::elementData( + const IAlfElement& aElement, uint aDataId ) + { + if (!mWdgtControlData->mWidget) + { + return 0; + } + IAlfModel* widgetModel = mWdgtControlData->mWidget->model(); + if ( !widgetModel ) + { + return 0; + } + IAlfVariantType* modelData = widgetModel->data(); + if ( !modelData || modelData->type() != IAlfVariantType::EMap ) + { + return 0; + } + + IAlfMap* map = modelData->map(); + + // Use "current" to traverse elements from the root to the leaf + const IAlfElement* last = 0; + while ( last != &aElement ) + { + int currentDataId = aDataId; + const IAlfElement* current; + for ( current = &aElement ; + current->parentElement() != last ; + current = current->parentElement() ) + { + currentDataId = parentElementDataId( *current, currentDataId ); + } + int index = dataIdToIndex( *current, currentDataId ); + last = current; + + IAlfVariantType* data = map->item( UString(current->name()) ); + if ( data->type() == IAlfVariantType::EContainer ) + { + data = data->container()->item( index ); + } + if ( current == &aElement ) + { + return data; + } + if ( data->type() == IAlfVariantType::EBranch ) + { + // Continue with the child data + map = data->branch()->childData(); + continue; + } + if ( data->type() == IAlfVariantType::EMap ) + { + map = data->map(); + } + else + { + return 0; + } + } + + return 0; + } + +OSN_EXPORT void CAlfWidgetControl::setDataIdRange( + const IAlfElement& aElement, uint aRange ) + { + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if ( mWdgtControlData->mElementArray[i]->mElement == &aElement ) + { + mWdgtControlData->mElementArray[i]->mDataIdRange = aRange; + return; + } + } + } + +OSN_EXPORT uint CAlfWidgetControl::dataIdRange( const IAlfElement& aElement ) + { + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + if ( mWdgtControlData->mElementArray[i]->mElement == &aElement ) + { + return mWdgtControlData->mElementArray[i]->mDataIdRange; + } + } + return 0; + } + +OSN_EXPORT void CAlfWidgetControl::updatePresentation() + { + if ( !mWdgtControlData->mWidget || !mWdgtControlData->mWidget->model() || + !mWdgtControlData->mWidget->model()->data() || + mWdgtControlData->mWidget->model()->data()->type() != + IAlfVariantType::EMap ) + { + return; + } + IAlfMap* map = mWdgtControlData->mWidget->model()->data()->map(); + for ( int i = 0; i < map->count(); ++i ) + { + IAlfElement* element = findElement( map->name( i ).getUtf8() ); + if ( element ) + { + + int childInd = childIndex( *map, i, 0, true ); + IAlfVariantType* data = map->item( i ); + try + { + if ( data->type() == IAlfVariantType::EMap || + data->type() == IAlfVariantType::EBranch) + { + // Data for a single presentation instance (visual tree) + element->createVisualTree( *data, + elementDataId( *element, childInd, 0 ), + element->defaultParentLayout( 0 ), childInd ); + } + else if ( data->type() == IAlfVariantType::EContainer ) + { + + // Data for multiple presentation instances (visual trees) + IAlfContainer* container = data->container(); + for ( int j = 0; j < container->count(); ++j ) + { + element->createVisualTree( *container->item( j ), + elementDataId( *element, childInd + j, 0 ), + element->defaultParentLayout( 0 ), childInd + j ); + } + } + } + catch (...) + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"CAlfWidgetControl::updatePresentation failed") + } + + } + + } + } + +OSN_EXPORT void CAlfWidgetControl::destroyPresentation( int aTimeMilliseconds ) + { + (void)aTimeMilliseconds; + + for ( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + mWdgtControlData->mElementArray[i]->mElement->removeAndDestroyVisuals( + aTimeMilliseconds ); + } + processEvent(TAlfEvent(EEventWidgetPresentationDestroyed)); + } + +OSN_EXPORT void CAlfWidgetControl::destroyVisualsAndElements( + int aTimeMilliseconds ) + { + (void)aTimeMilliseconds; + + // destroy visual trees from elements + for( int i = 0; i < mWdgtControlData->mElementArray.count(); ++i ) + { + mWdgtControlData->mElementArray[i]->mElement->removeAndDestroyVisuals( + aTimeMilliseconds ); + } + // destroy elements + while( numElements() ) + { + removeAndDestroyElement( element(numElements()-1) ); + } + + // destroy presentation related event handlers + removeAndDestroyPresentationEventHandlers(); + + // send notification + processEvent(TAlfEvent(EEventWidgetPresentationDestroyed)); + } + +OSN_EXPORT void CAlfWidgetControl::updateParentLayout() + { + //get the parent control + CAlfWidgetControl* parent = dynamic_cast(Host()); + if (parent) + { + IAlfLayoutManager* layoutManager = + CAlfWidgetControl::makeInterface(parent); + if (layoutManager) + { + layoutManager->updateChildLayout(this); + } + } + } + +OSN_EXPORT bool CAlfWidgetControl::isContainer() const + { + IAlfHostAPI* api = mWdgtControlData->mAlfHostAPIImpl.get(); + return (api && api->getConnectionCount() > 0); + } + +OSN_EXPORT bool CAlfWidgetControl::isFocusable() const + { + return checkState(IAlfWidgetControl::Enabled) && + checkState(IAlfWidgetControl::Focusable); + } + +void CAlfWidgetControl::setOwnerWidget( AlfWidget* aWidget ) + { + mWdgtControlData->mWidget = aWidget; + } + +OSN_EXPORT AlfWidget* CAlfWidgetControl::widget() + { + return mWdgtControlData->mWidget; + } + +OSN_EXPORT AlfEventStatus CAlfWidgetControl::handleEvent( + const TAlfEvent& aEvent ) + { + AlfEventStatus ret = EEventNotHandled; + if(isContainer()) + { + CAlfWidgetControl* focused = + dynamic_cast(FocusedConnection()); + if(focused && aEvent.IsKeyEvent()) + { + ret = focused->processEvent(aEvent); + } + else if ( aEvent.IsCustomEvent() ) + { + int eventId = aEvent.CustomParameter(); + switch(eventId) + { + case EEventFocusNextWidget: + { + if( handleFocusNext() ) + { + ret = EEventConsumed; + } + } + break; + case EEventFocusPreviousWidget: + { + if( handleFocusPrevious() ) + { + ret = EEventConsumed; + } + } + break; + } + } + } + return ret; + + } + + +OSN_EXPORT TBool CAlfWidgetControl::OfferEventL( const TAlfEvent& aEvent ) + { + TBool ret(EFalse); + try + { + ret = processEvent(aEvent); + } + catch(AlfException& ae) + { + int reason = ae.errorCode(); + User::Leave( reason ); + } + + return ret; + } + + + + + OSN_EXPORT AlfEventStatus CAlfWidgetControl::processEvent( + const TAlfEvent& aEvent ) + { + AlfEventStatus ret(EEventNotHandled); + + /* If the event is not a custom event, stop execution if the widget is + not in enabled state. For custom event continue execution anyway. */ + if(!(mWdgtControlData->mState & IAlfWidgetControl::Enabled) && + !(aEvent.IsCustomEvent())) + { + return EEventNotHandled; + } + + // Go through tunneling phase event handlers. + AlfEventStatus ret2 = ProcessEventHandlingPhase( tunneling, aEvent ); + + if( ret2 == EEventConsumed ) + { + return EEventConsumed; + } + else if ( ret2 == EEventHandled ) + { + ret = EEventHandled; + } + + // Execute business logic. + if(aEvent.IsPointerEvent()) + { + if (aEvent.PointerDown() && isFocusable() && !Focus()) + { + AcquireFocus(); + } + } + + ret2 = handleEvent( aEvent ); + + if( ret2 == EEventConsumed ) + { + return EEventConsumed; + } + else if ( ret2 == EEventHandled ) + { + ret = EEventHandled; + } + + // Go through bubbling phase event handlers. + ret2 = ProcessEventHandlingPhase( bubbling, aEvent ); + + if( ret2 == EEventConsumed ) + { + return EEventConsumed; + } + else if ( ret2 == EEventHandled ) + { + ret = EEventHandled; + } + + return ret; + } + +AlfEventStatus CAlfWidgetControl::ProcessEventHandlingPhase( + int aPhase, const TAlfEvent& aEvent ) + { + // *** Implementation note *** + // + // offerEvent implementations may remove event handlers from the array that is + // being gone through. So that needs to be taken in consideration in the + // loop implementation. + + AlfEventStatus ret = EEventNotHandled; + + AlfPtrVector& eventHandlerArray = + mWdgtControlData->mEventHandlerArray; + + for (int i=0; i < eventHandlerArray.count() ; ++i) + { + IAlfWidgetEventHandler* eventHandler = + mWdgtControlData->mEventHandlerArray[i]; + + int phase = eventHandler->eventExecutionPhase(); + + bool matchingPhase = false; + if ( aPhase == bubbling ) + { + if ( phase == IAlfWidgetEventHandler:: + EBubblingPhaseEventHandler || + phase == IAlfWidgetEventHandler:: + ETunnellingAndBubblingPhaseEventHandler ) + { + matchingPhase = true; + } + } + else if ( aPhase == tunneling ) + { + if ( phase == IAlfWidgetEventHandler:: + ETunnellingPhaseEventHandler || + phase == IAlfWidgetEventHandler:: + ETunnellingAndBubblingPhaseEventHandler ) + { + matchingPhase = true; + } + } + + if ( matchingPhase ) + { + // This is preparation for the situation where event handlers are + // removed or added during offerEvent call. + // Store pointer to the event handler at next index. + IAlfWidgetEventHandler* nextHandler = 0; + + if ( i+1 < eventHandlerArray.count() ) + { + nextHandler = eventHandlerArray[i+1]; + } + + // Call offerEvent + AlfEventStatus ret2 = eventHandler->offerEvent(*this, aEvent); + + // Update status in the function return value. + if( ret2 == EEventConsumed ) + { + ret = EEventConsumed; + break; + } + else if ( ret2 == EEventHandled ) + { + ret = EEventHandled; + } + + // Now check whether next handler in the event handler array still + // matches with the stored pointer. + if ( nextHandler ) + { + // Check whether the event handler at index i+1 is still the + // same as before calling offerEvent. If not, the array has + // been modified and the variable i needs to be set again. + if ( i+1 >= eventHandlerArray.count() || + (i+1 < eventHandlerArray.count() && + eventHandlerArray[i+1] != nextHandler) ) + { + // Array has changed in offerEvent, the handler at index + // 'i+1' is not the same any more. Find the index of the + // current event handler again in the array and fix the + // loop variable 'i' point to that and continue. + int newCount = eventHandlerArray.count(); + for ( int j = 0 ; j < newCount ; j++ ) + { + if ( eventHandlerArray[j] == eventHandler ) + { + i = j; + break; + } + } + + } + } + } + } + + return ret; + } + +// from base class IAlfModelChangeObserver + +OSN_EXPORT void CAlfWidgetControl::modelChanged( IAlfModel& aModel ) + { + (void)aModel; + // This way the model change animation is customizable using event handlers + // The default event handler could implement this: + destroyPresentation( 0 ); + updatePresentation(); + updateParentLayout(); + } + +OSN_EXPORT void CAlfWidgetControl::dataChanging( + const AlfPtrVector& aOperations ) + { + for ( int i = 0; i < aOperations.count(); ++i ) + { + dataChanging( *aOperations[i] ); + } + } + +OSN_EXPORT void CAlfWidgetControl::dataChanging( + const AlfModelOperation& aOperation ) + { + int numIndices = aOperation.numContainerIndices(); + if ( !mWdgtControlData->mWidget->model() || numIndices <= 0 ) + { + return; + } + uint dataId = 0, parentDataId = 0; + IAlfElement* element = 0; + IAlfElement* parentElement = 0; + IAlfVariantType* data = mWdgtControlData->mWidget->model()->data(); + if(data == 0) + { + return; + } + IAlfBranch* parentBranch = 0; + // Traverse the data hierarchy to find the data, dataId and the element + for ( int i = 0; i < numIndices; ++i ) + { + int index = aOperation.containerIndex( i ); + if ( data->type() == IAlfVariantType::EMap && + index >= 0 && index < data->map()->count() ) + { + parentElement = element; + element = findElement( data->map()->name( index ).getUtf8() ); + if ( element == 0 ) + { + return; // Not found + } + IAlfMap* map = data->map(); + data = data->map()->item( index ); + + if ( data->type() == IAlfVariantType::EContainer ) + { + ++i; + int containerIndex = aOperation.containerIndex( i ); + if ( containerIndex < 0 || + containerIndex >= data->container()->count() ) + { + break; // Not found + } + int childInd = + childIndex( *map, index, containerIndex, i == 1 ); + parentDataId = dataId; + dataId = elementDataId( *element, childInd, parentDataId ); + data = data->container()->item( containerIndex ); + } + else + { + int childInd = childIndex( *map, index, 0, i == 0 ); + parentDataId = dataId; + dataId = elementDataId( *element, childInd, parentDataId ); + } + } + else if ( data->type() == IAlfVariantType::EBranch && + index == 0 && i == numIndices - 1 ) + { + // Changing the parent data + data = data->branch()->data(); + } + else if ( data->type() == IAlfVariantType::EBranch && index == 1 ) + { + parentBranch = data->branch(); + data = data->branch()->childData(); + } + else + { + return; // Not found + } + } + + // Perform the operation + if ( aOperation.operation() == AlfModelOperation::EOperationAdd ) + { + if ( parentBranch ) + { + // The parent is responsible for it's children + parentElement->createChildVisualTree( + element, aOperation.newData(), + *parentBranch,aOperation.index(), + parentDataId ); + } + else + { + if(element) + { + // Data added to a root element + try + { + element->createVisualTree( + aOperation.newData(), dataId, + element->defaultParentLayout( parentDataId ), + aOperation.index() ); + } + catch (...) + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"CAlfWidgetControl::dataChanging failed") + } + } + else + { + ALF_THROW(AlfVisualException,ECanNotCreateVisual,"CAlfWidgetControl::dataChanging failed") + } + + } + } + else if ( aOperation.operation() == AlfModelOperation::EOperationRemove ) + { + if ( parentBranch ) + { + // The parent is responsible for it's children + parentElement->removeChildVisualTree( + element, *parentBranch, aOperation.index(), parentDataId ); + } + else + { + if(element) + { + // Data removed from a root element + element->removeVisualTree( *data, dataId ); + } + } + } + else if ( aOperation.operation() == AlfModelOperation::EOperationUpdate ) + { + if(element) + { + element->updateVisualTree( aOperation.newData(), *data, dataId ); + } + } + } + +OSN_EXPORT void CAlfWidgetControl::dataChanged() + { + // The default implementation is empty. + } + +uint CAlfWidgetControl::childIndex( + IAlfMap& aMap, uint aMapIndex, + uint aContainerIndex, bool aRoot ) + { + // This method is only used internally + const UString& elementName = aMap.name( aMapIndex ); + int index = 0; + for ( int i = 0; i < aMapIndex && i < aMap.count(); ++i ) + { + if ( !aRoot || elementName == aMap.name( i ) ) + { + IAlfVariantType* data = aMap.item( i ); + if ( data->type() == IAlfVariantType::EMap || + data->type() == IAlfVariantType::EBranch) + { + index++; + } + else if ( data->type() == IAlfVariantType::EContainer ) + { + index += data->container()->count(); + } + } + } + return index + aContainerIndex; + } + +// --------------------------------------------------------------------------- +// From class IAlfInterfaceBase. +// Getter for interfaces provided by the control. +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfInterfaceBase* CAlfWidgetControl::makeInterface( + const IfId& aType ) + { + IAlfInterfaceBase* interface = 0; + UString param(aType.mImplementationId); + if ( param == IAlfWidgetControl::type().mImplementationId ) + { + return static_cast( this ); + } + else if (param == IAlfAttributeOwner::type().mImplementationId) + { + return 0; // control does not have AttributeOwner instance + // and do not try get IF from elements in control + } + // Let the layout manager create the interface that is queried. + else if(mWdgtControlData->mAlfHostAPIImpl.get()) + { + IAlfLayoutManager* layoutManager = + mWdgtControlData->mAlfHostAPIImpl->getBaseLayout(); + if(layoutManager) + { + interface = layoutManager->makeInterface(aType); + } + } + + if(interface == 0) + { + //go through all the elements + for (int i = 0; i < numElements() && !interface; i++) + { + IAlfElement& ele = element(i); + interface = ele.makeInterface(aType); + } + } + + return interface; + } + + +OSN_EXPORT CAlfLayout* CAlfWidgetControl::ContainerLayout( + const CAlfControl* /*aConnected*/) const + { + if(mWdgtControlData->mAlfHostAPIImpl.get() != 0) + { + IAlfLayoutManager* layoutManager = + mWdgtControlData->mAlfHostAPIImpl->getBaseLayout(); + if(layoutManager != 0) + { + return &layoutManager->getLayout(); + } + } + return 0; + } + + +OSN_EXPORT void CAlfWidgetControl::AcquireFocus() + { + if (!FocusedConnection() && isFocusable()) + { + if (isContainer()) + { + IAlfHostAPI& hostApi = hostAPI(); + //select the first connection. + + CAlfWidgetControl* firstChild = nextFocusableControl(0); + if (firstChild) + { + firstChild->AcquireFocus(); + } + } + else + { + CAlfControl::AcquireFocus(); + } + } + } + +OSN_EXPORT void CAlfWidgetControl::RelinquishFocus() + { + if (Focus()) + { + if (isContainer()) + { + handleFocusNext(); + } + else + { + //get parent control, check if it can focus next control. + CAlfWidgetControl* parent = + dynamic_cast(Host()); + if (parent) + { + parent->handleFocusNext(); + } + + CAlfControl::RelinquishFocus(); + } + } + } + +// --------------------------------------------------------------------------- +// return hostapi. create instance if needed. +// --------------------------------------------------------------------------- +// +IAlfHostAPI& CAlfWidgetControl::hostAPI() + { + if (!mWdgtControlData->mAlfHostAPIImpl.get()) // was it already created? + { + //late creation + mWdgtControlData->mAlfHostAPIImpl.reset( new (EMM) AlfHostAPIImpl() ); + mWdgtControlData->mAlfHostAPIImpl->setHostControl(*this); + } + + return *mWdgtControlData->mAlfHostAPIImpl.get(); + } + +OSN_EXPORT bool CAlfWidgetControl::handleFocusNext() + { + bool focusChanged = false; + if (isContainer()) + { + CAlfWidgetControl* focused = + dynamic_cast(FocusedConnection()); + if (focused) + { + CAlfWidgetControl* nextChild = nextFocusableControl(focused); + + if (!nextChild) + { + //no next child, change focus to upper level, if that fails, + //loop to first connection. + CAlfWidgetControl* parent = + dynamic_cast(Host()); + if (parent) + { + focusChanged = parent->handleFocusNext(); + } + if (!focusChanged) + { + //loop to first connection. + nextChild = nextFocusableControl(0); + } + } + + //go deeper down the widget hierarchy, until a no-container widget + // is found + while(nextChild && nextChild->isContainer()) + { + nextChild = nextChild->nextFocusableControl(0); + } + + if (nextChild) + { + nextChild->AcquireFocus(); + focusChanged = true; + } + } + } + return focusChanged; + } + +OSN_EXPORT bool CAlfWidgetControl::handleFocusPrevious() + { + bool focusChanged = false; + if (isContainer()) + { + + CAlfWidgetControl* focused = + dynamic_cast(FocusedConnection()); + if (focused) + { + CAlfWidgetControl* prevChild = previousFocusableControl( + focused); + + if (!prevChild) + { + // no previous child, change focus to upper level, if that + // fails, loop to last connection. + CAlfWidgetControl* parent = + dynamic_cast(Host()); + if (parent) + { + focusChanged = parent->handleFocusPrevious(); + } + if (!focusChanged) + { + //loop to last connection. + prevChild = previousFocusableControl(0); + } + } + //go deeper down the widget hierarchy, until a no-container widget + //is found. + while(prevChild && prevChild->isContainer()) + { + //in each level, select the last focused widget. + prevChild = prevChild->previousFocusableControl(0); + } + + if (prevChild) + { + prevChild->AcquireFocus(); + focusChanged = true; + } + } + } + + return focusChanged; + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::getFirstFocusable( + IAlfContainerWidget& aContainer) + { + CAlfWidgetControl* control = 0; + if (aContainer.widgetCount() > 0) + { + control = aContainer.getWidget(0)->control(); + } + return control; + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::getLastFocusable( + IAlfContainerWidget& aContainer) + { + CAlfWidgetControl* control = 0; + if (aContainer.widgetCount() > 0) + { + IAlfWidget* w = aContainer.getWidget(aContainer.widgetCount()-1); + control = w->control(); + } + return control; + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::getFocusableAfter( + IAlfContainerWidget& aContainer, + CAlfWidgetControl& aControl) + { + CAlfWidgetControl* control = 0; + int ind = aContainer.getWidgetIndex(*aControl.widget()); + if (ind >= 0) + { + ind++; + if (ind < aContainer.widgetCount()) + { + IAlfWidget* w = aContainer.getWidget(ind); + control = w->control(); + } + } + + return control; + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::getFocusableBefore( + IAlfContainerWidget& aContainer, CAlfWidgetControl& aControl) + { + CAlfWidgetControl* control = 0; + int ind = aContainer.getWidgetIndex(*aControl.widget()); + ind--; + if (ind >= 0) + { + IAlfWidget* w = aContainer.getWidget(ind); + control = w->control(); + } + + return control; + } + +void CAlfWidgetControl::resetControlGroup(CAlfControlGroup& aControlGroup) + { + // If control group is already set and its same than the control group + // given as a parameter there's nothing we need to do. + if(!ControlGroup() || (ControlGroup() != &aControlGroup)) + { + // Remove control from previous control group + if(ControlGroup()) + { + ControlGroup()->Remove(this); + } + // Append control to the new control group + TRAPD(err, aControlGroup.AppendL(this)); + if(err != KErrNone) + { + ALF_THROW(AlfException, err, "CAlfWidgetControl::resetControlGroup - Appending control to a new control group failed."); + } + } + } + +void CAlfWidgetControl::resetHierarchyControlGroup( + CAlfControlGroup& aControlGroup) + { + // Append this control to the new control group + resetControlGroup(aControlGroup); + + // Call this recursively to all connected controls + AlfHostAPIImpl* hostApi = mWdgtControlData->mAlfHostAPIImpl.get(); + if(hostApi != 0) + { + for(int i = 0; i < hostApi->getConnectionCount(); ++i) + { + CAlfWidgetControl* connectedControl = hostApi->getConnection(i); + if(connectedControl) + { + connectedControl->resetHierarchyControlGroup(aControlGroup); + } + } + } + } + + +OSN_EXPORT void CAlfWidgetControl::FocusChanged( + CAlfDisplay& /*aDisplay*/, + TBool aFocused) + { + // Ensure that the state bit remains synched to the toolkit's version + if (aFocused) + { + mWdgtControlData->mState |= IAlfWidgetControl::Focused; + } + else + { + mWdgtControlData->mState &=~ IAlfWidgetControl::Focused; + } + + if (aFocused) + { + processEvent(TAlfEvent(EEventWidgetGainedFocus)); + } + else + { + processEvent(TAlfEvent(EEventWidgetLostFocus)); + } + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::nextFocusableControl( + CAlfWidgetControl* aControl) + { + CAlfWidgetControl* control = 0; + + if (isContainer()) + { + IAlfContainerWidget* container = + IAlfInterfaceBase::makeInterface(widget()); + + assert(container); + + if (!aControl) + { + control = getFirstFocusable(*container); + } + else + { + control = getFocusableAfter(*container, *aControl); + } + + while(control && !control->isFocusable()) + { + control = control->getFocusableAfter(*container, *control); + } + } + + return control; + } + +OSN_EXPORT CAlfWidgetControl* CAlfWidgetControl::previousFocusableControl( + CAlfWidgetControl* aControl) + { + CAlfWidgetControl* control = 0; + + if (isContainer()) + { + IAlfContainerWidget* container = + IAlfInterfaceBase::makeInterface(widget()); + + assert(container); + + if (!aControl) + { + control = getLastFocusable(*container); + } + else + { + control = getFocusableBefore(*container, *aControl); + } + + while(control && !control->isFocusable()) + { + control = control->getFocusableBefore(*container, *control); + } + } + + return control; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::enableStateVisible() + { + // Only take action if the current state is different + if ( !(mWdgtControlData->mState & IAlfWidgetControl::Visible) ) + { + // Update the new state in member variable + mWdgtControlData->mState |= IAlfWidgetControl::Visible; + + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::disableStateVisible() + { + // Only take action if the current state is different + if ( mWdgtControlData->mState & IAlfWidgetControl::Visible ) + { + // Update the new state in member variable + mWdgtControlData->mState &= ~IAlfWidgetControl::Visible; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::enableStateEnabled() + { + // Only take action if the current state is different + if ( !(mWdgtControlData->mState & IAlfWidgetControl::Enabled) ) + { + // Update the new state in member variable + mWdgtControlData->mState |= IAlfWidgetControl::Enabled; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::disableStateEnabled() + { + // Only take action if the current state is different + if ( mWdgtControlData->mState & IAlfWidgetControl::Enabled ) + { + // Update the new state in member variable + mWdgtControlData->mState &= ~IAlfWidgetControl::Enabled; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::enableStateFocused() + { + // Only take action if the current state is different + if ( !(mWdgtControlData->mState & IAlfWidgetControl::Focused) ) + { + // Set the new state + AcquireFocus(); + + // Update the new state in member variable + mWdgtControlData->mState |= IAlfWidgetControl::Focused; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::disableStateFocused() + { + // Only take action if the current state is different + if ( mWdgtControlData->mState & IAlfWidgetControl::Focused ) + { + // Set the new state + RelinquishFocus(); + + // Update the new state in member variable + mWdgtControlData->mState &= ~IAlfWidgetControl::Focused; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::enableStateFocusable() + { + // Only take action if the current state is different + if ( !(mWdgtControlData->mState & IAlfWidgetControl::Focusable) ) + { + // Update the new state in member variable + mWdgtControlData->mState |= IAlfWidgetControl::Focusable; + } + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfWidgetControl::disableStateFocusable() + { + // Only take action if the current state is different + if ( mWdgtControlData->mState & IAlfWidgetControl::Focusable ) + { + // Update the new state in member variable + mWdgtControlData->mState &= ~IAlfWidgetControl::Focusable; + } + } + +void CAlfWidgetControl::checkStateInvariants(uint aState) + { + // To be focused, it needs to be focusable (Focus -> Focusable) + if(aState & IAlfWidgetControl::Focused + && !(aState & IAlfWidgetControl::Focusable) ) + { + ALF_THROW(AlfException, EInvalidArgument, "AlfWidgetControl() - state changing operation. Illegal state would result."); + } + + // To be focusable, it needs to be enabled (Focusable -> Enabled) + if(aState & IAlfWidgetControl::Focusable + && !(aState & IAlfWidgetControl::Enabled) ) + { + ALF_THROW(AlfException, EInvalidArgument, "AlfWidgetControl() - state changing operation. Illegal state would result."); + } + } + +void CAlfWidgetControl::predictAndCheckStateInvariants( + uint aChangePattern, + bool aEnabling) const + { + uint predictedState(mWdgtControlData->mState); + if(aEnabling) + { + predictedState |= aChangePattern; + } + else + { + predictedState &= ~aChangePattern; + } + checkStateInvariants(predictedState); + } + + +} // namespace Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetcontroleventfilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetcontroleventfilter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2007 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: Stray PointerUp Event Filter. +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "alfwidgetcontroleventfilter.h" + +enum EventfilterEvent + { + EEventStrayPointerUp=57423 + }; +//namespace Alf +namespace Alf +{ +AlfWidgetControlEventFilter::AlfWidgetControlEventFilter() + { + mButtonDown = false; + } + +AlfWidgetControlEventFilter::~AlfWidgetControlEventFilter() + { + } + +IAlfWidgetEventHandler::AlfEventHandlerType AlfWidgetControlEventFilter + ::eventHandlerType() + { + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfWidgetControlEventFilter + ::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + +bool AlfWidgetControlEventFilter::accept( + CAlfWidgetControl& /*aControl*/, + const TAlfEvent& /*aEvent */) const + { + return false; + } + +AlfEventStatus AlfWidgetControlEventFilter::offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ) + { + if(aEvent.IsPointerEvent()) + { + if (aEvent.PointerEvent().iType == TPointerEvent::EButton1Down) + { + // Recieved PointerDown + mButtonDown = true; + } + else if (aEvent.PointerUp()) + { + if(!mButtonDown) + { + // Recieved a stray pointerUp + aControl.Env().Send(TAlfCustomEventCommand(EEventStrayPointerUp)); + } + mButtonDown = false; + } + } + else if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventStrayPointerUp) + { + if(mButtonDown) + { + mButtonDown = false; + TAlfEvent customevent(EEventMissedPointerUp); + aControl.handleEvent(customevent); + } + } + } + return EEventNotHandled; + } + +void AlfWidgetControlEventFilter::setActiveStates( unsigned int /*aStates*/ ) + { + } +IAlfInterfaceBase* AlfWidgetControlEventFilter::makeInterface ( const IfId& /*aType*/ ) + { + return NULL; + } + +}// namespace Alf + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetenvextension.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetenvextension.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2007 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: Extensions can be added to AlfEnv through this class. + Currently resourcepool,widgetfactory can be added as extensions to AlfEnv. +* +*/ + + +#include +#include +#include + +#include +#include +#include + +#include +#include +namespace Alf + { + const int KAlfExtensionResourcePoolUid( 89 ); // Bogus id for resource + // pool extension + + const int KAlfExtensionWidgetFactoryUid( 106 ); // Bogus id for widget + // factory extension + + // Env extension for the resource pool + class AlfExtensionResourcePoolContainer : public MAlfEnvObject + { + public: + + AlfExtensionResourcePoolContainer( ResourcePool* aResourcePool) : + mResourcePool(aResourcePool ) + { + } + + virtual void Release() + { + delete this; + } + + ~AlfExtensionResourcePoolContainer() + { + delete mResourcePool; + } + // Owned + ResourcePool* mResourcePool; + }; + + + // Env extension for the widget factory + class AlfExtensionWidgetFactory : public MAlfEnvObject + { + public: + + AlfExtensionWidgetFactory( + AlfWidgetFactoryLoader* amWidgetFactoryLoader, + IAlfWidgetFactory* aWidgetFactory) : + mWidgetFactoryLoader( amWidgetFactoryLoader ), + mWidgetFactory( aWidgetFactory ) + { + } + + virtual void Release() + { + delete this; + } + + ~AlfExtensionWidgetFactory() + { + delete mWidgetFactoryLoader; + } + // Owned + AlfWidgetFactoryLoader* mWidgetFactoryLoader; + // Not owned + IAlfWidgetFactory* mWidgetFactory; + }; + +// --------------------------------------------------------------------------- +// Initializes environment with resource pool and factory extensions +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEnvExtension::initializeEnvironment(CAlfEnv& aEnv) + { + AlfExtensionResourcePoolContainer* poolContainer = + static_cast( + aEnv.Extension( KAlfExtensionResourcePoolUid)); + if ( poolContainer == NULL) + { + // Initialize the env with resource pool extension + initializeEnvironmentForResourcePool(aEnv); + } + AlfExtensionWidgetFactory* widgetFactoryExtension = + static_cast( + aEnv.Extension( KAlfExtensionWidgetFactoryUid)); + if ( widgetFactoryExtension == NULL) + { + // Initialize the env with widget factory extension + initializeEnvironmentForFactory(aEnv); + } + } +// --------------------------------------------------------------------------- +// Initializes environment with Theme Manager extension +// --------------------------------------------------------------------------- +// +void AlfWidgetEnvExtension::initializeEnvironmentForTheme(CAlfEnv& /*aEnv*/ ) + { + } + +// --------------------------------------------------------------------------- +// Initializes environment with resource pool extension +// --------------------------------------------------------------------------- +// +void AlfWidgetEnvExtension::initializeEnvironmentForResourcePool(CAlfEnv& aEnv) + { + auto_ptr pool(new(EMM) ResourcePool( + aEnv.TextureManager(), NULL)); + auto_ptr poolContainer( + new(EMM) AlfExtensionResourcePoolContainer( pool.release())); + int err = aEnv.AddExtension( KAlfExtensionResourcePoolUid, + (MAlfEnvObject*)(poolContainer.get())); + if ( err != KErrNone) + { + ALF_THROW(AlfWidgetException, ECommonError, "Failed to add AlfEnv extension"); + } + else + { + poolContainer.release(); + } + } +// --------------------------------------------------------------------------- +// Returns the reference for Resource Pool extension object. +// --------------------------------------------------------------------------- +// +OSN_EXPORT ResourcePool& AlfWidgetEnvExtension::resourcePool( CAlfEnv& aEnv) + { + Alf::AlfExtensionResourcePoolContainer* poolContainer = + static_cast(aEnv.Extension( KAlfExtensionResourcePoolUid)); + if ( poolContainer == NULL) + { + initializeEnvironment(aEnv); + } + //re-fetch the pool + poolContainer = + static_cast(aEnv.Extension( KAlfExtensionResourcePoolUid)); + return *(poolContainer->mResourcePool); +} + +// --------------------------------------------------------------------------- +// Initializes environment with factory extension +// --------------------------------------------------------------------------- +// +void AlfWidgetEnvExtension::initializeEnvironmentForFactory(CAlfEnv& aEnv) + { + auto_ptr widgetFactoryLoader( + new (EMM) AlfWidgetFactoryLoader() ); + + IAlfWidgetFactory* widgetFactory = NULL; + widgetFactory = widgetFactoryLoader->loadWidgetFactory(aEnv); + if(!widgetFactory) + { + ALF_THROW(AlfWidgetException, ECommonError, "Failed to create widget factory"); + } + auto_ptr widgetFactoryExtension( + new(EMM) AlfExtensionWidgetFactory( widgetFactoryLoader.release(), + widgetFactory)); + int err = aEnv.AddExtension( KAlfExtensionWidgetFactoryUid, + (MAlfEnvObject*)(widgetFactoryExtension.get())); + if ( err != 0) + { + ALF_THROW(AlfWidgetException, ECommonError, "Failed to add AlfEnv extension"); + } + else + { + widgetFactoryExtension.release(); + } + } + +// --------------------------------------------------------------------------- +// Returns the reference for Theme Manager extension object. +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfThemeManagerUtil& AlfWidgetEnvExtension::themeManagerUtil( CAlfEnv& /*aEnv*/) + { + // Depricated + ALF_THROW(AlfWidgetException, EInvalidArgument, "Depricated Module"); + } + + +// --------------------------------------------------------------------------- +//Access to the widget factory +// --------------------------------------------------------------------------- +// +OSN_EXPORT IAlfWidgetFactory& AlfWidgetEnvExtension::widgetFactory( + CAlfEnv& aEnv) + { + AlfExtensionWidgetFactory* widgetFactoryExtension = + static_cast( + aEnv.Extension( KAlfExtensionWidgetFactoryUid)); + if ( widgetFactoryExtension == NULL) + { + initializeEnvironmentForFactory(aEnv); + } + //re-fetch the widget factory extension + widgetFactoryExtension = + static_cast( + aEnv.Extension( KAlfExtensionWidgetFactoryUid)); + return *(widgetFactoryExtension->mWidgetFactory); + } + + } // Alf diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgeteventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgeteventhandler.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,632 @@ +/* +* 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: File implements eventhandler in widgetmodel. +* +*/ + +#include +#include + +#include "alf/alfwidgeteventhandler.h" +#include +#include +#include +#include "alf/alfattribute.h" +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif // RD_TACTILE_FEEDBACK + +#include "alfwidgeteventhandlerimpl.h" +#include "alfanimationoutput.h" +#include "alfeventinput.h" +#include "alfeventoutput.h" + + +namespace Alf + { +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +OSN_EXPORT AlfWidgetEventHandler::AlfWidgetEventHandler( + IAlfWidgetEventHandler::AlfEventHandlerType aEventHandlerType, + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase aEventHandlerExecutionPhase ) + { + mImpl.reset( new (EMM) AlfWidgetEventHandlerImpl( + aEventHandlerType, aEventHandlerExecutionPhase ) ); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandler::~AlfWidgetEventHandler() + { + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addKeyInput( + int aEventID, + EventTypeFlags aEventTypeFlags, + uint aModifiers ) + { + if ( aEventTypeFlags != keyDown && aEventTypeFlags != keyUp ) + { + ALF_THROW( + AlfException, + EInvalidArgument, + "AlfWidgetEventHandler - invalid event type given in addKeyInput()" ); + } + + mImpl->mInputs.resize(mImpl->mInputs.count()+1); + AlfEventInput* input = new( EMM ) AlfEventInput( aEventTypeFlags, aEventID, 0, aModifiers ); + mImpl->mInputs.insert(mImpl->mInputs.count(),input); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addCustomInput( + int aEventID, bool aUseEventData, int aEventData ) + { + mImpl->mInputs.resize(mImpl->mInputs.count()+1); + AlfEventInput* input = new( EMM ) AlfEventInput(custom, aEventID, aEventData, 0 ); + if ( aUseEventData ) + { + input->mEventTypeFlags |= useEventData; + } + + mImpl->mInputs.insert(mImpl->mInputs.count(), input); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addPointerInput( + const char* aElementName, const char* aVisualName, + WidgetPointerEvent aEvent ) + { + mImpl->mPointerInputs.resize(mImpl->mPointerInputs.count()+1); + AlfPointerEventInput* input = new( EMM ) AlfPointerEventInput( aElementName, aVisualName, aEvent ); + mImpl->mPointerInputs.insert(mImpl->mPointerInputs.count(), input); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- + +OSN_EXPORT void AlfWidgetEventHandler::addOutput( + int aEventType, + int aEventID, + const char* aTargetControl, + unsigned int aDelay ) + { + mImpl->mOutputs.resize(mImpl->mOutputs.count()+1); + AlfEventOutput* output = new( EMM ) AlfEventOutput( aEventType, aEventID, aTargetControl, aDelay ); + mImpl->mOutputs.insert(mImpl->mOutputs.count(), output); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addAnimationOutput( + AlfReferenceToVisual* aTargetVisual, + AlfReferenceToVisual* aReferenceVisual, + IAlfAttributeSetter* aAttributeSetter, + AlfAttributeContainer* aAttributeContainer, + unsigned int aAnimationTime, + unsigned int aDelay ) + { + mImpl->mAnimationOutputs.resize(mImpl->mAnimationOutputs.count()+1); + + AlfAnimationOutput* output = new( EMM ) AlfAnimationOutput( + aTargetVisual, + aReferenceVisual, + aAttributeSetter, + aAttributeContainer, + aAnimationTime, + aDelay ); + + // This should always succeed, because the array has already been resized. + mImpl->mAnimationOutputs.insert(mImpl->mAnimationOutputs.count(), output ); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addCancelOutput( + const char* aTargetWidget, int aEventID, bool aCancelAll ) + { + mImpl->mCancelOutputs.resize(mImpl->mCancelOutputs.count()+1); + AlfEventCancelOutput* output = new( EMM ) AlfEventCancelOutput( aTargetWidget, aEventID, aCancelAll ); + mImpl->mCancelOutputs.insert(mImpl->mCancelOutputs.count(), output); + } + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addAnimationCancelOutput( + const char* aElementName, + const char* aVisualName, + TAlfOp aOperation, + bool aCancelAll ) + { + mImpl->mAnimationCancelOutputs.resize(mImpl->mAnimationCancelOutputs.count()+1); + AlfAnimationCancelOutput* output = new( EMM ) AlfAnimationCancelOutput(aElementName, aVisualName, aOperation, aCancelAll ); + mImpl->mAnimationCancelOutputs.insert(mImpl->mAnimationCancelOutputs.count(), output); + } + +// --------------------------------------------------------------------------- +// AddWidgetAttributeOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addWidgetAttributeOutput( + AlfAttribute& aAttribute, const char* aWidgetId ) + { + mImpl->mWidgetAttributeOutputs.resize( mImpl->mWidgetAttributeOutputs.count() + 1 ); + AlfWidgetAttributeOutput* output = new (EMM) AlfWidgetAttributeOutput( aAttribute, aWidgetId ); + mImpl->mWidgetAttributeOutputs.insert( mImpl->mWidgetAttributeOutputs.count(), output ); + } + +// --------------------------------------------------------------------------- +// addWidgetAttributeOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addWidgetAttributeOutput( + UString& aName, AlfAttributeValueType* aValue, const char* aWidgetId ) + { + auto_ptr attr( + new( EMM ) AlfAttribute(aName.getUtf8(), AlfAttribute::EStatic ) ); + attr->addTargetValue( aValue ); + + mImpl->mWidgetAttributeOutputs.resize( mImpl->mWidgetAttributeOutputs.count() + 1 ); + // Add attribute to attribute output. Onwership is transferred. + AlfWidgetAttributeOutput* output = new (EMM) AlfWidgetAttributeOutput( *attr.get(), aWidgetId ); + attr.release(); + mImpl->mWidgetAttributeOutputs.insert( mImpl->mWidgetAttributeOutputs.count(), output ); + } + +// --------------------------------------------------------------------------- +// addWidgetAttributeInput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addWidgetAttributeInput( + UString& aName, AlfAttributeValueType* aValue, const char* aElementId ) + { + auto_ptr attr( + new( EMM ) AlfAttribute(aName.getUtf8(), AlfAttribute::EStatic ) ); + attr->addTargetValue( aValue ); + + mImpl->mWidgetAttributeInputs.resize( mImpl->mWidgetAttributeInputs.count() + 1 ); + // Add attribute to attribute input. Onwership is transferred. + AlfWidgetAttributeInput* input = new (EMM) AlfWidgetAttributeInput( *attr.get(), aElementId ); + attr.release(); + mImpl->mWidgetAttributeInputs.insert( mImpl->mWidgetAttributeInputs.count(), input ); + } + +// --------------------------------------------------------------------------- +// addTactileOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addTactileOutput( + WidgetTactileFeedbackType aFeedbackType ) + { +#ifdef RD_TACTILE_FEEDBACK + // map the feedback type to official tactile feedback type + TTouchLogicalFeedback feedback = ETouchFeedbackNone; + + switch ( aFeedbackType ) + { + case tactileFeedbackBasic: + feedback = ETouchFeedbackBasic; + break; + case tactileFeedbackSensitive: + feedback = ETouchFeedbackSensitive; + break; + case tactileFeedbackNone: + default: + break; + } + + // create tactile output + mImpl->mTactileOutputs.resize( mImpl->mTactileOutputs.count() + 1 ); + AlfTactileOutput* output = new (EMM) AlfTactileOutput( feedback ); + mImpl->mTactileOutputs.insert( mImpl->mTactileOutputs.count(), output ); +#endif // RD_TACTILE_FEEDBACK + } + +// --------------------------------------------------------------------------- +// addEventPasserInput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addEventPasserInput ( + int aEventId, int aCustomData ) + { + mImpl->mEventPasserInputs.resize( mImpl->mEventPasserInputs.count() + 1 ); + + AlfEventPasserInput* input = new( EMM ) AlfEventPasserInput( + aEventId, aCustomData ); + mImpl->mEventPasserInputs.insert( mImpl->mEventPasserInputs.count(), input ); + } + +// --------------------------------------------------------------------------- +// addEventPasserOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addEventPasserOutput( + const char* aSourceWidget , const char* aTargetWidget ) + { + mImpl->mEventPasserOutputs.resize( mImpl->mEventPasserOutputs.count() + 1 ); + + //create new output here + AlfEventPasserOutput* output = new( EMM ) AlfEventPasserOutput( + aSourceWidget, aTargetWidget ); + + mImpl->mEventPasserOutputs.insert( mImpl->mEventPasserOutputs.count(), output ); + } + +// --------------------------------------------------------------------------- +// addEventPasserOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addEventPasserOutput( + const char* aSourceWidget , const char* aTargetWidget, int aNewEventId, int aNewEventCustomData ) + { + //create new output here + auto_ptr output(new (EMM) AlfEventPasserOutput( aSourceWidget, + aTargetWidget, + aNewEventId, + aNewEventCustomData )); + mImpl->mEventPasserOutputs.resize( mImpl->mEventPasserOutputs.count() + 1 ); + mImpl->mEventPasserOutputs.insert( mImpl->mEventPasserOutputs.count(), output.get() ); + output.release(); + } + +// --------------------------------------------------------------------------- +// addWidgetEventOutputSignalSubscriber +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addWidgetEventOutputSignalSubscriber( + IAlfEventOutputSignalSubscriber& aSubscriber ) + { + auto_ptr signal(new (EMM) AlfEventOutputSignal( aSubscriber )); + mImpl->mWidgetEventOutputSignals.resize( mImpl->mWidgetEventOutputSignals.count() + 1 ); + mImpl->mWidgetEventOutputSignals.insert( mImpl->mWidgetEventOutputSignals.count(), signal.get() ); + signal.release(); + } + +// --------------------------------------------------------------------------- +// addWidgetStateOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addWidgetStateOutput( + const UString& aName, uint aEnableStates, uint aDisableStates ) + { + auto_ptr output(new (EMM) AlfStateChangeOutput( aName.getUtf8(), aEnableStates, aDisableStates )); + mImpl->mStateChangeOutputs.resize( mImpl->mStateChangeOutputs.count() + 1 ); + mImpl->mStateChangeOutputs.insert( mImpl->mStateChangeOutputs.count(), output.get() ); + output.release(); + } + +// --------------------------------------------------------------------------- +// addAppEventOutput +// --------------------------------------------------------------------------- +// +OSN_EXPORT void AlfWidgetEventHandler::addAppEventOutput(const UString& aCmd , IAlfAppEventListener& aAppEvent ) + { + auto_ptr appOutput(new (EMM) AlfAppEventOutput( aCmd, aAppEvent )); + mImpl->mAppEventOutputs.resize( mImpl->mAppEventOutputs.count() + 1 ); + mImpl->mAppEventOutputs.insert( mImpl->mAppEventOutputs.count(), appOutput.get() ); + appOutput.release(); + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// ?implementation_description +// --------------------------------------------------------------------------- +// +bool AlfWidgetEventHandler::accept( + CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const + { + bool ret = false; + + // Custom and key events + if ( !aEvent.IsPointerEvent() ) + { + int count = mImpl->mInputs.count(); + + for ( int i = 0 ; i < count ; i++ ) + { + if ( mImpl->mInputs[i]->accept( aEvent ) ) + { + ret = true; + break; + } + } + } + + // Pointer events + else + { + int count = mImpl->mPointerInputs.count(); + + for ( int i = 0 ; i < count ; i++ ) + { + if ( mImpl->mPointerInputs[i]->accept( aControl, aEvent ) ) + { + ret = true; + break; + } + } + } + + // All the inputs below handle only custom events. + + if (!ret) + { + int count = mImpl->mWidgetAttributeInputs.count(); + + for ( int i = 0 ; i < count ; i++ ) + { + if ( mImpl->mWidgetAttributeInputs[i]->accept( aEvent ) ) + { + ret = true; + break; + } + } + } + + if (!ret) + { + int count = mImpl->mEventPasserInputs.count(); + + for ( int i = 0 ; i < count ; i++ ) + { + if ( mImpl->mEventPasserInputs[i]->accept( aEvent ) ) + { + ret = true; + break; + } + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// ?implementation_description +// --------------------------------------------------------------------------- +// +AlfEventStatus AlfWidgetEventHandler::offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ) + { + AlfEventStatus ret(EEventNotHandled); + + // If the event handler is active in the control's current state and + // any of the inputs accept the event, execute all outputs. + + if ( ( (mImpl->mActiveStates == ~0) || + (aControl.state() & mImpl->mActiveStates) ) && + accept( aControl, aEvent ) ) + { + ret = EEventHandled; + + // Normal event outputs, property outputs and cancel outputs + // are executed with all types of events (custom, key, pointer). + + int i; + int count = mImpl->mCancelOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mCancelOutputs[i]->execute( aControl ); + } + + count = mImpl->mOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mOutputs[i]->execute( aControl, aEvent ); + } + + // Tactile outputs +#ifdef RD_TACTILE_FEEDBACK + count = mImpl->mTactileOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mTactileOutputs[i]->execute(); + } +#endif // RD_TACTILE_FEEDBACK + + // widget attribute outputs + count = mImpl->mWidgetAttributeOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mWidgetAttributeOutputs[i]->execute( + aControl ); + } + + // Event output signal subscribers + count = mImpl->mWidgetEventOutputSignals.count(); + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mWidgetEventOutputSignals[i]->execute(); + } + + // Animation event outputs, animation cancel outputs and property outputs + // are executed only with custom events. + + if ( aEvent.IsCustomEvent() ) + { + // Custom events have the associated data ID for finding the target + // visual in the event data parameter. + + int dataID = aEvent.CustomEventData(); + + count = mImpl->mAnimationCancelOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mAnimationCancelOutputs[i]->execute( aControl, dataID ); + } + + count = mImpl->mAnimationOutputs.count(); + + for ( i = 0 ; i < count ; i++ ) + { + mImpl->mAnimationOutputs[i]->sendCommand( aControl, dataID ); + } + } + + // State change outputs + count = mImpl->mStateChangeOutputs.count(); + for( i = 0; i < count; i++) + { + mImpl->mStateChangeOutputs[i]->execute( aControl ); + } + + // Event passer outputs + count = mImpl->mEventPasserOutputs.count(); + for( i = 0; i < count; i++) + { + mImpl->mEventPasserOutputs[i]->execute( &aControl , aEvent ); + } + + // AlfAppEvent outputs + count = mImpl->mAppEventOutputs.count(); + for( i = 0; i < count; i++) + { + mImpl->mAppEventOutputs[i]->execute( aEvent ); + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// +void AlfWidgetEventHandler::setActiveStates( unsigned int aStates ) + { + mImpl->mActiveStates = aStates; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// ?implementation_description +// --------------------------------------------------------------------------- +// +void AlfWidgetEventHandler::setCapturing( bool aCapturing ) + { + mImpl->mCapturing = aCapturing; + } + +// --------------------------------------------------------------------------- +// From class IAlfWidgetEventHandler. +// ?implementation_description +// --------------------------------------------------------------------------- +// +bool AlfWidgetEventHandler::capturing() const + { + return mImpl->mCapturing; + } + +// --------------------------------------------------------------------------- +// From class MAlfInterfaceBase. +// ?implementation_description +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* AlfWidgetEventHandler::makeInterface( const IfId& aType ) + { + UString param( aType.mImplementationId ); + if ( param == IAlfWidgetEventHandler::type().mImplementationId ) + { + return static_cast( this ); + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// setEventHandlerData +// --------------------------------------------------------------------------- +// +void AlfWidgetEventHandler::setEventHandlerData(const AlfWidgetEventHandlerInitData& aData) + { + // Set event handler id + if (aData.mWidgetEventHandlerId) + { + int len = strlen(aData.mWidgetEventHandlerId); + char* tmp = new( EMM ) char[len + 1]; + + delete[] mImpl->mEhData.mWidgetEventHandlerId; + + strcpy(tmp, aData.mWidgetEventHandlerId); + tmp[len] = 0; + mImpl->mEhData.mWidgetEventHandlerId = tmp; + } + // we don't need to set node at the moment + mImpl->mEhData.mNode = 0; + } + +// --------------------------------------------------------------------------- +// eventHandlerData +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandlerInitData* AlfWidgetEventHandler::eventHandlerData() + { + return &mImpl->mEhData; + } + +// --------------------------------------------------------------------------- +// eventHandlerType +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType AlfWidgetEventHandler::eventHandlerType() + { + return mImpl->mEventHandlerType; + } + +// --------------------------------------------------------------------------- +// eventExecutionPhase +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfWidgetEventHandler::eventExecutionPhase() + { + return mImpl->mEventHandlerExecutionPhase; + } +} +// End of File. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgeteventhandlerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgeteventhandlerimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,80 @@ +/* +* 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: The private implementation file for WidgetEventHandler. +* +*/ + + +#include "alfwidgeteventhandlerimpl.h" + +using namespace Alf; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandlerImpl::AlfWidgetEventHandlerImpl( + IAlfWidgetEventHandler::AlfEventHandlerType aEventHandlerType, + IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase aEventHandlerExecutionPhase): + mActiveStates( ~0 ), // By default active in all states + mCapturing( false ), + mEventHandlerType(aEventHandlerType), + mEventHandlerExecutionPhase(aEventHandlerExecutionPhase) + { + construct(); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void AlfWidgetEventHandlerImpl::construct() + { + mInputs.setAutoDelete( true ); + mEhData.mWidgetEventHandlerId = 0; + mEhData.mNode = 0; + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandlerImpl::~AlfWidgetEventHandlerImpl() + { + mInputs.clear(); + mPointerInputs.clear(); + mOutputs.clear(); + mCancelOutputs.clear(); + mAnimationOutputs.clear(); + mAnimationCancelOutputs.clear(); + mWidgetAttributeOutputs.clear(); + mWidgetAttributeInputs.clear(); +#ifdef RD_TACTILE_FEEDBACK + mTactileOutputs.clear(); +#endif // RD_TACTILE_FEEDBACK + mWidgetEventOutputSignals.clear(); + mStateChangeOutputs.clear(); + mEventPasserInputs.clear(); + mEventPasserOutputs.clear(); + mAppEventOutputs.clear(); + if (mEhData.mWidgetEventHandlerId) + { + delete[] mEhData.mWidgetEventHandlerId; + } + } + +// End of File. diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetimpl.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2007 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: The private implementation of CAlfWidget. +* +*/ + + +#include "alfwidgetimpl.h" +#include +#include +#include +#include "alf/alfwidget.h" +#include "alf/alfattribute.h" +#include "alf/alfattributevaluetype.h" +#include +#include +#include + +#include "alfwidgetattributeownerimpl.h" + + +namespace Alf + { + +AlfWidgetImpl::AlfWidgetImpl() + { + mControl = NULL; + mModel = NULL; + mAttributeList.setAutoDelete(true); + mWidgets.setAutoDelete(false); + mTakesModelOwnership=false; + } + +AlfWidgetImpl::~AlfWidgetImpl() + { + setControl( NULL, true ); + + if (mTakesModelOwnership) + { + delete mModel; + mModel = NULL; + } + mAttributeList.clear(); + mWidgets.clear(); + } + +void AlfWidgetImpl::setWidgetName( const UString& aWidgetName ) + { + mWidgetName = aWidgetName; + } + +const UString& AlfWidgetImpl::widgetName() const + { + return mWidgetName; + } + + +CAlfWidgetControl* AlfWidgetImpl::control() + { + return mControl; + } + +void AlfWidgetImpl::setControl( CAlfWidgetControl* aControl,bool aDeletePreviousControl) + { + if ( mControl != aControl ) + { + if( mControl ) + { + if( mModel ) + { + // Remove model change observer from control + mModel->removeModelChangeObserver( *mControl ); + } + if( aDeletePreviousControl ) + { + // Delete control from possible control group to avoid double deletion + if(mControl->ControlGroup()) + { + mControl->ControlGroup()->Remove(mControl); + } + // Delete the control + delete mControl; + mControl = NULL; + } + } + + // Set the new control. + mControl = aControl; + + // Add the new control as an observer for model changes. + if( mControl ) + { + if( mModel ) + { + mModel->addModelChangeObserver( *mControl ); + } + mAttributeOwnerImpl.reset(new (EMM) AlfWidgetAttributeOwnerImpl(mControl)); + } + } + } + +IAlfModel* AlfWidgetImpl::model() + { + return mModel; + } + +void AlfWidgetImpl::setModel( IAlfModel* aModel,bool aTakeOwnerShip ) + { + if ( mModel != aModel ) + { + // Release the old model. + if (mTakesModelOwnership) + { + delete mModel; + } + + else if (mModel&&mControl) + { + mModel->removeModelChangeObserver(*mControl); + } + + // Set the new model. + mModel = aModel; + mTakesModelOwnership=aTakeOwnerShip; + // Add the control as an observer for model changes. + if ( mModel && mControl ) + { + mModel->addModelChangeObserver( *mControl ); + } + } + else // just copy the ownership flag + { + if (mModel != NULL) + { + mTakesModelOwnership=aTakeOwnerShip; + } + } + + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void AlfWidgetImpl::addWidget(AlfWidget *aWidget) + { + for (int i=0 ; i< mWidgets.count(); i++ ) + { + if (mWidgets.findRef(aWidget) >=0) + { + //widget already there. + return; + } + } + mWidgets.resize(mWidgets.count()+1); + mWidgets.insert(mWidgets.count(),aWidget); + } + +int AlfWidgetImpl::widgetCount() + { + return mWidgets.count(); + } + +AlfWidget* AlfWidgetImpl::getWidget(int aIndex) + { + if (aIndex>=0 && aIndex < mWidgets.count()) + return mWidgets[aIndex]; + return 0; + } + +int AlfWidgetImpl::findWidget(AlfWidget* aWidget) + { + return mWidgets.findRef(aWidget); + } + +void AlfWidgetImpl::removeWidget(int aIndex) + { + if (aIndex >=0 and aIndex < mWidgets.count()) + mWidgets.remove(aIndex); + } + +// --------------------------------------------------------------------------- +// Returns attribute owner interface. +// --------------------------------------------------------------------------- +// +AlfWidgetAttributeOwnerImpl* AlfWidgetImpl::getAttributeOwner() + { + return mAttributeOwnerImpl.get(); + } + + } //namespace alf + + + diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/group/bld.inf Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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: Build information file for UI Accelerator Toolkit +* +*/ + + +PRJ_MMPFILES + +../alfwidgetmodel/group/alfwidgetmodel.mmp +../alfwidgetfactory/group/alfwidgetfactory.mmp + + +PRJ_EXPORTS +../../rom/widgetmodel.iby CORE_MW_LAYER_IBY_EXPORT_PATH(widgetmodel.iby) diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/sis/createsisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/sis/createsisx.bat Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to create the widgetmodel sisx. +rem + + +@echo off +echo DoTo: update the location for certificate and private key files + +set certificate_file=..\internal\certificates\rd.cer +set private_key_file=..\internal\certificates\rd-key.pem + +makesis widgetmodel.pkg +signsis widgetmodel.sis widgetmodel.sisx %certificate_file% %private_key_file% diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/sis/widgetmodel.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/sis/widgetmodel.pkg Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,48 @@ +; +; 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: Pkg file to export widgetmodel binaries. +; + +; ============================================================================ +; Name : widgetmodel.pkg +; Part of : Widget model +; Description : Package file +; Version : %version: 2 % << Don't touch! Updated by Synergy at check-out. +; +; Copyright © 2007 Nokia. All rights reserved. +; This material, including documentation and any related computer +; programs, is protected by copyright controlled by Nokia. All +; rights are reserved. Copying, including reproducing, storing, +; adapting or translating, any or all of this material requires the +; prior written consent of Nokia. This material also contains +; confidential information which may not be disclosed to others +; without the prior written consent of Nokia. +; ============================================================================ +; Template version: 4.1 + +; standard SIS file header +; : aquire proper UID +#{"Os neutral library"},(0x10207260),1,0,0 + +;Localized Vendor Name +%{"Nokia-EN"} + +;Unique Vendor name +:"Nokia" + +;Files to copy +"\epoc32\release\armv5\urel\alfwidgetutils.dll"-"!:\sys\bin\alfwidgetutils.dll" +"\epoc32\release\armv5\urel\alfwidgetmodel.dll"-"!:\sys\bin\alfwidgetmodel.dll" +"\epoc32\release\armv5\urel\alfwidgetfactory.dll"-"!:\sys\bin\alfwidgetfactory.dll" +"\epoc32\data\z\resource\plugins\alfwidgetfactory.rsc"-"!:\resource\plugins\alfwidgetfactory.rsc" \ No newline at end of file