S60ClientServLabContainer.cpp
上传用户:laixiong
上传日期:2007-03-11
资源大小:2994k
文件大小:4k
源码类别:

Symbian

开发平台:

C/C++

  1. // Copyright (c) 2006 Nokia Corporation.
  2. // INCLUDE FILES
  3. #include "S60ClientServLabContainer.h"
  4. #include <eiklabel.h>  // for example label control
  5. #include <f32file.h>   // for file server usage
  6. _LIT(KClientServerLabText, "Client/Server Lab");
  7. _LIT(KFileWriterText, "File Writer");
  8. _LIT(KOutputFileSizeText, "Output file size:");
  9. _LIT(KNumBytes, "%d bytes");
  10. _LIT(KDataFilePath, "c:\system\apps\S60ClientServLab\S60ClientServLab.txt");
  11. _LIT8(KDataEntry, "A line of ASCII textrn");
  12. // ================= MEMBER FUNCTIONS =======================
  13. // ---------------------------------------------------------
  14. // CS60ClientServLabContainer::ConstructL(const TRect& aRect)
  15. // EPOC two phased constructor
  16. // ---------------------------------------------------------
  17. //
  18. void CS60ClientServLabContainer::ConstructL(const TRect& aRect)
  19.     {
  20.     CreateWindowL();
  21.     iTopLabel = new (ELeave) CEikLabel;
  22.     iTopLabel->SetContainerWindowL( *this );
  23.     iTopLabel->SetTextL(KClientServerLabText);
  24.     iBottomLabel = new (ELeave) CEikLabel;
  25.     iBottomLabel->SetContainerWindowL( *this );
  26.     iBottomLabel->SetTextL(KFileWriterText);
  27.     SetRect(aRect);
  28.     ActivateL();
  29.     }
  30. // Destructor
  31. CS60ClientServLabContainer::~CS60ClientServLabContainer()
  32.     {
  33.     delete iTopLabel;
  34.     delete iBottomLabel;
  35.     }
  36. // ---------------------------------------------------------
  37. // CS60ClientServLabContainer::SizeChanged()
  38. // Called by framework when the view size is changed
  39. // ---------------------------------------------------------
  40. //
  41. void CS60ClientServLabContainer::SizeChanged()
  42.     {
  43.     iTopLabel->SetExtent( TPoint(0,0), TSize(Rect().Width(), Rect().Height()/2));
  44.     iBottomLabel->SetExtent( TPoint(0,Rect().Height()/2), TSize(Rect().Width(),Rect().Height()/2));
  45.     }
  46. // ---------------------------------------------------------
  47. // CS60ClientServLabContainer::CountComponentControls() const
  48. // ---------------------------------------------------------
  49. //
  50. TInt CS60ClientServLabContainer::CountComponentControls() const
  51.     {
  52.     return 2; // return nbr of controls inside this container
  53.     }
  54. // ---------------------------------------------------------
  55. // CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
  56. // ---------------------------------------------------------
  57. //
  58. CCoeControl* CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
  59.     {
  60.     switch ( aIndex )
  61.         {
  62.         case 0:
  63.             return iTopLabel;
  64.         case 1:
  65.             return iBottomLabel;
  66.         default:
  67.             return NULL;
  68.         }
  69.     }
  70. // ---------------------------------------------------------
  71. // CS60ClientServLabContainer::Draw(const TRect& aRect) const
  72. // ---------------------------------------------------------
  73. //
  74. void CS60ClientServLabContainer::Draw(const TRect& aRect) const
  75.     {
  76.     CWindowGc& gc = SystemGc();
  77.     gc.SetPenStyle(CGraphicsContext::ENullPen);
  78.     gc.SetBrushColor(KRgbGray);
  79.     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
  80.     gc.DrawRect(aRect);
  81.     }
  82. // ---------------------------------------------------------
  83. // CS60ClientServLabContainer::HandleControlEventL(
  84. //     CCoeControl* aControl,TCoeEvent aEventType)
  85. // ---------------------------------------------------------
  86. //
  87. void CS60ClientServLabContainer::HandleControlEventL(
  88.     CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
  89.     {
  90.     }
  91.     
  92. // ---------------------------------------------------------
  93. // CS60ClientServLabContainer::WriteFileL()
  94. // ---------------------------------------------------------
  95. //
  96. void CS60ClientServLabContainer::WriteFileL()
  97.     {
  98.     }
  99. // End of File