diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtexamp_8cpp-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtexamp_8cpp-source.html Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,92 @@ + +
+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 +