本文整理汇总了C++中TWsEvent类的典型用法代码示例。如果您正苦于以下问题:C++ TWsEvent类的具体用法?C++ TWsEvent怎么用?C++ TWsEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TWsEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDebugMessage
void showDebugMessage( const char* source, const char* message )
{
if ( source && message )
{
memset(g_szSource, 0, sizeof(g_szSource) );
memset(g_szMessage, 0, sizeof(g_szMessage) );
memcpy( g_szSource, source, strlen(source) > 20 ? 20 : strlen(source) );
memcpy( g_szMessage, message, strlen(message) > 100 ? 100 : strlen(message));
// Create a window server event
RWsSession wsSession;
TWsEvent event;
if ( wsSession.Connect() == KErrNone )
{
// Set event data. eventType.data = KData;
event.SetType(EEventUser + ECmdShowDebugWindow); // set event type
event.SetTimeNow(); // set the event time
event.SetHandle(wsSession.WsHandle()); // set window server handle
// Send the created event
wsSession.SendEventToAllWindowGroups(event);
}
}
}
示例2: QueueAndInfoPrint
/**
Inform with a message ,the timer seconds remaining till its up.\n
Send event to windows group when timer time is up .\n
*/
void CTestTimer::RunL()
{
--iSecondsRemaining;
if (iSecondsRemaining>0)
{
QueueAndInfoPrint();
}
else
{
User::InfoPrint(_L("Time's up"));
iCompleted = ETrue;
CCoeEnv* env = CCoeEnv::Static();
TWsEvent theEvent;
theEvent.SetType(EEventUser + 1);
RWsSession ws;
TInt theRes = ws.Connect();
if(theRes == KErrNone)
{
RWindowGroup& winGroup = env->RootWin();
theEvent.SetType(EEventUser + 1);
theEvent.SetTimeNow();
TInt theId = winGroup.Identifier();
ws.SendEventToWindowGroup(theId, theEvent);
}
ws.Close();
}
}
示例3: HandleWsEventL
void CEPongAppUi::HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination)
{
if (aEvent.Type() == EEventUser)
{
TApaSystemEvent* eventData = reinterpret_cast<TApaSystemEvent*> (aEvent.EventData());
if ((*eventData) == EApaSystemEventShutdown)
{
eventData++;
if ((*eventData) == KGoomMemoryLowEvent)
{
return; // skip default handling
}
}
}
if (aEvent.Type() == EEventFocusGained)
{
if (iAppView)
iAppView->startEngine();
}
else if (aEvent.Type() == EEventFocusLost)
{
if (iAppView)
iAppView->stopEngine(ETrue);
}
CAknAppUi::HandleWsEventL(aEvent, aDestination);
}
示例4: RWindowGroup
/**
Utility to close the dialogs once the screen has been compared
with a previous capture of an expected display.
*/
void CConeErrorMsgTestAppUi::CloseDialogsL()
{
User::LeaveIfError(iWs.Connect());
TInt wgFocus = iWs.GetFocusWindowGroup();
const TUint32 ENullWsHandle = 0xFFFFFFFF; // Events delivered to this handle are thrown away
RWindowGroup wg = RWindowGroup(iWs);
wg.Construct(ENullWsHandle);
TInt wgId = wg.Identifier();
TWsEvent event;
event.SetType(EEventKey);
TKeyEvent *keyEvent = event.Key();
keyEvent->iCode = EKeyEscape;
keyEvent->iScanCode = EStdKeyEscape;
keyEvent->iModifiers = 0;
TInt limit = 0;
for(limit = 0; wgFocus != wgId && (limit < 50); limit++)
{
iWs.SendEventToAllWindowGroups(event);
wgFocus = iWs.GetFocusWindowGroup();
RDebug::Print(_L("CloseAllPanicWindowsL() - EKeyEscape sent to Windows Group"));
}
wg.Close();
iWs.Close();
}
示例5: SendMessageToSysAp
void CAknKeyLockControl::SendMessageToSysAp(TInt aMessage)
{
RWsSession& ws = iEikonEnv->WsSession();
TInt wgId=0;
CApaWindowGroupName::FindByAppUid(KSysApUid, ws, wgId);
if (wgId)
{
TWsEvent event;
event.SetType(aMessage);
event.SetTimeNow();
ws.SendEventToWindowGroup(wgId, event);
}
}
示例6: RedrawRequest
EXPORT_C TInt CSDL::RedrawRequest()
{
if(gEpocEnv && gEpocEnv->iDsa)
{
//const TInt err = gEpocEnv->iDsa->RedrawRequest();
TWsEvent event;
event.SetType(EEventScreenDeviceChanged),
event.SetTimeNow();
AppendWsEvent(event);/*
EpocSdlEnv::PostUpdate();
return err; */
}
return KErrNotReady;
}
示例7: FEP
/**
@SYMTestCaseID UIF-FEPTEST-0001
@SYMPREQ 0000
@SYMTestCaseDesc Launch the application and offer events.
@SYMTestPriority High
@SYMTestStatus Implemented
@SYMTestActions Launch an application with the editor window. The application is made to exit, when a timer expires.
Load the FEP (TFEP1). Create character codes for text events. Offer the texts to the applciation for
the TFEP1 to intercept.
A succesful implementation ensures that the application exits without a crash.
Here the layout of the FEP UI is such that the Composition Window is integrated into the Target Control.
@SYMTestExpectedResults The test case fails if the app crashed with an exception and passes if the app exits cleanly
*/
void CDefocusingEdwinUi::RunTestStepL(TInt aStep)
{
User::After(TTimeIntervalMicroSeconds32(1));
TTimeIntervalSeconds theInterval;
TTime tm;
tm.HomeTime();
tm.SecondsFrom(iTmStart,theInterval);
TInt theInt = theInterval.Int();
if(iCurrentSecond < theInt)
{
if(KNumberOfSeconds-iCurrentSecond < 0)
{
iCoeEnv->InstallFepL(KNullUid);
AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
return;
}
else
{
TBuf<100> message;
message.Format(_L("%d seconds remaining"), KNumberOfSeconds-iCurrentSecond);
User::InfoPrint(message);
iCurrentSecond = theInt;
}
}
TWsEvent theEvent;
TKeyEvent *theKey = theEvent.Key();
theKey->iScanCode = 0;
theKey->iModifiers= 0;
theKey->iRepeats=0;
theKey->iCode = 'A';
TInt nRes = aStep % 7;
if(nRes == 6)
{
theKey->iCode = EKeyEnter;
}
else
{
theKey->iCode += nRes;
}
INFO_PRINTF2(_L("Simulate Key Event with code %d"), theKey->iCode);
SendEventToWindowGroups(theEvent);
}
示例8: while
void CMicroDialog::CMicroDialogInt::EventLoopL(void)
{
TRequestStatus eventStatus,timerStatus;
iWsSession.EventReady(&eventStatus);
iTimer.After(timerStatus,100000);
iDoLoop=ETrue;
TInt focus=EFalse;
while(iDoLoop)
{
User::WaitForAnyRequest();
if(eventStatus.Int()!=KRequestPending)
{
User::LeaveIfError(eventStatus.Int());
TWsEvent event;
iWsSession.GetEvent(event);
switch(event.Type())
{
case EEventFocusLost:
focus=EFalse;
break;
case EEventFocusGained:
focus=ETrue;
break;
case EEventFocusGroupChanged:
if(iWsSession.GetFocusWindowGroup()==iOwner->iId)
iRootWin.SetOrdinalPosition(0);
break;
case EEventKey:
iOwner->iCallback->MicroDialogKey(*(event.Key()));
break;
}
iWsSession.EventReady(&eventStatus);
}
else if(timerStatus.Int()!=KRequestPending)
{
User::LeaveIfError(timerStatus.Int());
if(focus) iOwner->iCallback->MicroDialogTimer();
iTimer.After(timerStatus,100000);
}
else
{
iOwner->iCallback->MicroDialogRequest();
}
}
iTimer.Cancel();
iWsSession.EventReadyCancel();
}
示例9: ModifiersChangedEvent
LOCAL_C TInt ModifiersChangedEvent(const TWsEvent& aWsEvent)
{
TModifiersChangedEvent* modEvent = aWsEvent.ModifiersChanged();
TUint modstate = KMOD_NONE;
if (modEvent->iModifiers & EModifierLeftShift)
modstate |= KMOD_LSHIFT;
if (modEvent->iModifiers & EModifierRightShift)
modstate |= KMOD_RSHIFT;
if (modEvent->iModifiers & EModifierLeftCtrl)
modstate |= KMOD_LCTRL;
if (modEvent->iModifiers & EModifierRightCtrl)
modstate |= KMOD_RCTRL;
if (modEvent->iModifiers & EModifierLeftAlt)
modstate |= KMOD_LALT;
if (modEvent->iModifiers & EModifierRightAlt)
modstate |= KMOD_RALT;
if (modEvent->iModifiers & EModifierLeftFunc)
modstate |= KMOD_LMETA;
if (modEvent->iModifiers & EModifierRightFunc)
modstate |= KMOD_RMETA;
if (modEvent->iModifiers & EModifierCapsLock)
modstate |= KMOD_CAPS;
SDL_SetModState(STATIC_CAST(SDLMod,(modstate | KMOD_LSHIFT)));
return 0;
}
示例10: HandleWsEvent
int HandleWsEvent(_THIS, const TWsEvent& aWsEvent)
{
switch (aWsEvent.Type())
{
case EEventSwitchOff:
SDL_PrivateQuit();
return 0;
case EEventPointerBufferReady:
return PointerBufferReadyEvent(_this/*, aWsEvent.Time()*/);
case EEventPointer: /* Mouse pointer events */
return PointerEvent(_this, aWsEvent);
case EEventKeyDown: /* Key events */
return KeyDownEvent(_this, aWsEvent);
case EEventKeyUp: /* Key events */
return KeyUpEvent(_this, aWsEvent);
case EEventFocusGained: /* SDL window got focus */
return FocusGainedEvent(_this);
case EEventFocusLost: /* SDL window lost focus */
return FocusLostEvent(_this);
case EEventModifiersChanged:
return ModifiersChangedEvent(aWsEvent);
case EEventScreenDeviceChanged:
return ScreenDeviceChanged();
case ESDLWsEvent:
return InternalEvent(aWsEvent);
default:
return 0;
}
}
示例11: SendWindowEvent
void CSyncEngineWrap::SendWindowEvent(TInt aEvent)
{
// Create a window server event
RWsSession wsSession;
TWsEvent event;
if (wsSession.Connect() == KErrNone)
{
// Set event data. eventType.data = KData;
event.SetType(EEventUser + aEvent); // set event type
event.SetTimeNow(); // set the event time
event.SetHandle(wsSession.WsHandle()); // set window server handle
// Send the created event
wsSession.SendEventToAllWindowGroups(event);
}
}
示例12: Fail
/** Fetches a message
*/
TInt COomMessageFetch::Fail()
{
TWsEvent event;
TPtr8 ptr(NULL,0);
TUid uid;
event.SetType(EEventMessageReady);
event.SetHandle(CLIENT_HANDLE);
event.SetTimeNow();
SEventMessageReady& eventMessageReady=*(SEventMessageReady*)event.EventData();
eventMessageReady.iWindowGroupIdentifier=iWinGroup2.Identifier();
eventMessageReady.iMessageUid=TUid::Uid(UID_VALUE);
eventMessageReady.iMessageParametersSize=MESSAGE_LEN;
TInt ret=TheClient->iWs.FetchMessage(uid,ptr,event);
if (ret==KErrNone)
User::Free((TAny *)ptr.Ptr());
return(ret);
}
示例13: __LOGSTR1
void CButton::GetWgEvent()
{
#ifdef __DEBUG
__LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
#endif
if(iStatus == KErrNone)
{
TWsEvent e;
iWs.GetEvent(e);
#ifdef __DEBUG
__LOGSTR1("event: %d",e.Type());
#endif
switch(e.Type())
{
case EEventPointer:
case EEventPointerEnter:
case EEventDragDrop:
{
__LOGSTR("SendClose");
iMconnect->SendClose();
break;
}
case EEventFocusGained:
__LOGSTR("Focus gained");
iIsFocus = ETrue;
//iColor = KRgbGreen;
break;
case EEventFocusLost:
__LOGSTR("Focus lost");
iIsFocus = EFalse;
//iColor = KRgbRed;
break;
case EEventKeyDown:
__LOGSTR2("EEventKeyDown,iIsFocus: %d,iScanCode: %d",iIsFocus,e.Key()->iScanCode);
if(iIsFocus && e.Key()->iScanCode == 167)
{
iMconnect->SendClose();
}
break;
}
}
Draw();
iWs.Flush();
WaitWgEvent();
}
示例14: WsSession
void CAppOomMonitorPlugin::SendMessageToApp(TInt aMessage)
{
RWsSession& ws = WsSession();
TInt wgId = 0;
do
{
CApaWindowGroupName::FindByAppUid(iAppUid, ws, wgId);
if (wgId>0)
{
TWsEvent event;
event.SetType(aMessage);
event.SetTimeNow();
ws.SendEventToWindowGroup(wgId, event);
}
}
while (wgId>0);
}
示例15: SendWindowEvent
void SendWindowEvent(TInt aEvent, const char* data)
{
// Create a window server event
RWsSession wsSession;
TWsEvent event;
if ( wsSession.Connect() == KErrNone )
{
// Set event data. eventType.data = KData;
event.SetType(EEventUser + aEvent); // set event type
event.SetTimeNow(); // set the event time
event.SetHandle(wsSession.WsHandle()); // set window server handle
if ( data )
((char**)event.EventData())[0] = strdup(data);
// Send the created event
wsSession.SendEventToAllWindowGroups(event);
}
}