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

Symbian

开发平台:

C/C++

  1. // Copyright (c) 2006 Nokia Corporation.
  2. #include "S60UIExampleHighScoreContainer.h"
  3. #include "S60UIExampleHighScoreView.h"
  4. #include "S60UIExample.hrh"
  5. #include <S60UIExample.rsg>
  6. #include <aknviewappui.h>
  7. // -----------------------------------------------------------------------------
  8. // CS60UIExampleHighScoreView::NewL()
  9. // Two-phased constructor.
  10. // -----------------------------------------------------------------------------
  11. //
  12. CS60UIExampleHighScoreView* CS60UIExampleHighScoreView::NewL(CS60UIExampleModel& aModel)
  13.     {
  14.     CS60UIExampleHighScoreView* self = 
  15.             new (ELeave) CS60UIExampleHighScoreView(aModel);
  16.     CleanupStack::PushL (self);
  17.     self->ConstructL();
  18.     CleanupStack::Pop();
  19.     return self;
  20.     }
  21. // -----------------------------------------------------------------------------
  22. // CS60UIExampleHighScoreView::ConstructL()
  23. // Symbian 2nd phase constructor can leave.
  24. // -----------------------------------------------------------------------------
  25. //
  26. void CS60UIExampleHighScoreView::ConstructL()
  27.     {
  28.     BaseConstructL (R_S60UIEXAMPLE_HIGHSCORE_VIEW);
  29.     }
  30. // -----------------------------------------------------------------------------
  31. // CS60UIExampleHighScoreView::CS60UIExampleHighScoreView()
  32. // C++ default constructor can NOT contain any code, that might leave.
  33. // -----------------------------------------------------------------------------
  34. //
  35. CS60UIExampleHighScoreView::CS60UIExampleHighScoreView(
  36.                                                 CS60UIExampleModel& aModel)
  37.     : iModel(aModel)
  38.     {
  39.     }
  40. // -----------------------------------------------------------------------------
  41. // CS60UIExampleSettingsView::~CS60UIExampleSettingsView()
  42. // Destructor.
  43. // -----------------------------------------------------------------------------
  44. //
  45. CS60UIExampleHighScoreView::~CS60UIExampleHighScoreView()
  46.     {
  47.     delete iContainer;
  48.     }
  49. // -----------------------------------------------------------------------------
  50. // TUid CS60UIExampleHighScoreView::Id()
  51. // Returns the View Id.
  52. // -----------------------------------------------------------------------------
  53. //
  54. TUid CS60UIExampleHighScoreView::Id() const
  55.     {
  56.     return TUid::Uid (ES60UIExampleHighScoreViewId);
  57.     }
  58. // -----------------------------------------------------------------------------
  59. // CS60UIExampleHighScoreView::HandleCommandL()
  60. // Handles the commands.
  61. // -----------------------------------------------------------------------------
  62. //
  63. void CS60UIExampleHighScoreView::HandleCommandL (TInt aCommand)
  64.     {
  65.     switch (aCommand)
  66.         {
  67.         case EAknSoftkeyOk:
  68.             {
  69.             AppUi()->ActivateLocalViewL (TUid::Uid (ES60UIExampleInitialViewId));
  70.             break;
  71.             }
  72.         case EAknSoftkeyCancel:
  73.             {
  74.             AppUi()->ActivateLocalViewL (TUid::Uid (ES60UIExampleInitialViewId));
  75.             break;
  76.             }
  77.         default:
  78.             AppUi()->HandleCommandL (aCommand);
  79.         } 
  80.     }
  81. // -----------------------------------------------------------------------------
  82. // CS60UIExampleHighScoreView::DoActivateL()
  83. // Creates the Container class object.
  84. // -----------------------------------------------------------------------------
  85. //
  86. void CS60UIExampleHighScoreView::DoActivateL (
  87.                                       const TVwsViewId& /*aPrevViewId*/,
  88.                                       TUid /*aCustomMessageId*/, 
  89.                                       const TDesC8& /*aCustomMessage*/)
  90.     {
  91.     if (!iContainer)
  92.         {
  93.         iContainer = 
  94.                  CS60UIExampleHighScoreContainer::NewL(ClientRect(), iModel);
  95.         iContainer->SetMopParent(this);
  96.         AppUi()->AddToStackL(*this, iContainer);
  97.         }
  98.     }
  99. // -----------------------------------------------------------------------------
  100. // CS60UIExampleHighScoreView::DoDeactivate()
  101. // Deletes the Container class object.
  102. // -----------------------------------------------------------------------------
  103. //
  104. void CS60UIExampleHighScoreView::DoDeactivate()
  105.     {
  106.     if (iContainer)
  107.         {
  108.         // Remove HighScoreView's container from control Stack
  109.         AppUi()->RemoveFromStack(iContainer);
  110.         delete iContainer;
  111.         iContainer = NULL;
  112.         }
  113.     }
  114. // End of File