S60 3rd Edition SDK FP2 for Symbian OS
CommonDialogsEx

CommonDialogsExContainer.cpp

00001 /*
00002 * ============================================================================
00003 *  Name        : commondialogsexcontainer.cpp
00004 *  Part of     : CommonDialogsEx
00005 *  Description : Implements CommonDialogsEx container.
00006 *  Version     : 
00007 *
00008 *  Copyright (c) 2006 Nokia Corporation.
00009 *  This material, including documentation and any related 
00010 *  computer programs, is protected by copyright controlled by 
00011 *  Nokia Corporation.
00012 * ==============================================================================
00013 */
00014 
00015 // INCLUDE FILES
00016 #include "CommonDialogsExContainer.h"
00017 
00018 #include <eiklabel.h>  // for example label control
00019 #include <aknlists.h>
00020 
00021 _LIT( KCommonDialogsExTitle, "Example View" );
00022 _LIT( KCommonDialogsExGuide, "Press Options to start" );
00023 // ================= MEMBER FUNCTIONS =======================
00024 
00025 // ---------------------------------------------------------
00026 // CCommonDialogsExContainer::ConstructL(const TRect& aRect)
00027 // EPOC two phased constructor
00028 // ---------------------------------------------------------
00029 //
00030 void CCommonDialogsExContainer::ConstructL(const TRect& aRect)
00031     {
00032     CreateWindowL();
00033     
00034     iLabel = new (ELeave) CEikLabel;
00035     iLabel->SetContainerWindowL( *this );
00036     iLabel->SetTextL( KCommonDialogsExTitle );
00037 
00038     iToDoLabel = new (ELeave) CEikLabel;
00039     iToDoLabel->SetContainerWindowL( *this );
00040     iToDoLabel->SetTextL( KCommonDialogsExGuide );
00041 
00042 
00043     SetRect(aRect);
00044     ActivateL();
00045     }
00046 
00047 // Destructor
00048 CCommonDialogsExContainer::~CCommonDialogsExContainer()
00049     {
00050     delete iLabel;
00051     delete iToDoLabel;
00052     }
00053 
00054 // ---------------------------------------------------------
00055 // CCommonDialogsExContainer::SizeChanged()
00056 // Called by framework when the view size is changed
00057 // ---------------------------------------------------------
00058 //
00059 void CCommonDialogsExContainer::SizeChanged()
00060     {
00061     iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
00062     iToDoLabel->SetExtent( TPoint(10,90), iToDoLabel->MinimumSize() );
00063     }
00064 
00065 // ---------------------------------------------------------
00066 // CCommonDialogsExContainer::CountComponentControls() const
00067 // ---------------------------------------------------------
00068 //
00069 TInt CCommonDialogsExContainer::CountComponentControls() const
00070     {
00071     return 2; // return nbr of controls inside this container
00072     }
00073 
00074 // ---------------------------------------------------------
00075 // CCommonDialogsExContainer::ComponentControl(TInt aIndex) const
00076 // ---------------------------------------------------------
00077 //
00078 CCoeControl* CCommonDialogsExContainer::ComponentControl(TInt aIndex) const
00079     {
00080     switch ( aIndex )
00081         {
00082         case 0:
00083             return iLabel;
00084         case 1:
00085             return iToDoLabel;
00086         default:
00087             return NULL;
00088         }
00089     }
00090 
00091 // ---------------------------------------------------------
00092 // CCommonDialogsExContainer::Draw(const TRect& aRect) const
00093 // ---------------------------------------------------------
00094 //
00095 void CCommonDialogsExContainer::Draw(const TRect& aRect) const
00096     {
00097     CWindowGc& gc = SystemGc();
00098     gc.SetPenStyle(CGraphicsContext::ENullPen);
00099     gc.SetBrushColor(KRgbGray);
00100     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
00101     gc.DrawRect(aRect);
00102     }
00103 
00104 // ---------------------------------------------------------
00105 // CCommonDialogsExContainer::HandleControlEventL(
00106 //     CCoeControl* aControl,TCoeEvent aEventType)
00107 // ---------------------------------------------------------
00108 //
00109 void CCommonDialogsExContainer::HandleControlEventL(
00110     CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
00111     {
00112 
00113     }
00114 
00115 // ---------------------------------------------------------
00116 // CCommonDialogsExContainer::ShowTextL
00117 // Show dynamic text;
00118 // ---------------------------------------------------------
00119 //
00120 void CCommonDialogsExContainer::ShowTextL(
00121     const TDesC& aText, const TDesC& aTextSub)
00122     {
00123     iLabel->SetTextL(aText);
00124     iToDoLabel->SetTextL(aTextSub);
00125     SizeChanged();
00126     DrawDeferred();
00127     }
00128 
00129 // ----------------------------------------------------------------------------
00130 // void CAknAtSetPageContainer::HandleResourceChange(TInt)
00131 // Makes dynamic resolution change smoother
00132 // ----------------------------------------------------------------------------
00133 //
00134 void CCommonDialogsExContainer::HandleResourceChange(TInt aType)
00135     {
00136     if (aType == KEikDynamicLayoutVariantSwitch)
00137         {
00138         SetRect( iAvkonAppUi->ClientRect());
00139         }
00140     CCoeControl::HandleResourceChange( aType );
00141     }
00142 
00143 // End of File

© Nokia 2007

Back to top