本文整理汇总了C++中PostEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ PostEvent函数的具体用法?C++ PostEvent怎么用?C++ PostEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PostEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcCommand
void ProcCommand()
{
string comName = GetEventData();
string nodName = GetEventData();
switch(nodName)
{
case "B_OK":
if(comName=="activate" || comName=="click")
{
ExecuteSailorPayment();
PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT);
}
break;
case "B_CANCEL":
if(comName=="activate" || comName=="click")
{
SkipSailorPayment();
PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT);
}
if(comName=="upstep")
{
if(GetSelectable("B_OK")) {SetCurrentNode("B_OK");}
}
break;
}
}
示例2: PostEvent
void nxInputManager::Prepare(bool bRawInput,bool bDInput,bool bXInput)
{
PostEvent(NX_INPUT_ENUMERATE,0,0);
/// Create XINPUT devices
if (bXInput)
{
for (DWORD i = 0;i < nxXInputDevice::XI_MAXDEVICES;++i)
{
nxDeviceId uDevId = CreateDeviceId();
std::stringstream ss;
ss << "XINPUT_" << (i+1);
// Map the handle/index to the device id
mpHandleId[i] = uDevId;
// Map the "GUID" to the device id
SetGUIDMapping(uDevId,ss.str());
}
}
/// Create RAWINPUT devices
if (bRawInput)
{
// Enumerate the raw input devices on the system
std::vector<nxRawInputDevice> vcDevices;
nxRawInputDevice::Enumerate(vcDevices);
for (std::vector<nxRawInputDevice>::iterator it=vcDevices.begin();it!=vcDevices.end();++it)
{
// See if the GUID already has a device id
nxDeviceId uDevId;
const nxDeviceId*ptDevId=srDeviceGUID.LookupRight(it->GetGUID());
// If the guid already has a device id, get it
if (ptDevId)
{
uDevId = *ptDevId;
}
else // Otherwise, make one.
{
// If it doesn't, create one and add the mapping.
uDevId = CreateDeviceId();
SetGUIDMapping(uDevId,it->GetGUID());
}
// Map the handle to the device id
mpHandleId[it->GetDeviceHandle()] = uDevId;
}
}
/// Create DIRECTINPUT devices
if (bDInput)
{
// Try to create a directinput interface if it doesn't exist already
if (DirectInput8Create(nxInstanceHandle(), DIRECTINPUT_VERSION, IID_IDirectInput8, ( VOID** )&pDI, NULL) != DI_OK)
pDI = NULL;
else
{
// Enumerate the devices
pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,EnumJoysticksCallback,NULL, DIEDFL_ATTACHEDONLY );
}
}
PostEvent(NX_INPUT_READY,0,0);
}
示例3: Entry
virtual void * Entry()
{
CUrlOpt opt(m_url, URL_OPT_REFRESH, m_proxy);
m_bResult = (opt.Run() == CURLE_WRITE_ERROR);
if (m_bResult)
PostEvent(EVENT_TYPE_REFRESH_SUCC, m_proxy);
else
PostEvent(EVENT_TYPE_REFRESH_FAIL, m_proxy);
return NULL;
}
示例4: About
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_HOTKEY:
switch ( HIWORD( lParam ) )
{
case VK_RIGHT:
PostEvent( EVENT_TYPE_HOTKEY_NEXT );
break;
case VK_SPACE:
PostEvent( EVENT_TYPE_HOTKEY_PAUSE );
break;
}
break;
case WM_WTSSESSION_CHANGE:
switch ( wParam )
{
case WTS_SESSION_LOCK:
PostEvent( EVENT_TYPE_CONSOLE_LOCK );
break;
case WTS_SESSION_UNLOCK:
PostEvent( EVENT_TYPE_CONSOLE_UNLOCK );
break;
}
break;
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS * pPos = (WINDOWPOS*) lParam;
pPos->flags |= SWP_HIDEWINDOW;
pPos->flags &= ~SWP_SHOWWINDOW;
}
break;
case WM_INITDIALOG:
g_hwnd = hDlg;
WTSRegisterSessionNotification( hDlg, NOTIFY_FOR_ALL_SESSIONS );
RegisterHotKey( g_hwnd, 1, MOD_ALT | MOD_CONTROL, VK_SPACE );
RegisterHotKey( g_hwnd, 2, MOD_ALT | MOD_CONTROL, VK_RIGHT );
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
示例5: custom_butclick
static void
custom_butclick( CursorDevicePtr dev, short button )
{
static int toggle=0;
if( !toggle ) {
PostEvent( keyDown, (0x3b << 8) | 0xff );
PostEvent( mouseDown, 0 );
} else {
PostEvent( mouseUp, 0 );
PostEvent( keyUp, (0x3b << 8) | 0xff );
}
}
示例6: PostEvent
/*!
\fn swMain::_prepare_keyinput_ev( Event* _ev )
*/
Event* swMain::_prepare_keyinput_ev( Event* _ev )
{
event_t ev = 0;
MessageEvent* Mes;
KeyPressEvent* Kev;
///@todo Before pushing the key event, there is lots of function keys and other keyboard commands to translate into MessageEvent or refined KeyInput event
if( _ev->NcursesEvent() == KEY_RESIZE){
PostEvent( (Mes = new MessageEvent(event::TermResize) ) );
return Mes;
}
// Just push the event
PostEvent( _ev );//( Kev = new KeyPressEvent( _ev->What(), bMeta ) ) );
return _ev;
}
示例7: AnimationEvent
void Animate::DoExitCommands( int slot )
{
tiki_cmd_t cmds;
AnimationEvent *ev;
if( animFlags[ slot ] & ANIM_NOEXIT ) {
return;
}
// exit the previous animation
if( gi.Frame_Commands( edict->tiki, edict->s.frameInfo[ slot ].index, TIKI_FRAME_EXIT, &cmds ) )
{
int ii, j;
for( ii = 0; ii < cmds.num_cmds; ii++ )
{
ev = new AnimationEvent( cmds.cmds[ ii ].args[ 0 ] );
ev->SetAnimationNumber( edict->s.frameInfo[ slot ].index );
ev->SetAnimationFrame( 0 );
for( j = 1; j < cmds.cmds[ ii ].num_args; j++ )
{
ev->AddToken( cmds.cmds[ ii ].args[ j ] );
}
PostEvent( ev, 0 );
}
}
animFlags[ slot ] |= ANIM_NOEXIT;
}
示例8: SkipSailorPayment
void SkipSailorPayment()
{
ref mchref = GetMainCharacter();
int morale = 45;
if( CheckAttribute(mchref,"Ship.Crew.Morale") ) morale = sti(mchref.Ship.Crew.Morale);
morale -= nMoraleDecreaseQ;
if(morale<0) morale = 0;
mchref.CrewPayment = nPaymentQ;
int cn;
for(int i=0; i<4; i++)
{
cn = GetCompanionIndex(mchref,i);
if(cn>=0)
{
Characters[cn].Ship.Crew.Morale = morale;
}
}
if(morale<MORALE_NORMAL)
{
if(morale<=I_MIN_MORALE) {
PostEvent("ievent_GameOver",1,"s","mutiny");
}
}
}
示例9: PostEvent
void CReceiverThread::PostClosePort( const QString &strCOMx )
{
CComThreadEvent* pEvent = CComThreadEvent::CreateThreadEvent( CComThreadEvent::ThreadReceiver, CComThreadEvent::EventClosePort );
pEvent->SetPortName( strCOMx );
PostEvent( pEvent );
}
示例10: LOG
nsresult
nsSocketTransportService::DetachSocket(SocketContext *sock)
{
LOG(("nsSocketTransportService::DetachSocket [handler=%x]\n", sock->mHandler));
// inform the handler that this socket is going away
sock->mHandler->OnSocketDetached(sock->mFD);
// cleanup
sock->mFD = nsnull;
NS_RELEASE(sock->mHandler);
// find out what list this is on.
PRUint32 index = sock - mActiveList;
if (index < NS_SOCKET_MAX_COUNT)
RemoveFromPollList(sock);
else
RemoveFromIdleList(sock);
// NOTE: sock is now an invalid pointer
//
// notify the first element on the pending socket queue...
//
if (!PR_CLIST_IS_EMPTY(&mPendingSocketQ)) {
// move event from pending queue to event queue
PLEvent *event = PLEVENT_FROM_LINK(PR_LIST_HEAD(&mPendingSocketQ));
PR_REMOVE_AND_INIT_LINK(&event->link);
PostEvent(event);
}
return NS_OK;
}
示例11: execute
void wxGISGPToolManager::OnFinish(IProcess* pProcess, bool bHasErrors)
{
size_t nIndex;
for(nIndex = 0; nIndex < m_ProcessArray.size(); nIndex++)
if(pProcess == m_ProcessArray[nIndex].pProcess)
break;
wxDateTime end = wxDateTime::Now();
if(m_ProcessArray[nIndex].pTrackCancel)
{
if(bHasErrors)
{
m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("An error occured while executing %s. Failed to execute (%s)."), m_ProcessArray[nIndex].pTool->GetName().c_str(), m_ProcessArray[nIndex].pTool->GetName().c_str()), -1, enumGISMessageErr);
m_ProcessArray[nIndex].pTrackCancel->PutMessage(_("Error!"), -1, enumGISMessageTitle);
}
else
{
m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("Executed (%s) successfully"), m_ProcessArray[nIndex].pTool->GetName().c_str()), -1, enumGISMessageInfo);
m_ProcessArray[nIndex].pTrackCancel->PutMessage(_("Done"), -1, enumGISMessageTitle);
}
wxTimeSpan span = end - m_ProcessArray[nIndex].pProcess->GetBeginTime();
m_ProcessArray[nIndex].pTrackCancel->PutMessage(wxString::Format(_("End Time: %s (Elapsed Time: %s)"), end.Format().c_str(), span.Format(_("%H hours %M min. %S sec.")).c_str()), -1, enumGISMessageInfo);
}
wxGISProcessEvent event(wxPROCESS_FINISH, nIndex, bHasErrors);
PostEvent(event);
RunNextTask();
}
示例12: QCameraEvent
void QAnalogCameraThread::PostStartSourceStreamEvent( int nChannel, bool bRegister )
{
QCameraEvent* pEvent = new QCameraEvent( ( QEvent::Type ) QCameraEvent::CameraStartSourceStream );
pEvent->SetChannel( nChannel );
pEvent->SetRecognize( bRegister );
PostEvent( pEvent );
}
示例13: wxCHECK_RET
void wxGISMapView::OnMapDrawing(wxMxMapViewUIEvent& event)
{
wxEventType eType = event.GetEventType();
if(eType == wxMXMAP_DRAWING_START)
{
if(m_nDrawingState != enumGISMapFlashing) //maybe m_nDrawingState == enumGISMapNone
m_nDrawingState = enumGISMapDrawing;
wxCHECK_RET(m_pAni, wxT("Animation progress is not initiated"));
m_pAni->ShowProgress(true);
m_pAni->Play();
}
else if(eType == wxMXMAP_DRAWING_STOP)
{
if(!m_pGISDisplay->IsDerty() && m_nDrawingState == enumGISMapDrawing)
m_nDrawingState = enumGISMapNone;
if( m_nDrawingState == enumGISMapNone )
{
m_ClipGeometry.Clear();
}
//m_nDrawingState = enumGISMapNone;
Refresh();
wxCHECK_RET(m_pAni, wxT("Animation progress is not initiated"));
m_pAni->Stop();
m_pAni->ShowProgress(false);
}
PostEvent(event);
}
示例14: e
void EventQueue::Tick() {
// create temporary lists, so new events generated won't execute next tick ( avoid possible loop with events generating themselves )
std::deque<Event> tmp_EventQueue = LocalEventQueue;
LocalEventQueue.clear();
// Add the Events from other Threads to the EventQueue
Event e("INVALID_EVENT");
while (ThreadedEventQueue.try_pop(e))
{
//if ( !e.Is( "VIEW_DBG_STRING" ) && !e.Is( "EVT_FRAME") && !e.Is("EVT_TICK") ) Engine::out() << "[FE:"<< Module::Get()->GetName() <<"] Found Remote Event: " << e.getDebugName() << std::endl;
tmp_EventQueue.push_back(e);
// exclude remote origin events
LocalEventsThisSecond--;
}
for (auto& e : tmp_EventQueue)
{
LocalEventsThisSecond++;
PostEvent(e);
}
}
示例15: wxCHECK_RET
void wxGISTaskManager::AddMessage(const wxXmlNode* pIniNode)
{
wxCHECK_RET(pIniNode, wxT("Input wxXmlNode pointer is null"));
int nTaskId = GetDecimalValue(pIniNode, wxT("id"), wxNOT_FOUND);
if(nTaskId == wxNOT_FOUND)
return;
wxGISTask* pTasks = m_moTasks[nTaskId];
if(pTasks == NULL)
return;
long nMsgId = GetDecimalValue(pIniNode, wxT("msg_id"), wxNOT_FOUND);
if(nMsgId == wxNOT_FOUND)
return;
wxGISEnumMessageType eType = (wxGISEnumMessageType)GetDecimalValue(pIniNode, wxT("msg_type"), enumGISMessageUnk);
wxDateTime dt = GetDateValue(pIniNode, wxT("msg_dt"), wxDateTime::Now());
wxString sInfoData = pIniNode->GetAttribute(wxT("msg"));
if(!dt.IsValid() || sInfoData.IsEmpty())
return;
pTasks->AddMessage(new wxGISTaskMessage(nMsgId, sInfoData, eType, dt));
//notify
wxGISTaskEvent event(nTaskId, wxGISTASK_MESSAGEADDED, nMsgId);
PostEvent(event);
}