symhelp/helpmodel/tsrc/tlch.cpp
changeset 0 1f04cf54edd8
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Element within the Help Model module
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "tlch.hrh"
       
    19 #include "tlch.h"
       
    20 #include "HLPLCH.H"
       
    21 #include <eikstart.h>
       
    22 
       
    23 LOCAL_C CApaApplication* NewApplication()
       
    24 	{
       
    25 	return new CTLchApplication;
       
    26 	}
       
    27 
       
    28 GLDEF_C TInt E32Main()
       
    29 	{
       
    30 	return EikStart::RunApplication(NewApplication);
       
    31 	}
       
    32 
       
    33 
       
    34 
       
    35 TUid CTLchApplication::AppDllUid() const
       
    36 	{
       
    37 	return KUidTLchApp;
       
    38 	}
       
    39 
       
    40 CApaDocument* CTLchApplication::CreateDocumentL()
       
    41 	{
       
    42 	return new (ELeave) CTLchDocument(*this);
       
    43 	}
       
    44 
       
    45 CTLchDocument::CTLchDocument(CEikApplication& aApp)
       
    46 		: CEikDocument(aApp)
       
    47 	{
       
    48 	}
       
    49 
       
    50 CEikAppUi* CTLchDocument::CreateAppUiL()
       
    51 	{
       
    52     return new(ELeave) CTLchAppUi;
       
    53 	}
       
    54 
       
    55 void CTLchAppUi::ConstructL()
       
    56     {
       
    57     BaseConstructL();
       
    58     iAppView=new(ELeave) CTLchAppView;
       
    59     iAppView->ConstructL(ClientRect());
       
    60 	AddToStackL(iAppView);
       
    61     }
       
    62 
       
    63 
       
    64 CTLchAppUi::~CTLchAppUi()
       
    65 	{
       
    66 	RemoveFromStack(iAppView);
       
    67     delete iAppView;
       
    68 	}
       
    69 
       
    70 void CTLchAppUi::HandleCommandL(TInt aCommand)
       
    71 	{
       
    72 	switch (aCommand)
       
    73 		{
       
    74 		case ETlchMenuHelpC:
       
    75 			{
       
    76 			CArrayFix<TCoeHelpContext>* buf=AppHelpContextL();
       
    77 			HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
       
    78 			break;
       
    79 			}
       
    80 		case ETlchMenuHelp:
       
    81 			{
       
    82 			HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession());
       
    83 			break;
       
    84 			}
       
    85 		case EEikCmdExit: 
       
    86 			Exit();
       
    87 			break;
       
    88 		}
       
    89 	}
       
    90 
       
    91 CArrayFix<TCoeHelpContext>* CTLchAppUi::HelpContextL() const
       
    92 	{
       
    93 	CArrayFixFlat<TCoeHelpContext>* array=new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
       
    94 	array->AppendL(TCoeHelpContext(KUidTLchApp, _L("App Ui Context 1")));
       
    95 	array->AppendL(TCoeHelpContext(KUidTLchApp, _L("App Ui Context 2")));
       
    96 	array->AppendL(TCoeHelpContext(KUidTLchApp, _L("App Ui Context 3")));
       
    97 	return array;
       
    98 	}
       
    99 
       
   100 void CTLchAppView::ConstructL(TRect aRect)
       
   101 	{
       
   102 	CreateWindowL();
       
   103     SetRect(aRect);
       
   104     ActivateL();
       
   105 	}
       
   106 
       
   107 void CTLchAppView::GetHelpContext(TCoeHelpContext& aContext) const
       
   108 	{
       
   109 	aContext.iMajor=KUidTLchApp;
       
   110 	aContext.iContext=_L("Context Id 12");
       
   111 	}