S60 3rd Edition SDK for Symbian OS
Example Applications Guide

LmUiRefAppContainer.cpp

00001 /*
00002 * ============================================================================
00003 *  Name        : LmUiRefAppContainer.cpp
00004 *  Part of     : Landmark UI Reference Application 
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include <AknsUtils.h>
00018 #include <avkon.hrh>
00019 #include <eiklabel.h>
00020 #include "LmUiRefAppUi.h"
00021 #include <lmuirefapp.rsg>
00022 #include "lmuirefapp.hrh"
00023 #include "LmUiRefAppView.h"
00024 #include "LmUiRefAppContainer.h"
00025 
00026 _LIT(KLmUiRefApp, "Landmarks UI Reference");
00027 _LIT(KTextApp, "Application!");
00028 
00029 const TInt KLable1X(20);
00030 const TInt KLable1Y(50);
00031 const TInt KLable2X(50);
00032 const TInt KLable2Y(80);
00033 
00034 // ================= MEMBER FUNCTIONS =======================
00035 
00036 // ----------------------------------------------------------------------------
00037 // CLmUiRefAppContainer::NewL
00038 // ----------------------------------------------------------------------------
00039 //
00040 CLmUiRefAppContainer* CLmUiRefAppContainer::NewL(
00041         MObjectProvider* aParent,
00042         const TRect& aRect )
00043     {
00044     CLmUiRefAppContainer* self =
00045     new( ELeave ) CLmUiRefAppContainer();
00046     CleanupStack::PushL( self );
00047     self->SetMopParent( aParent );
00048     self->ConstructL( aRect );
00049     CleanupStack::Pop(self ); // self
00050     return self;
00051     }
00052 
00053 // ----------------------------------------------------------------------------
00054 // CLmUiRefAppContainer::ConstructL 
00055 // ----------------------------------------------------------------------------
00056 void CLmUiRefAppContainer::ConstructL(const TRect& aRect)
00057     {
00058     CreateWindowL();
00059     
00060     iLabel = new (ELeave) CEikLabel;
00061     iLabel->SetContainerWindowL(*this);    
00062     iLabel->SetTextL(KLmUiRefApp);
00063     iToDoLabel = new (ELeave) CEikLabel;
00064     iToDoLabel->SetContainerWindowL( *this );        
00065     iToDoLabel->SetTextL(KTextApp);
00066     SetRect(aRect);
00067     ActivateL();
00068     }
00069 
00070 // ----------------------------------------------------------------------------
00071 // CLmUiRefAppContainer::CLmUiRefAppContainer() 
00072 // ----------------------------------------------------------------------------
00073 CLmUiRefAppContainer::CLmUiRefAppContainer()
00074     {
00075     }
00076 
00077 // ----------------------------------------------------------------------------
00078 // CLmUiRefAppContainer::~CLmUiRefAppContainer() 
00079 // ----------------------------------------------------------------------------
00080 CLmUiRefAppContainer::~CLmUiRefAppContainer()
00081     {
00082     delete iLabel;
00083     delete iToDoLabel;
00084     }
00085 
00086 // ---------------------------------------------------------
00087 // CLmUiRefAppContainer::SizeChanged() 
00088 // Called by framework when the view size is changed
00089 // ---------------------------------------------------------
00090 //
00091 void CLmUiRefAppContainer::SizeChanged()
00092     {
00093     // TODO: Add here control resize code etc.    
00094     iLabel->SetExtent(TPoint(KLable1X, KLable1Y), iLabel->MinimumSize());
00095     iToDoLabel->SetExtent(TPoint(KLable2X, KLable2Y), iToDoLabel->MinimumSize());     
00096     }
00097 
00098 // ---------------------------------------------------------
00099 // CLmUiRefAppContainer::CountComponentControls() const 
00100 // return number of controls inside this container
00101 // ---------------------------------------------------------
00102 //
00103 TInt CLmUiRefAppContainer::CountComponentControls() const
00104     {
00105     return 2; // return nbr of controls inside this container
00106     }
00107 
00108 // ---------------------------------------------------------
00109 // CLmUiRefAppContainer::ComponentControl(TInt aIndex) const 
00110 // return control inside the container
00111 // ---------------------------------------------------------
00112 //
00113 CCoeControl* CLmUiRefAppContainer::ComponentControl(TInt aIndex) const
00114     {
00115     switch ( aIndex )
00116         {
00117         case 0:
00118             return iLabel;
00119         case 1:
00120             return iToDoLabel;
00121         default:
00122             return NULL;
00123         }
00124     }
00125 
00126 // ---------------------------------------------------------
00127 //  CLmUiRefAppContainer::Draw(Trect& aRect) 
00128 // ---------------------------------------------------------
00129 //
00130 void CLmUiRefAppContainer::Draw(const TRect& /*aRect*/) const
00131     {
00132     // Get the standard graphics context 
00133     CWindowGc& gc = SystemGc();   
00134     // TODO: Add your drawing code here
00135     // example code...
00136     gc.SetPenStyle(CGraphicsContext::ENullPen);
00137     gc.SetBrushColor(KRgbGray);
00138     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
00139     TRect rect = Rect();
00140     gc.DrawRect(rect);
00141     }
00142 
00143 // End of File  

© Nokia 2006

Back to top