bool PullToRefreshTrait::OnPreviewTouchMoved(Control& source, const TouchEventInfo& touchEventInfo) { if(_captured) { int offset; if(_direction == PULL_TO_REFRESH_DIRECTION_TOP) offset = (touchEventInfo.GetCurrentPosition() - _touchDownPoint).y; else offset = -(touchEventInfo.GetCurrentPosition() - _touchDownPoint).y; float progress = (float)offset / (float)PULL_TO_REFRESH_OFFSET_LIMIT; if(progress > 1.0f) { progress = 1.0f; } Canvas *canvas = _progressControl->GetCanvasN(); int doneSize = (int)(canvas->GetBoundsF().width * progress); int undoneSize = canvas->GetBounds().width - doneSize; if(undoneSize < 0) { undoneSize = 0; } Rectangle progressRectangle = canvas->GetBounds(); progressRectangle.width -= undoneSize; progressRectangle.x += undoneSize / 2; canvas->SetCompositeMode(COMPOSITE_MODE_OVERLAY); canvas->FillRectangle(Color(0x569cdd, false), progressRectangle); delete canvas; } return false; }
void CCEGLView::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo & touchInfo) { int id = (int)touchInfo.GetPointId(); float x = (float)touchInfo.GetCurrentPosition().x; float y = (float)touchInfo.GetCurrentPosition().y; CCLOG("OnTouchPressed id = %d,x = %f,y = %f, count = %d", id, x, y, s_mapTouches.GetCount()); if (!m_bNotHVGA) { x = x * 2 / 3; y = y * 2 / 3; } onTouchesBegin(&id, &x, &y, 1); }
void CCEGLView::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo & touchInfo) { int id = (int)touchInfo.GetPointId(); float x = (float)touchInfo.GetCurrentPosition().x; float y = (float)touchInfo.GetCurrentPosition().y; if (!m_bNotHVGA) { x = x * 2 / 3; y = y * 2 / 3; } onTouchesEnd(&id, &x, &y, 1); CCLOG("OnTouchReleased id = %d,x = %f,y = %f", id, x, y); }
bool PullToRefreshTrait::OnPreviewTouchReleased(Control& source, const TouchEventInfo& touchEventInfo) { if(_captured) { if(_direction == PULL_TO_REFRESH_DIRECTION_TOP) { if((touchEventInfo.GetCurrentPosition() - _touchDownPoint).y > PULL_TO_REFRESH_OFFSET_LIMIT) { _refreshable->OnRefresh(); } } else { if((touchEventInfo.GetCurrentPosition() - _touchDownPoint).y < -PULL_TO_REFRESH_OFFSET_LIMIT) { _refreshable->OnRefresh(); } } _progressControl->RequestRedraw(true); } return false; }
void TouchEventForm::OnTouchReleased(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { AppLog("OnTouchReleased is called. [%d]%d,%d", touchInfo.GetPointId(), currentPosition.x, currentPosition.y); DisplayMultipointTouchInfo(source); if(__clicked == true && __moved == false && __doubleClicked == false && __longPressed == false) { __singleClicked = true; char c[5]; int i; c[0]=2; c[1]=2; c[2]=1; c[3]=2; c[4]=0; __sock->Send((void *)c,5,i); } if(__doubleClicked == true && __moved == false) { char c[5]; int i; c[0]=2; c[1]=2; c[2]=1; c[3]=2; c[4]=0; __sock->Send((void *)c,5,i); } }
// IPropagatedTouchEventListener bool PullToRefreshTrait::OnPreviewTouchPressed(Control& source, const TouchEventInfo& touchEventInfo) { _touchDownPoint = touchEventInfo.GetCurrentPosition(); if(_direction == PULL_TO_REFRESH_DIRECTION_TOP) { _captured = _tableView->GetCurrentScrollPosition() == 0; } else { _captured = _tableView->GetBottomDrawnItemIndex() == (_tableView->GetItemCount() - 1); } return false; }
void TouchEventForm::OnTouchDoublePressed(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { AppLog("OnTouchDoublePressed is called. [%d]%d,%d", touchInfo.GetPointId(), currentPosition.x, currentPosition.y); DisplayMultipointTouchInfo(source); //__sock->Send((void *)c,5,i); __doubleClicked = true; __singleClicked = false; }
void TouchEventForm::OnTouchPressed(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { AppLog("OnTouchPressed is called. [%d]%d,%d", touchInfo.GetPointId(), currentPosition.x, currentPosition.y); DisplayMultipointTouchInfo(source); __x=currentPosition.x; __y=currentPosition.y; __clicked = true; __moved = false; __doubleClicked = false; __longPressed = false; }
void BadaAppForm::OnTouchReleased(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { if (_buttonState != kMoveOnly) { pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP, currentPosition); if (_buttonState == kRightButtonOnce) { _buttonState = kLeftButton; } // flick to skip dialog if (touchInfo.IsFlicked()) { pushKey(Common::KEYCODE_PERIOD); } } }
void BadaAppForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo) { if (getShortcutIndex() == -1) { pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP, currentPosition); if (_buttonState == RightButtonOnce) { _buttonState = LeftButton; } // flick to skip dialog if (touchInfo.IsFlicked()) { pushKey(Common::KEYCODE_PERIOD); } } else if (_touchCount == 1) { bool repeat = false; switch (_shortcutIndex) { case SHORTCUT_SWAP_MOUSE: switch (_buttonState) { case LeftButton: _buttonState = RightButtonOnce; g_system->displayMessageOnOSD(_("Right Once")); break; case RightButtonOnce: g_system->displayMessageOnOSD(_("Right Active")); _buttonState = RightButton; break; case RightButton: g_system->displayMessageOnOSD(_("Left Active")); _buttonState = LeftButton; break; } break; case SHORTCUT_F5: pushKey(Common::KEYCODE_F5); break; case SHORTCUT_ESCAPE: pushKey(Common::KEYCODE_ESCAPE); repeat = true; break; } // allow key repeat or terminate setup mode _shortcutTimer = repeat ? g_system->getMillis() : -1; } }
void TouchEventForm::OnTouchMoved(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { AppLog("OnTouchMoved is called. [%d]%d,%d", touchInfo.GetPointId(), currentPosition.x, currentPosition.y); DisplayMultipointTouchInfo(source); if(__doubleClicked == true) { char c[5]; c[0]=2; c[1]=2; c[2]=1; c[3]=(__release)?1:0; c[4]=0; int i; __sock->Send((void *)c,5,i); if(__release) { __pButton1->SetText(String("Mouse Press")); } else { __pButton1->SetText(String("Mouse Release")); } Draw(); Show(); __release = (__release)?false:true; __doubleClicked = false; } /*static long long lastTime=0; long long presentTime; Osp::System::SystemTime::GetTicks(presentTime); long limit = presentTime - lastTime; AppLog("Time diff : %ld",limit); if(limit >=20 ){ limit=1; } else if(limit < 16) { limit = 6; }else if(limit <17) { limit =5; }else if(limit <20) { limit =1; } AppLog("Limit Value : %ld",limit); //for(int j=0;j<3;j++) {*/ char c[5]; int i; c[0]=1; c[1]=2; c[2]=__x-currentPosition.x; c[3]=__y-currentPosition.y; c[4]=0; for(int j=0;j<3;j++) __sock->Send((void *)c,5,i); //} __x=currentPosition.x; __y=currentPosition.y; __moved = true; /*Osp::System::SystemTime::GetTicks(presentTime); lastTime = presentTime;*/ __singleClicked = false; }
void TouchEventForm::OnTouchFocusOut(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { AppLog("OnTouchFocusOut is called. [%d]%d,%d", touchInfo.GetPointId(), currentPosition.x, currentPosition.y); DisplayMultipointTouchInfo(source); }