TEST_F(LocalConnectionTest, close) { Connection::Ptr conn(LocalConnection::New()); Connection::Ptr other(((LocalConnection*) conn.get())->other()); ConnectionDelegateMock mock; EXPECT_CALL(mock, OnClosed(conn.get())); EXPECT_CALL(mock, OnClosed(other.get())); conn->BindDelegate(&mock); other->BindDelegate(&mock); conn->Close(); }
void ff::ViewWindow::Close() { assertRet(IsValid()); OnClosing(); #if !METRO_APP ::SendMessage(Handle(), WM_CLOSE, 0, 0); #endif OnClosed(); }
int BufferIOEvent::ReceiveData() { char buffer[MAX_BYTES_RECEIVE]; int read_bytes = std::min(rx_msg_mq_.NeedMore(), (size_t)sizeof(buffer)); int len = read(fd_, buffer, read_bytes); printf("[BufferIOEvent::ReceiveData] to read: %d, got: %d\n", read_bytes, len); if (len < 0) { OnError(errno, strerror(errno)); } else if (len == 0 ) { OnClosed(); } else { rx_msg_mq_.AppendData(buffer, len); MessageMQ::MessageDispatcher processing_msg_cb = std::bind(&BufferIOEvent::OnReceived, this, std::placeholders::_1); rx_msg_mq_.Apply(processing_msg_cb); } return len; }
void ScriptDialogHandler::ShowDialog(ScriptDialogRequest& request) { boost::shared_ptr<UiServices::UiModule> ui_module = framework_->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices).lock(); if ( !ui_module.get()) { // todo: LogError: "Cannot show ScriptDialogWidget, ui_module pointer not valid." return; } QString widget_name = "Message from object"; ScriptDialogWidget* widget = new ScriptDialogWidget(request, framework_); dialogs_.append(widget); connect(widget, SIGNAL( OnClosed(s32, QString)), this, SLOT( OnDialogClosed(s32, QString)) ); UiServices::UiWidgetProperties widget_properties(widget_name, UiServices::SceneWidget); UiServices::UiProxyWidget *proxy_widget = ui_module->GetInworldSceneController()->AddWidgetToScene(widget, widget_properties); // we don't need to store a proxy widget here.. proxy_widget->show(); }
void CNetDDESvrApp::CloseConnection(CNetDDESvrSocket* pConnection) { try { // Send disconnect message. CNetDDEPacket oPacket(CNetDDEPacket::NETDDE_SERVER_DISCONNECT); pConnection->SendPacket(oPacket); // Update stats. ++App.m_nPktsSent; } catch (CSocketException& /*e*/) { } pConnection->Close(); // Cleanup. OnClosed(pConnection, 0); }
void CSocket::OnAsyncSelect(int nEvent, int nError) { // Error occurred BUT not due to socket closure? if ( (nError != 0) && ((nEvent & FD_CLOSE) == 0) ) { OnError(nEvent, nError); return; } // Socket closed? if (nEvent & FD_CLOSE) { OnClosed(nError); return; } // Read/Write now available? if (nEvent & FD_READ) OnReadReady(); if (nEvent & FD_WRITE) OnWriteReady(); }
// Called every frame void ABaseDoor::Tick( float DeltaTime ) { Super::Tick( DeltaTime ); if (bMoveDoor && (RepeatCount > 0 || bRepeat)) { FVector RelLocation = DoorMesh->RelativeLocation; switch (DoorState) { case eState::CLOSED: { RelLocation.Z -= MaxDoorVelocity * DeltaTime; if (RelLocation.Z <= Start.Z) { bMoveDoor = false; DoorState = eState::OPEN; OnOpend(); RepeatCount -= 1; } break; } case eState::OPEN: { RelLocation.Z += MaxDoorVelocity * DeltaTime; if (RelLocation.Z >= End.Z) { bMoveDoor = false; DoorState = eState::CLOSED; OnClosed(); RepeatCount -= 1; } break; } } DoorMesh->SetRelativeLocation(RelLocation); } }
Boolean TAboutForm::EventHandler(TApplication * appP, EventType * eventP) { Boolean handled = FALSE; switch(eventP->eType) { case EVENT_WinPaint: { DrawWindow(); handled = TRUE; break; } case EVENT_CtrlSelect: { if(m_BackBtn == eventP->sParam1) { handled = TRUE; this->CloseWindow(); return handled; } switch(eventP->sParam1) { case RES_SYSTEM_WINDOW_TITLE_BUTTON_ID: { handled = TRUE; if(handled == TRUE) { handled = FALSE; } else handled = TRUE; } break; default: { return OnCtlSelect(GetControlPtr(eventP->sParam1),eventP); } break; } } break; case EVENT_WinEraseClient: { TDC dc(this); WinEraseClientEventType *pEraseEvent = reinterpret_cast< WinEraseClientEventType* >( eventP ); TRectangle rc(pEraseEvent->rc); TRectangle rcBack(5, 142, 310, 314); this->GetBounds(&rcBack); // 刷主窗口背景色 dc.SetBackColor(RGB_COLOR_WHITE); // 擦除 dc.EraseRectangle(&rc, 0); dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_title_bg), 0, 0, SCR_W, GUI_API_STYLE_ALIGNMENT_LEFT); //dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_KA_ID_BITMAP_bottom_bg), 0, rcBack.Bottom()-68, //320, GUI_API_STYLE_ALIGNMENT_LEFT|GUI_API_STYLE_ALIGNMENT_TOP); pEraseEvent->result = 1; handled = TRUE; } break; case EVENT_MenuSelect: { handled = OnMenuSelect(eventP->sParam1); } break; case EVENT_CtrlContextMenu: { handled = OnCtlContextMenu(eventP); break; } case EVENT_MenuOpen: { OnBeforeMenuOpen(); } break; case EVENT_WinInit: { OnWinCreate(); } break; case EVENT_WinClose: { handled = TRUE; OnClosed(); if(handled) handled = FALSE; else handled = TRUE; } break; case EVENT_KeyCommand: { // 抓取右软键事件 if (eventP->sParam1 == SYS_KEY_SOFTKEY_RIGHT_UP || eventP->sParam1 == SYS_KEY_SOFTKEY_RIGHT_LONG) { // 模拟退出按钮选中消息 HitControl(m_BackBtn); handled = TRUE; } } break; } if (handled == FALSE) return TWindow::EventHandler(appP,eventP); return handled; }
void ScriptDialogWidget::OnIgnorePressed() { close(); emit OnClosed(request_.GetChannel(), ""); }
void ScriptDialogWidget::OnButtonPressed(QString id) { close(); emit OnClosed(request_.GetChannel(), id); }
Nena::Application::Window::~Window() { ::OutputDebugStringA("Nena::Application::Window::~Window()\n"); OnClosed(); }
void EventHandler::OnEvent (sf::Event* event) { switch (event->type) { case sf::Event::Closed: //Window closed: OnClosed(); break; case sf::Event::Resized: //Window resized: OnWindowResized (event->size); case sf::Event::GainedFocus: //Window gained focus: OnGainedFocus(); break; case sf::Event::LostFocus: //Window lost focus: OnLostFocus(); break; break; case sf::Event::TextEntered: //Text entered: OnTextEntered (event->text); break; case sf::Event::KeyPressed: //Key pressed: OnKeyPressed (event->key); break; case sf::Event::KeyReleased: //Key released: OnKeyReleased (event->key); break; case sf::Event::MouseWheelMoved: //Mouse wheel moved: OnMouseWheelMoved (event->mouseWheel); break; case sf::Event::MouseButtonPressed: //Mouse button pressed: OnMouseButtonPressed (event->mouseButton); break; case sf::Event::MouseButtonReleased: //Mouse button released: OnMouseButtonReleased(event->mouseButton); break; case sf::Event::MouseMoved: //Mouse moved: OnMouseMoved (event->mouseMove); break; case sf::Event::MouseEntered: //Mouse entered Window bounds: OnMouseEntered(); break; case sf::Event::MouseLeft: //Mouse left Window bounds: OnMouseLeft(); break; case sf::Event::JoystickButtonPressed: //Joystick button pressed: OnJoystickButtonPressed (event->joystickButton); break; case sf::Event::JoystickButtonReleased: //Joystick button released: OnJoystickButtonReleased(event->joystickButton); break; case sf::Event::JoystickMoved: //Joystick moved: OnJoystickMoved(event->joystickMove); break; case sf::Event::JoystickConnected: //Joystick connected: OnJoystickConnected (event->joystickConnect); break; case sf::Event::JoystickDisconnected: //Joystick disconnected: OnJoystickDisconnected (event->joystickConnect); break; } }