void CGraphicExampleControl::NextPhaseL()
	{
	if (++iPhase >= iMaxPhases)
		{
		Quit();
		}
	else
		{
		UpdateModelL();
		DrawNow();
		}
	}
Exemplo n.º 2
0
EXPORT_C TKeyResponse CEikListBoxTextEditor::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
	{
	_AKNTRACE_FUNC_ENTER;
	_AKNTRACE( "aKeyEvent.iCode is %d", aKeyEvent.iCode );
	_AKNTRACE( "aKeyEvent.iScanCode is %d", aKeyEvent.iScanCode );
	_AKNTRACE( "aType is %d", aType );
	if (!Editor() || aType!=EEventKey)
		{
		_AKNTRACE_FUNC_EXIT;
		return EKeyWasNotConsumed;
		}

	if(iEditorObserver && iEditorObserver->HandleListBoxEditorEventL(this,aKeyEvent)==EKeyWasConsumed)
		{ // gives owning dialogs or listboxes a chance to intecept keys prior to or instead of passing to editor
		// eg the CCknFileSaveAsDialog needs to check if a file exists when the enter key is pressed
		// and prevent the Enter key being passed on to the editor, or intecept the up/down keys to
		// allow scrolling out of the editor
		_AKNTRACE_FUNC_EXIT;
		return EKeyWasConsumed;
		}
	const TInt code=aKeyEvent.iCode;
	if (aKeyEvent.iModifiers&(EModifierCtrl|EModifierShift)==(EModifierCtrl|EModifierShift))
		{
		TBuf<24> buf;
		iCoeEnv->ReadResource(buf,R_EIK_EDWIN_SHIFT_CTRL_HOTKEYS);
		const TInt pos=buf.Locate(TChar(code+'a'-1));
		if (pos==CEikEdwin::EHotKeyInsertChar)
			{
			_AKNTRACE_FUNC_EXIT;
			return EKeyWasConsumed;
			}
		}
	switch (code)
		{
		case EKeyEnter:     // stop editing and update data
		case EKeyOK:
			UpdateModelL();
			StopEditingL();
			break;
		case EKeyEscape:    // stop editing and don't update data
			StopEditingL();
			break;
		default:
			Editor()->OfferKeyEventL(aKeyEvent,aType);
		}
	_AKNTRACE_FUNC_EXIT;
	return EKeyWasConsumed;
	}
void CGraphicExampleControl::ConstructL(const TRect& aRect,
		MGraphicsExampleObserver* aGraphObserver, const CCoeControl& aParent)
	{
	// remember the graphics observer
	iGraphObserver = aGraphObserver;
	// create window
	CreateWindowL(&aParent);
	// construct font for messages
	TFontSpec spec(KtxtSwiss, 213);
	iMessageFont = iCoeEnv->CreateScreenFontL(spec);
	// set rectangle to prescription
	SetRect(aRect);
	// go for it
	ActivateL();
	UpdateModelL(); // phase 0
	}