examples/SFExamples/Quick_Recipes_on_Symbian_OS_Multimedia_Example_Code/MidiPlaying/src/uiq3/MidiPlayingMainView.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 // INCLUDES
00018 #include <QikCommand.h>
00019 #include <eiklabel.h>
00020 #include <MidiPlaying.rsg>
00021 
00022 #include "MidiPlayingExternalInterface.h"
00023 #include "MidiPlayingAppUi.h"
00024 #include "MidiPlayingMainView.h"
00025 #include "MidiPlaying.hrh"
00026 
00027 // MEMBER FUNCTIONS
00028 
00029 // --------------------------------------------------------------------------
00030 // Two-phase constructor
00031 // --------------------------------------------------------------------------
00032 CMidiPlayingMainView* CMidiPlayingMainView::NewL(CQikAppUi& aAppUi)
00033         {
00034         CMidiPlayingMainView* self = NewLC(aAppUi);
00035         CleanupStack::Pop(self);
00036         return self;
00037         }
00038 
00039 // --------------------------------------------------------------------------
00040 // Two-phase constructor
00041 // --------------------------------------------------------------------------
00042 CMidiPlayingMainView* CMidiPlayingMainView::NewLC(CQikAppUi& aAppUi)
00043         {
00044         CMidiPlayingMainView* self = new (ELeave) CMidiPlayingMainView(aAppUi);
00045         CleanupStack::PushL(self);
00046         self->ConstructL();
00047         return self;
00048         }
00049 
00050 // --------------------------------------------------------------------------
00051 // Default constructor
00052 // --------------------------------------------------------------------------
00053 CMidiPlayingMainView::CMidiPlayingMainView(CQikAppUi& aAppUi) 
00054         : CQikViewBase(aAppUi, KNullViewId)
00055         {
00056         }
00057 
00058 // --------------------------------------------------------------------------
00059 // Destructor
00060 // --------------------------------------------------------------------------
00061 CMidiPlayingMainView::~CMidiPlayingMainView()
00062         {
00063         }
00064 
00065 // --------------------------------------------------------------------------
00066 // Second phase constructor
00067 // --------------------------------------------------------------------------
00068 void CMidiPlayingMainView::ConstructL()
00069         {
00070         BaseConstructL();
00071         }
00072         
00073 // --------------------------------------------------------------------------
00074 // Called when this view is first time activated.
00075 // --------------------------------------------------------------------------
00076 void CMidiPlayingMainView::ViewConstructL()
00077         {
00078         ViewConstructFromResourceL(R_MIDIPLAYING_UI_CONFIGURATIONS);    
00079         iEikLabel = LocateControlByUniqueHandle<CEikLabel> (EMidiPlayingLabelCtrl);
00080         }
00081 
00082 // --------------------------------------------------------------------------
00083 // Returns the identifier of this view.
00084 // --------------------------------------------------------------------------
00085 TVwsViewId CMidiPlayingMainView::ViewId()const
00086         {
00087         return TVwsViewId(KUidMidiPlayingApp, KUidMidiPlayingMainView);
00088         }
00089 
00090 // --------------------------------------------------------------------------
00091 // Handles user command.
00092 // In this example, all commands are sent to AppUi because
00093 // we want to have the same code with S60.
00094 // --------------------------------------------------------------------------
00095 void CMidiPlayingMainView::HandleCommandL(CQikCommand& aCommand)
00096         {
00097         iQikAppUi.HandleCommandL(aCommand.Id());
00098         CQikViewBase::HandleCommandL(aCommand);
00099         }
00100 
00101 // --------------------------------------------------------------------------
00102 // Sets the text to be displayed on this control.
00103 // --------------------------------------------------------------------------
00104 void CMidiPlayingMainView::SetTextL(const TDesC& aText)
00105         {
00106         if (iEikLabel)
00107                 {
00108                 iEikLabel->SetTextL(aText);
00109                 DrawDeferred();
00110                 }
00111         }
00112 
00113 // --------------------------------------------------------------------------
00114 // Called when the size/resolution of this control has been
00115 // changed. If this happens, the size of the label has to be
00116 // adjusted as well.
00117 // --------------------------------------------------------------------------
00118 void CMidiPlayingMainView::SizeChanged()
00119     {
00120         if (iEikLabel)
00121                 {
00122                 TRect rect(Rect());
00123                 iEikLabel->SetExtent(
00124                         TPoint(0, 0),
00125                         TSize(rect.Width(), rect.Height()));
00126                 }
00127         }
00128         
00129 // End of File

Generated by  doxygen 1.6.2