2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Loads the UI library and creates the instance of the document class.
18 #ifndef __FLASH_UI_H__
19 #define __FLASH_UI_H__
27 * The API to start Viewer UI for playing Flash content file from a Viewer or a stub
30 * The point here is to offer easy-of-use API for stubs applications which has
31 * dedicated set of platform security capabilities for rendering private SWF content.
32 * However, also standard Flash Viewer can utilize the same API as well.
34 * Example usage of the API:
37 * LOCAL_C CApaApplication* NewApplication( )
39 * return new(ELeave) CFlashStubApplication;
42 * GLDEF_C TInt E32Main()
44 * return EikStart::RunApplication(NewApplication);
47 * CFlashStubApplication::~CFlashStubApplication()
49 * if (iFlashLibrary.Handle())
51 * iFlashLibrary.Close();
55 * const TUid KUidFlashStubApp = { 0x1027367B };
57 * TUid CFlashStubApplication::AppDllUid() const
59 * return KUidFlashStubApp;
63 * _LIT(KStubFlashContent, "C:\\Data\\Others\\example.swf");
65 * const TUint32 KContentChecksum = 0;
67 * CApaDocument* CFlashStubApplication::CreateDocumentL()
69 * FlashUIConfig config;
70 * config.iIsMMI = EFalse;
71 * config.iIsStubApp = ETrue;
72 * config.iContentFileName.Copy(KStubFlashContent);
73 * config.iContentChecksum = KContentChecksum;
74 * config.iExtensions = NULL;
76 * if(!FlashStubsSupported())
78 * User::Leave(KErrNotSupported);
80 * return CreateFlashDocumentL(iFlashLibrary, this, config);
86 Structure containing configuration information for UI.
91 * ETrue if MMI is supported.
96 * ETrue if is a stub application.
101 * The swf file which accesses the MMI features.
103 TFileName iContentFileName;
106 * Check sum for security.
108 TUint32 iContentChecksum;
111 * Name of the ECom plug-in
113 const TDesC8* iExtensions;
116 * Reserved for future use
118 const TDesC8* iReserved1;
121 * Reserved for future use
127 * The Flash UI dll name.
129 _LIT(KFlashUILibraryName, "flash2ui.dll");
132 * The ordinal of the exported function in the Flash UI dll.
134 const TInt KFlashCreateDocumentOrdinal = 1;
137 * Pointer to a function that creates the document class.
139 typedef void* (*PFNC_CreateFlashDocumentL)(CEikApplication* aApp, const FlashUIConfig& aUIConfig);
141 class CEikApplication;
143 * CreateFlashDocumentL creates a Flash document for an application and
144 * starts playing the given SWF file. If there is no S60 Flash Lite
145 * Viewer Framework DLL installed in the device, the function leaves with error
146 * code returned from the RLibrary::Load.
150 * @param aLibrary Handle to the flash UI dll.
151 * @param aApp Instance of the application class.
152 * @param aUIConfig Instance of the class that contains the configuration for the UI.
153 * @return The new document object.
154 * @leave KErrGeneral Error in using the successfully loaded Flash Viewer Framework DLL
156 inline CApaDocument* CreateFlashDocumentL(RLibrary& aLibrary, CEikApplication* aApp, const FlashUIConfig& aUIConfig)
158 CApaDocument* doc = NULL;
159 User::LeaveIfError(aLibrary.Load(KFlashUILibraryName));
160 PFNC_CreateFlashDocumentL pFncCreateFlashDocumentL = (PFNC_CreateFlashDocumentL)aLibrary.Lookup(KFlashCreateDocumentOrdinal);
161 if (pFncCreateFlashDocumentL == NULL)
163 User::Leave(KErrGeneral);
165 doc = (CApaDocument*)pFncCreateFlashDocumentL(aApp, aUIConfig);
170 * Checks whether S60 Flash Lite Viewer Framework DLL exists in the device for stub
172 * @return ETrue if Flash Lite stub applications is suppported, EFalse otherwise.
174 inline TBool FlashStubsSupported()
178 TInt err = library.Load(KFlashUILibraryName);
189 #endif // __FLASH_UI_H__