localisation/apparchitecture/tef/tRuleBasedApps/tRuleBasedApp3.cpp
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    23 // CTRuleBasedAppView
    23 // CTRuleBasedAppView
    24 // CTRuleBasedDocument
    24 // CTRuleBasedDocument
    25 // 
    25 // 
    26 //
    26 //
    27 
    27 
    28 
       
    29 
       
    30 
       
    31 /**
    28 /**
    32  @file
    29  @file
    33  @internalComponent - Internal Symbian test code
    30  @internalComponent - Internal Symbian test code
    34 */
    31 */
    35 
    32 
    36 #include <coeccntx.h>
    33 #include <coeccntx.h>
    37 #include <eikenv.h>
    34 #include <eikenv.h>
    38 #include <eikAppui.h>
    35 #include <eikappui.h>
    39 #include <eikApp.h>
    36 #include <eikapp.h>
    40 #include <eikdoc.h>
    37 #include <eikdoc.h>
    41 #include <eikmenup.h>
    38 #include <mw/eikmenup.h>
    42 #include <eikstart.h>
    39 #include <eikstart.h>
    43 
    40 
    44 #include <eikon.hrh>
    41 #include <mw/eikon.hrh>
    45 
    42 
    46 #include <tRuleBasedApp3.rsg>
    43 #include <trulebasedapp3.rsg>
    47 #include "tRuleBasedApp.hrh"
    44 #include "tRuleBasedApp.hrh"
    48 
    45 
    49 //const TInt KLeft 	= 0; // Display app window on the left
    46 //const TInt KLeft 	= 0; // Display app window on the left
    50 const TInt KCentre 	= 1; // Display app window in the centre
    47 const TInt KCentre 	= 1; // Display app window in the centre
    51 const TInt KRight 	= 2; // Display app window on the right
    48 const TInt KRight 	= 2; // Display app window on the right
    52 
    49 
    53 ////////////////////////////////////////////////////////////////////////
    50 //
    54 //
    51 //
    55 // CTRuleBasedApplication
    52 // CTRuleBasedApplication
    56 //
    53 //
    57 ////////////////////////////////////////////////////////////////////////
    54 //
    58 
    55 
    59 class CTRuleBasedApplication : public CEikApplication
    56 class CTRuleBasedApplication : public CEikApplication
    60 	{
    57 	{
    61 private:
    58 private:
    62 	CApaDocument* CreateDocumentL();
    59 	CApaDocument* CreateDocumentL();
    63 	TUid AppDllUid() const;
    60 	TUid AppDllUid() const;
    64 	};
    61 	};
    65 	
    62 	
    66 ////////////////////////////////////////////////////////////////////////
    63 //
    67 //
    64 //
    68 // CTRuleBasedAppView
    65 // CTRuleBasedAppView
    69 //
    66 //
    70 ////////////////////////////////////////////////////////////////////////
    67 //
    71 class CTRuleBasedAppView : public CCoeControl
    68 class CTRuleBasedAppView : public CCoeControl
    72  	{
    69  	{
    73 public:
    70 public:
    74 	static CTRuleBasedAppView* NewL(const TRect& aRect);
    71 	static CTRuleBasedAppView* NewL(const TRect& aRect);
    75 	CTRuleBasedAppView();
    72 	CTRuleBasedAppView();
    85 
    82 
    86 private:
    83 private:
    87 	HBufC* iRuleBasedText;
    84 	HBufC* iRuleBasedText;
    88  	};
    85  	};
    89 
    86 
    90 ////////////////////////////////////////////////////////////////////////
    87 //
    91 //
    88 //
    92 // CTRuleBasedAppUi
    89 // CTRuleBasedAppUi
    93 //
    90 //
    94 ////////////////////////////////////////////////////////////////////////
    91 //
    95 class CTRuleBasedAppUi : public CEikAppUi
    92 class CTRuleBasedAppUi : public CEikAppUi
    96 	{
    93 	{
    97 public:
    94 public:
    98 	void ConstructL();
    95 	void ConstructL();
    99 	~CTRuleBasedAppUi();
    96 	~CTRuleBasedAppUi();
   104 
   101 
   105 private:
   102 private:
   106 	CTRuleBasedAppView* iAppView;
   103 	CTRuleBasedAppView* iAppView;
   107 	};
   104 	};
   108 
   105 
   109 ////////////////////////////////////////////////////////////////////////
   106 //
   110 //
   107 //
   111 // CTRuleBasedDocument
   108 // CTRuleBasedDocument
   112 //
   109 //
   113 ////////////////////////////////////////////////////////////////////////
   110 //
   114 class CTRuleBasedDocument : public CEikDocument
   111 class CTRuleBasedDocument : public CEikDocument
   115 	{
   112 	{
   116 public:
   113 public:
   117 	static CTRuleBasedDocument* NewL(CEikApplication& aApp);
   114 	static CTRuleBasedDocument* NewL(CEikApplication& aApp);
   118 	CTRuleBasedDocument(CEikApplication& aApp);
   115 	CTRuleBasedDocument(CEikApplication& aApp);
   120 private:
   117 private:
   121 	// Inherited from CEikDocument
   118 	// Inherited from CEikDocument
   122 	CEikAppUi* CreateAppUiL();
   119 	CEikAppUi* CreateAppUiL();
   123 	};
   120 	};
   124 
   121 
   125 //////////////////////////////////////////////////////////////////////
   122 //
   126 //
   123 //
   127 // Application Document class - CTRuleBasedAppDocument
   124 // Application Document class - CTRuleBasedAppDocument
   128 //
   125 //
   129 //////////////////////////////////////////////////////////////////////
   126 //
   130 
   127 
   131 /**
   128 /**
   132 The constructor of the document class just passes the
   129 The constructor of the document class just passes the
   133 supplied reference to the constructor initialisation list.
   130 supplied reference to the constructor initialisation list.
   134 The document has no real work to do in this Application.
   131 The document has no real work to do in this Application.
   149 CEikAppUi* CTRuleBasedDocument::CreateAppUiL()
   146 CEikAppUi* CTRuleBasedDocument::CreateAppUiL()
   150 	{
   147 	{
   151  	return new(ELeave) CTRuleBasedAppUi;
   148  	return new(ELeave) CTRuleBasedAppUi;
   152 	}
   149 	}
   153 
   150 
   154 ////////////////////////////////////////////////////////////////////////
   151 //
   155 //
   152 //
   156 // Source file for the implementation of the
   153 // Source file for the implementation of the
   157 // Application view class - CTRuleBasedAppView
   154 // Application view class - CTRuleBasedAppView
   158 //
   155 //
   159 ////////////////////////////////////////////////////////////////////////
   156 //
   160 
   157 
   161 
   158 
   162 // Constructor for the view.
   159 // Constructor for the view.
   163 
   160 
   164 CTRuleBasedAppView::CTRuleBasedAppView():iAppType(KRight)
   161 CTRuleBasedAppView::CTRuleBasedAppView():iAppType(KRight)
   268 	gc.DrawText(*iRuleBasedText,aRect,baselineOffset,CGraphicsContext::ECenter, 0);
   265 	gc.DrawText(*iRuleBasedText,aRect,baselineOffset,CGraphicsContext::ECenter, 0);
   269 	// Finished using the font
   266 	// Finished using the font
   270 	gc.DiscardFont();
   267 	gc.DiscardFont();
   271 	}
   268 	}
   272 
   269 
   273 ////////////////////////////////////////////////////////////////////////
   270 //
   274 //
   271 //
   275 // Application UI class - CTRuleBasedAppUi
   272 // Application UI class - CTRuleBasedAppUi
   276 //
   273 //
   277 ////////////////////////////////////////////////////////////////////////
   274 //
   278 
   275 
   279 /**
   276 /**
   280 The second phase constructor of the Application UI class.
   277 The second phase constructor of the Application UI class.
   281 The Application UI creates and owns the one and only view.
   278 The Application UI creates and owns the one and only view.
   282 */
   279 */
   318 CTRuleBasedAppUi::~CTRuleBasedAppUi()
   315 CTRuleBasedAppUi::~CTRuleBasedAppUi()
   319 	{
   316 	{
   320 	delete iAppView;
   317 	delete iAppView;
   321 	}
   318 	}
   322 
   319 
   323 ////////////////////////////////////////////////////////////////////////
   320 //
   324 //
   321 //
   325 // Implementation of the
   322 // Implementation of the
   326 // Application class - CTRuleBasedApplication
   323 // Application class - CTRuleBasedApplication
   327 //
   324 //
   328 ////////////////////////////////////////////////////////////////////////
   325 //
   329 
   326 
   330 const TUid KUidRuleBasedApp = { 0X1020D6FE };
   327 const TUid KUidRuleBasedApp = { 0X1020D6FE };
   331 
   328 
   332 /**
   329 /**
   333 The function is called by the UI framework to ask for the
   330 The function is called by the UI framework to ask for the
   388 EXPORT_C TInt WinsMain( TDesC* aCommandLine )
   385 EXPORT_C TInt WinsMain( TDesC* aCommandLine )
   389 	{
   386 	{
   390 	return EikStart::RunApplication( NewApplication, aCommandLine );
   387 	return EikStart::RunApplication( NewApplication, aCommandLine );
   391 	}
   388 	}
   392 #endif
   389 #endif
       
   390