examples/ForumNokia/Symbian_OS_Basics_Lab_Exercises_v3_1/Lab_04308.cb1/starter/src/S60ClientServLabContainer.cpp

00001 // Copyright (c) 2006 Nokia Corporation.
00002 
00003 // INCLUDE FILES
00004 #include "S60ClientServLabContainer.h"
00005 
00006 #include <eiklabel.h>  // for example label control
00007 #include <f32file.h>   // for file server usage
00008 
00009 _LIT(KClientServerLabText, "Client/Server Lab");
00010 _LIT(KFileWriterText, "File Writer");
00011 _LIT(KOutputFileSizeText, "Output file size:");
00012 _LIT(KNumBytes, "%d bytes");
00013 _LIT(KDataFilePath, "c:\\system\\apps\\S60ClientServLab\\S60ClientServLab.txt");
00014 _LIT8(KDataEntry, "A line of ASCII text\r\n");
00015 // ================= MEMBER FUNCTIONS =======================
00016 
00017 // ---------------------------------------------------------
00018 // CS60ClientServLabContainer::ConstructL(const TRect& aRect)
00019 // EPOC two phased constructor
00020 // ---------------------------------------------------------
00021 //
00022 void CS60ClientServLabContainer::ConstructL(const TRect& aRect)
00023     {
00024     CreateWindowL();
00025 
00026     iTopLabel = new (ELeave) CEikLabel;
00027     iTopLabel->SetContainerWindowL( *this );
00028     iTopLabel->SetTextL(KClientServerLabText);
00029 
00030     iBottomLabel = new (ELeave) CEikLabel;
00031     iBottomLabel->SetContainerWindowL( *this );
00032     iBottomLabel->SetTextL(KFileWriterText);
00033 
00034     SetRect(aRect);
00035     ActivateL();
00036     }
00037 
00038 // Destructor
00039 CS60ClientServLabContainer::~CS60ClientServLabContainer()
00040     {
00041     delete iTopLabel;
00042     delete iBottomLabel;
00043     }
00044 
00045 // ---------------------------------------------------------
00046 // CS60ClientServLabContainer::SizeChanged()
00047 // Called by framework when the view size is changed
00048 // ---------------------------------------------------------
00049 //
00050 void CS60ClientServLabContainer::SizeChanged()
00051     {
00052     iTopLabel->SetExtent( TPoint(0,0), TSize(Rect().Width(), Rect().Height()/2));
00053     iBottomLabel->SetExtent( TPoint(0,Rect().Height()/2), TSize(Rect().Width(),Rect().Height()/2));
00054     }
00055 
00056 // ---------------------------------------------------------
00057 // CS60ClientServLabContainer::CountComponentControls() const
00058 // ---------------------------------------------------------
00059 //
00060 TInt CS60ClientServLabContainer::CountComponentControls() const
00061     {
00062     return 2; // return nbr of controls inside this container
00063     }
00064 
00065 // ---------------------------------------------------------
00066 // CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
00067 // ---------------------------------------------------------
00068 //
00069 CCoeControl* CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
00070     {
00071     switch ( aIndex )
00072         {
00073         case 0:
00074             return iTopLabel;
00075         case 1:
00076             return iBottomLabel;
00077         default:
00078             return NULL;
00079         }
00080     }
00081 
00082 // ---------------------------------------------------------
00083 // CS60ClientServLabContainer::Draw(const TRect& aRect) const
00084 // ---------------------------------------------------------
00085 //
00086 void CS60ClientServLabContainer::Draw(const TRect& aRect) const
00087     {
00088     CWindowGc& gc = SystemGc();
00089     gc.SetPenStyle(CGraphicsContext::ENullPen);
00090     gc.SetBrushColor(KRgbGray);
00091     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
00092     gc.DrawRect(aRect);
00093     }
00094 
00095 // ---------------------------------------------------------
00096 // CS60ClientServLabContainer::HandleControlEventL(
00097 //     CCoeControl* aControl,TCoeEvent aEventType)
00098 // ---------------------------------------------------------
00099 //
00100 void CS60ClientServLabContainer::HandleControlEventL(
00101     CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
00102     {
00103     }
00104     
00105 // ---------------------------------------------------------
00106 // CS60ClientServLabContainer::WriteFileL()
00107 // ---------------------------------------------------------
00108 //
00109 void CS60ClientServLabContainer::WriteFileL()
00110     {
00111     }
00112 
00113 // End of File  

Generated by  doxygen 1.6.2