bool CCylinderEditCommand::PreTranslateMessage(MSG* pMsg) { try { /*if (pMsg->message==WM_KEYUP|| pMsg->message==WM_CHAR) return false;*/ if (pMsg->message==WM_KEYUP||pMsg->message==WM_KEYDOWN || pMsg->message==WM_CHAR) { if (pMsg->wParam==VK_RETURN) { OnEnter(); return true; } if (pMsg->wParam==VK_ESCAPE) { m_app->StopCommander(); return true; } if (m_r_panel) { m_r_panel->GetWindow()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam); } if (m_other_params_dlg) { m_other_params_dlg->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam); return false; } if (pMsg->message==WM_KEYDOWN) return false; else return true; } else { if (pMsg->hwnd == m_app->GetViewPort()->GetWindow()->m_hWnd) { switch(pMsg->message) { case WM_MOUSEMOVE: MouseMove(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam)); return true; case WM_LBUTTONUP: LeftClick(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam)); return true; default: return false; } } } } catch(...){ } return false; }
WMSG_RESULT CUIBase::MouseMove(UINT16 x, UINT16 y, MSG* pMsg) { if (m_bHide) { if (m_bEnter == true) OnLeave(x, y); return WMSG_FAIL; } // 창을 벗어나는 애들 때문에 빼주자~ if (IsInside(x, y) == TRUE) { if (m_bEnter == false) OnEnter(x, y); } else { if (m_bEnter == true) OnLeave(x, y); } WMSG_RESULT ret = WMSG_FAIL; ret = OnMouseMove(x, y, pMsg); if (ret == WMSG_FAIL) ret = MouseMoveChild(x, y, pMsg); return ret; }
LTBOOL CFolderJoin::OnLButtonDblClick(int x, int y) { bDblClick = LTTRUE; CLTGUICtrl* pCtrl = GetSelectedControl(); if (pCtrl==m_pServerList && !m_pServerList->OnLButtonDblClick( x, y)) return OnEnter(); return CBaseFolder::OnLButtonDblClick( x, y); }
/// Called on scripted updates or otherwise when adjusted. void Movement::OnSpeedUpdated() { // Do stuff.. // Just call Start for now? if (ship) OnEnter(ship); else assert(false); }
void CScene::SetRunning( bool bRunning ) { if ( IsRunning() != bRunning ) { m_bIsRunning = bRunning; if ( m_bIsRunning ) OnEnter(); else OnExit(); } }
void OptionList::OnClick() { if(IsFocused()){ UMouseEvent mousePos = Brick::gUiEvent.GetMousePos(); if((mH>0) && (mousePos.Y > mY+mH)){ mCurOption = (mousePos.Y-mY-mH)/gDefaultFontHeight; OnEnter(); } }else{ SetFocus(); } }
void MainWindow::keyPressEvent(QKeyEvent* ev) { if (ev->key() == Qt::Key_Escape) { if (ui->fTagsEdit->hasFocus()) { ui->fEditor->setFocus(); } else { ui->fNoteList->setFocus(); } } else if (ev->key() == Qt::Key_Return && !ui->fEditor->hasFocus() ) { OnEnter(); } else if (ev->matches(QKeySequence::Find)) { ui->fSearchEdit->setFocus(); } else { QDialog::keyPressEvent(ev); } }
// // World Events // HRESULT CThingTreeCtrl::HandleOnUIEvent(IThing* pthing, BSTR bstrEventName, VARIANT varArg, BOOL bFromClient) { static CComBSTR bstrNameChanged(VW_NAMECHANGED_EVENT_STR); static CComBSTR bstrOnEnter(VW_CONTENTENTER_EVENT_STR); static CComBSTR bstrOnLeave(VW_CONTENTLEAVE_EVENT_STR); CVWUIView::HandleOnUIEvent(pthing, bstrEventName, varArg, bFromClient); if (CompareElements(&bstrOnEnter, &bstrEventName)) return OnEnter(pthing, varArg); else if (CompareElements(&bstrOnLeave, &bstrEventName)) return OnLeave(pthing, varArg); else if (CompareElements(&bstrNameChanged, &bstrEventName)) return NameChanged(pthing); return S_OK; }
/// Handles an entity entering the Trigger area. void RPG_Trigger::ProcessEnter(VisBaseEntity_cl* entity) { if(CanTrigger() && IsValidEntity(entity)) { m_lastEnteredTime = Vision::GetTimer()->GetTime(); if(m_maxTriggerCount > 0) { ++m_curTriggerCount; } m_insideEntities.Add(entity); OnEnter(entity); if(m_onEnterSource) m_onEnterSource->TriggerAllTargets(); TriggerScriptEvent("OnEnter", "*o", entity); } }
bool Task::HumanMove::OnUpdate(Object::IBase* Unit) { if(!m_Way.empty()) { if(!Unit->GetHex()->m_Friend[m_Way.front()] || !Unit->GetHex()->m_Friend[m_Way.front()]->GetType() == Terrain::Hex::HexEmpty) m_MoveTimer.SetPause(true); else m_MoveTimer.SetPause(false); if(!m_MoveTimer.GetPause() && m_MoveTimer.Update(true)) { if(m_MoveStep >= Model::Human::Animations[Model::Human::AnimMove][1] - Model::Human::Animations[Model::Human::AnimMove][0]) { m_MoveStep = 0; Unit->GetHex()->m_Friend[m_Way.front()]->SetUnit(Unit); m_Way.pop(); if(!m_Way.empty()) { if(Unit->GetHex()->m_Friend[m_Way.front()]->GetType() != Terrain::Hex::HexEmpty) OnEnter(Unit); Unit->SetDirection((UnitDirection)m_Way.front()); } } else { Unit->SetFrame(Model::Human::Animations[Model::Human::AnimMove][0] + m_MoveStep); m_MoveStep++; Unit->SetPosition(Unit->GetPosition() + (Unit->GetHex()->m_Friend[m_Way.front()]->GetRealCenter() - Unit->GetHex()->GetRealCenter()) / (Model::Human::Animations[Model::Human::AnimMove][1] - Model::Human::Animations[Model::Human::AnimMove][0])); } m_MoveTimer.Reset(); } return false; } return true; }
// Handles a key press. Returns FALSE if the key was not processed through this method. // Left, Up, Down, Right, and Enter are automatically passed through OnUp(), OnDown(), etc. DBOOL CMenuBase::HandleKeyDown(int key, int rep) { switch (key) { case VK_LEFT: { OnLeft(); break; } case VK_RIGHT: { OnRight(); break; } case VK_UP: { OnUp(); break; } case VK_DOWN: { OnDown(); break; } case VK_RETURN: { OnEnter(); break; } default: { return m_listOption.HandleKeyDown(key, rep); break; } } // Handled the key return DTRUE; }
/* The SM does not know anything about the system. This way it can be tested on a * different C compiler very easily. */ void TrafficLightSM(int event) { int NextState = State; switch (State) { case R_RY: switch (event) { case TICK: NextState = R_G; break; default: break; } break; case R_G: switch (event) { case TICK: NextState = R_Y; break; default: break; } break; case R_Y: switch (event) { case TICK: NextState = RY_R; break; default: break; } break; case RY_R: switch (event) { case TICK: NextState = G_R; break; default: break; } break; case G_R: switch (event) { case TICK: NextState = Y_R; break; default: break; } break; case Y_R: switch (event) { case TICK: NextState = R_RY; break; default: break; } break; default: break; // The program should never get here ! } if (NextState != State) { OnExit(State); OnEnter(NextState); State = NextState; } Do(State); }
void TextEditCommand::LeftClick(unsigned int nFlags,int pX,int pY) { OnEnter(); }
virtual void OnEnter(Owner owner) { OnEnter(); }
/* The SM does not know anything about the system. This way it can be tested on a * different C compiler very easily. */ void TurnstileSM( int event ) { int NextState = TS_State; static int Timeout,Count = 0, t = 5; switch( TS_State ) { case LOCKED: switch (event ) { case PAYED: NextState = UNLOCKED; Count++; printf("You can enter\n"); break; default: break; } break; case UNLOCKED: switch (event ) { case PAYED: Count++; Timeout = Count*t; printf("Persons Payed for %i\n",Count); NextState = UNLOCKED; break; case PERSONPASSED: Count--; printf("Persons entered\n"); printf("%i Persons can stil enter\n",Count); Timeout = Count*t; if(Count <= 0) { NextState = LOCKED; Count = 0; Timeout = 5; } break; case TICK: printf("Ticks = %i\n",Timeout); Timeout--; if(Timeout <= 0) { NextState = LOCKED; printf("You didnt make it - "); Timeout = t; Count = 0; } break; default: break; } break; default: break; // The program should never get here ! } if (NextState != TS_State) { OnExit(TS_State); OnEnter(NextState); TS_State = NextState; } Do( TS_State ); }
//! called during the update of the entity void MenuContext::Update() { if(!m_bTransitionInitialized) InitTransition(); switch(m_eState) { case S_Init: { m_Timer = 0.2f; m_eState = S_Transition; if (m_bTransitionIn) { OnEnter(); if (FadeRenderer::Instance()->GetDestColor() != Color::Zero) FadeRenderer::Instance()->StartFade(Color::Black, Color::Zero, m_Timer, false, false); else m_Timer = -1.0f; } else { OnExit(); if (FadeRenderer::Instance()->GetDestColor() != Color::Black) FadeRenderer::Instance()->StartFade(Color::Zero, Color::Black, m_Timer, false, true); else m_Timer = -1.0f; } } break; case S_Transition: if (m_Timer > 0.0f) { m_Timer -= g_fDeltaTime; } else { m_eState = S_Idle; if(!m_ContextToSwitchTo.empty()) { auto nextContext = m_ContextToSwitchTo; m_ContextToSwitchTo.clear(); m_bTransitionInitialized = false; super::Switch(nextContext.c_str()); return; } else if (m_bPopRequested) { super::Pop(); UIEvent* pEvent = snew UIEvent(); pEvent->m_Command = "POPPED"; EventManager::Instance()->SendEvent(pEvent); } } break; default: super::Update(); } }
void InputHandler::Update(double _dt) { moveMade = false; #pragma region Keys_Input if (glfwGetKey(myWindow, GLFW_KEY_UP) == GLFW_PRESS && keyCD <= 0) { if (IsSelectorInColumn(myBoard->topRow)) { selector -= 56; selectorXZ = glm::vec2(selectorXZ.x, selectorXZ.y - 7); } else { selector += 8; selectorXZ = glm::vec2(selectorXZ.x, selectorXZ.y + 1); } keyCD = 0.15f; } if (glfwGetKey(myWindow, GLFW_KEY_DOWN) == GLFW_PRESS && keyCD <= 0) { if (IsSelectorInColumn(myBoard->bottomRow)) { selector += 56; selectorXZ = glm::vec2(selectorXZ.x, selectorXZ.y + 7); } else { selector -= 8; selectorXZ = glm::vec2(selectorXZ.x, selectorXZ.y - 1); } keyCD = 0.15f; } if (glfwGetKey(myWindow, GLFW_KEY_RIGHT) == GLFW_PRESS && keyCD <= 0) { if (IsSelectorInColumn(myBoard->rightColumn)) { selector += 7; selectorXZ = glm::vec2(selectorXZ.x + 7, selectorXZ.y); } else { selector--; selectorXZ = glm::vec2(selectorXZ.x - 1, selectorXZ.y); } keyCD = 0.15f; } if (glfwGetKey(myWindow, GLFW_KEY_LEFT) == GLFW_PRESS && keyCD <= 0) { if (IsSelectorInColumn(myBoard->leftColumn)) { selector -= 7; selectorXZ = glm::vec2(selectorXZ.x - 7, selectorXZ.y); } else { selector++; selectorXZ = glm::vec2(selectorXZ.x + 1, selectorXZ.y); } keyCD = 0.15f; } if (glfwGetKey(myWindow, GLFW_KEY_ENTER) == GLFW_PRESS && keyCD <= 0) { OnEnter(); keyCD = 0.15f; } #pragma endregion keyCD -= _dt; if (secondEnter) { std::cout << "true" << std::endl; if (myBoard->GetPieceFromIndex(selector) != SquareType::EMPTY) { selectorColour = glm::vec4(0, 1, 0, 1); } } else { selectorColour = glm::vec4(0, 0, 1, 1); std::cout << "false" << std::endl; } }
bool CylinderCommand::PreTranslateMessage(MSG* pMsg) { try { /*if (pMsg->message==WM_KEYUP|| pMsg->message==WM_CHAR) return false;*/ if (pMsg->message==WM_KEYUP||pMsg->message==WM_KEYDOWN || pMsg->message==WM_CHAR) { if (pMsg->wParam==VK_RETURN) { OnEnter(); return true; } if (pMsg->wParam==VK_ESCAPE) { m_app->StopCommander(); return true; } switch(m_step) { case 0: if (m_get_first_point_panel) m_get_first_point_panel->GetWindow()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam); break; case 1: if (m_get_second_point_panel) m_get_second_point_panel->GetWindow()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam); break; case 2: if (m_get_r_panel) m_get_r_panel->GetWindow()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam); break; default: return false; } if (pMsg->message==WM_KEYDOWN) return false; else return true; } else { if (pMsg->hwnd == m_app->GetViewPort()->GetWindow()->m_hWnd) { switch(pMsg->message) { case WM_MOUSEMOVE: MouseMove(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam)); return true; case WM_LBUTTONDOWN: LeftClick(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam)); return true; default: return false; } } } } catch(...){ } return false; }
int TextView::ProcessKey(GKey &K) { Flags &= ~(TVF_GOTO_START | TVF_GOTO_END | TVF_EAT_MOVE); if (!K.IsChar) { if (K.Shift()) { Flags |= TVF_SHIFT; } else { Flags &= ~(TVF_SHIFT); } if (K.Down()) { switch (K.c) { case VK_ESCAPE: { OnEscape(K); break; } case VK_RETURN: { OnEnter(K); break; } case VK_BACK: { if (K.Alt()) { if (K.Ctrl()) { Doc.Redo(User); } else { Doc.Undo(User); } Dirty(TVF_DIRTY_ALL); } else { if (Flags & TVF_SELECTION) { OnDeleteSelection(FALSE); UpdateHiddenCheck(); } else if (User.Y() > 0 || User.X() > 0) { Flags &= ~(TVF_SHIFT); OnMoveCursor(-1, 0); OnDeleteText(&User, 1, FALSE); } } break; } case VK_RIGHT: case VK_LEFT: { bool bLeft = K.c == VK_LEFT; int Inc = (bLeft) ? -1 : 1; if (bLeft) { Flags |= TVF_GOTO_START; } else { Flags |= TVF_GOTO_END; } Flags |= TVF_EAT_MOVE; if (K.Ctrl()) { char *c = User; if (bLeft) { OnMoveCursor(Inc, 0); c = User; while ( strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } if (strchr(Delimiters, *c)) { while ( strchr(Delimiters, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } else { // IsText(*c) while ( !strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } if (bLeft) { if (User.Y() > 0 || User.X() > 0) { OnMoveCursor(-Inc, 0); } } else { while ( strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } } else { OnMoveCursor(Inc, 0); } break; } case VK_UP: { Flags |= TVF_GOTO_START; OnMoveCursor(0, -1); break; } case VK_DOWN: { Flags |= TVF_GOTO_END; OnMoveCursor(0, 1); break; } case VK_PRIOR: { int Move = 1-DisplayLines; OnSetHidden(HiddenLines+Move); OnMoveCursor(0, Move); break; } case VK_NEXT: { int Move = DisplayLines-1; OnSetHidden(HiddenLines+Move); OnMoveCursor(0, Move); break; } case VK_HOME: { if (K.Ctrl()) { OnSetCursor(0, 0); } else { OnMoveCursor(-User.X(), 0); } break; } case VK_END: { if (K.Ctrl()) { OnSetCursor(1024, Doc.GetLines()); } else { OnMoveCursor(User.LineLength()-User.X(), 0); } break; } case VK_DELETE: { if ( K.Shift() AND (Flags & TVF_SELECTION)) { Cut(); } else { if (Flags & TVF_SELECTION) { OnDeleteSelection(FALSE); UpdateHiddenCheck(); } else if ( User.Y() < Doc.GetLines() || User.X() < User.LineLength()) { OnDeleteText(&User, 1, FALSE); } } break; } case VK_INSERT: { if (Flags & TVF_SELECTION) { if (K.Ctrl()) { Copy(); } } if (K.Shift()) { Paste(); } break; } } } } else { // IsChar #define EXTENDED (1<<24) // if ( !(K.Data & EXTENDED)) { bool InsertChar = K.c >= ' '; // AND K.c < 128 if (K.c == 9) { if ((Flags & TVF_SELECTION) AND Start.Y() != End.Y()) { if (Flags & TVF_SHIFT) { InsertChar = !OnMultiLineTab(false); } else { InsertChar = !OnMultiLineTab(true); } } else { InsertChar = true; } } if (InsertChar) { char Char[2] = " "; Char[0] = K.c; if (OnInsertText(Char)) { OnMoveCursor(1, 0, true); } } } } return TRUE; }