00001 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // 00015 00016 #include "txtexamp.h" 00017 00018 #include <coemain.h> 00019 #include <coeaui.h> 00020 00021 void CGraphicExampleControl::ConstructL(const TRect& aRect, MGraphicsExampleObserver* aFormObserver, 00022 const CCoeControl& aParent) 00023 { 00024 // remember observer 00025 iFormObserver=aFormObserver; 00026 // create window 00027 CreateWindowL(&aParent); 00028 // construct font for messages 00029 TCoeFont font(TCoeFont::EMedium, TCoeFont::EPlain); 00030 CCoeControl::ScreenFont(font); 00031 // set rectangle to prescription 00032 SetRect(aRect); 00033 // go for it 00034 ActivateL(); 00035 UpdateModelL(); // phase 0 00036 } 00037 00038 CGraphicExampleControl::~CGraphicExampleControl() 00039 { 00040 iCoeEnv->ReleaseScreenFont(iMessageFont); 00041 } 00042 00043 void CGraphicExampleControl::Quit() 00044 { 00045 iFormObserver->NotifyGraphicExampleFinished(); 00046 } 00047 00048 void CGraphicExampleControl::NextPhaseL() 00049 { 00050 if (++iPhase >= iMaxPhases) 00051 Quit(); 00052 else 00053 { 00054 UpdateModelL(); 00055 if (!iUpdateModelDoesRedraw) DrawNow(); 00056 } 00057 } 00058 00059 void CGraphicExampleControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) 00060 { 00061 if (aPointerEvent.iType==TPointerEvent::EButton1Down) NextPhaseL(); 00062 } 00063 00064 TKeyResponse CGraphicExampleControl::OfferKeyEventL( 00065 const TKeyEvent& aKeyEvent,TEventCode aType 00066 ) 00067 { 00068 if (aType!=EEventKey) return EKeyWasNotConsumed; 00069 TInt code=aKeyEvent.iCode; 00070 switch (code) 00071 { 00072 case ' ': 00073 NextPhaseL(); 00074 break; 00075 default: 00076 return EKeyWasNotConsumed; 00077 } 00078 return EKeyWasConsumed; 00079 } 00080
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.