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 <StoreDatabase.rsg> 00021 00022 #include "StoreDatabaseExternalInterface.h" 00023 #include "StoreDatabaseAppUi.h" 00024 #include "StoreDatabaseMainView.h" 00025 #include "StoreDatabase.hrh" 00026 00027 // MEMBER FUNCTIONS 00028 00029 // -------------------------------------------------------------------------- 00030 // Two-phase constructor 00031 // -------------------------------------------------------------------------- 00032 CStoreDatabaseMainView* CStoreDatabaseMainView::NewLC(CQikAppUi& aAppUi) 00033 { 00034 CStoreDatabaseMainView* self = new (ELeave) CStoreDatabaseMainView(aAppUi); 00035 CleanupStack::PushL(self); 00036 self->ConstructL(); 00037 return self; 00038 } 00039 00040 // -------------------------------------------------------------------------- 00041 // Default constructor 00042 // -------------------------------------------------------------------------- 00043 CStoreDatabaseMainView::CStoreDatabaseMainView(CQikAppUi& aAppUi) 00044 : CQikViewBase(aAppUi, KNullViewId) 00045 { 00046 } 00047 00048 // -------------------------------------------------------------------------- 00049 // Destructor 00050 // -------------------------------------------------------------------------- 00051 CStoreDatabaseMainView::~CStoreDatabaseMainView() 00052 { 00053 } 00054 00055 // -------------------------------------------------------------------------- 00056 // Second phase constructor 00057 // -------------------------------------------------------------------------- 00058 void CStoreDatabaseMainView::ConstructL() 00059 { 00060 BaseConstructL(); 00061 } 00062 00063 // -------------------------------------------------------------------------- 00064 // Called when this view is first time activated. 00065 // -------------------------------------------------------------------------- 00066 void CStoreDatabaseMainView::ViewConstructL() 00067 { 00068 ViewConstructFromResourceL(R_STOREDATABASE_UI_CONFIGURATIONS); 00069 iEikLabel = LocateControlByUniqueHandle<CEikLabel> (EStoreDatabaseLabelCtrl); 00070 } 00071 00072 // -------------------------------------------------------------------------- 00073 // Returns the identifier of this view. 00074 // -------------------------------------------------------------------------- 00075 TVwsViewId CStoreDatabaseMainView::ViewId()const 00076 { 00077 return TVwsViewId(KUidStoreDatabaseApp, KUidStoreDatabaseMainView); 00078 } 00079 00080 // -------------------------------------------------------------------------- 00081 // Handles user command. 00082 // In this example, all commands are sent to AppUi because 00083 // we want to have the same code with S60. 00084 // -------------------------------------------------------------------------- 00085 void CStoreDatabaseMainView::HandleCommandL(CQikCommand& aCommand) 00086 { 00087 iQikAppUi.HandleCommandL(aCommand.Id()); 00088 CQikViewBase::HandleCommandL(aCommand); 00089 } 00090 00091 // -------------------------------------------------------------------------- 00092 // Sets the text to be displayed on this control. 00093 // -------------------------------------------------------------------------- 00094 void CStoreDatabaseMainView::SetTextL(const TDesC& aText) 00095 { 00096 if (iEikLabel) 00097 { 00098 iEikLabel->SetTextL(aText); 00099 DrawDeferred(); 00100 } 00101 } 00102 00103 // -------------------------------------------------------------------------- 00104 // Called when the size/resolution of this control has been 00105 // changed. If this happens, the size of the label has to be 00106 // adjusted as well. 00107 // -------------------------------------------------------------------------- 00108 void CStoreDatabaseMainView::SizeChanged() 00109 { 00110 if (iEikLabel) 00111 { 00112 TRect rect(Rect()); 00113 iEikLabel->SetExtent( 00114 TPoint(0, 0), 00115 TSize(rect.Width(), rect.Height())); 00116 } 00117 } 00118 00119 // End of File