/*virtual*/ bool SkBorderView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Inval)) { this->inval(NULL); return true; } if (evt.isType("recommendDim")) { evt.findScalar("leftMargin", &fLeft); evt.findScalar("rightMargin", &fRight); evt.findScalar("topMargin", &fTop); evt.findScalar("bottomMargin", &fBottom); //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout //but that gives me an error SkStackViewLayout* layout; fMargin.set(fLeft, fTop, fRight, fBottom); if (this->getLayout()) { layout = (SkStackViewLayout*)this->getLayout(); layout->setMargin(fMargin); } else { layout = new SkStackViewLayout; layout->setMargin(fMargin); this->setLayout(layout)->unref(); } this->invokeLayout(); } return this->INHERITED::onEvent(evt); }
virtual bool onEvent(const SkEvent& evt) { if (evt.isType(gReplaceTransitionEvt)) { SkView* prev = fPrev; prev->ref(); fPrev->detachFromParent(); fPrev = (SkView*)SkEventSink::FindSink(evt.getFast32()); (void)SampleView::SetUsePipe(fPrev, SkOSMenu::kOffState); //attach the new fPrev and call unref to balance the ref in onDraw this->attachChildToBack(fPrev)->unref(); this->inval(NULL); SkASSERT(1 == prev->getRefCnt()); prev->unref(); return true; } if (evt.isType("transition-done")) { fNext->setLoc(0, 0); fNext->setClipToBounds(false); SkEvent* evt = new SkEvent(gReplaceTransitionEvt, this->getParent()->getSinkID()); evt->setFast32(fNext->getSinkID()); //increate ref count of fNext so it survives detachAllChildren fNext->ref(); this->detachAllChildren(); evt->post(); return true; } return this->INHERITED::onEvent(evt); }
bool SampleWindow::onEvent(const SkEvent& evt) { if (evt.isType(ANIMATING_EVENTTYPE)) { if (fAnimating) { this->nextSample(); this->postAnimatingEvent(); } return true; } if (evt.isType("set-curr-index")) { fCurrIndex = evt.getFast32() % fSamples.count(); this->loadView(fSamples[fCurrIndex]()); return true; } return this->INHERITED::onEvent(evt); }
bool onEvent(const SkEvent& evt) override { if (evt.isType(INVAL_ALL_TYPE)) { this->inval(NULL); return true; } return this->INHERITED::onEvent(evt); }
bool GMSampleView::onEvent(const SkEvent& evt) { if (evt.isType("GMSampleView::showSize")) { fShowSize = SkToBool(evt.getFast32()); return true; } return this->INHERITED::onEvent(evt); }
bool SkGridView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Key)) { switch (evt.getFast32()) { case kUp_SkKey: this->moveSelectionUp(); return true; case kDown_SkKey: this->moveSelectionDown(); return true; case kRight_SkKey: case kOK_SkKey: if (fSource && fCurrIndex >= 0) { SkEvent* evt = fSource->getEvent(fCurrIndex); if (evt) { // augment the event with our local rect (void)this->getCellRect(fCurrIndex, (SkRect*)evt->setScalars("local-rect", 4, NULL)); SkView* view = this->sendEventToParents(*evt); delete evt; return view != NULL; } } break; } } return this->INHERITED::onEvent(evt); }
bool SkListView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Key)) { switch (evt.getFast32()) { case kUp_SkKey: this->moveSelectionUp(); return true; case kDown_SkKey: this->moveSelectionDown(); return true; case kRight_SkKey: case kOK_SkKey: if (fSource && fCurrIndex >= 0) { SkEvent* evt = fSource->getEvent(fCurrIndex); if (evt) { SkView* view = this->sendEventToParents(*evt); delete evt; return view != NULL; } else // hack to make toggle work { this->dirtyStrCache(); this->inval(NULL); } } break; } } return this->INHERITED::onEvent(evt); }
/*virtual*/ bool SkProgressBarView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Inval)) { this->inval(NULL); return true; } if (evt.isType("recommendDim")) { SkScalar height; if (evt.findScalar("y", &height)) this->setHeight(height); return true; } return this->INHERITED::onEvent(evt); }
/*virtual*/ bool SkScrollBarView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Inval)) { this->inval(NULL); return true; } if (evt.isType("recommendDim")) { SkScalar width; if (evt.findScalar("x", &width)) this->setWidth(width); return true; } return this->INHERITED::onEvent(evt); }
bool SkOSWindow::onEvent(const SkEvent& evt) { if (evt.isType("inval-imageview")) { update(NULL); if (NULL == fUnixWindow.fGLContext) this->doPaint(); return true; } return INHERITED::onEvent(evt); }
bool SkWindow::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventDelayInval)) { for (SkRegion::Iterator iter(fDirtyRgn); !iter.done(); iter.next()) this->onHandleInval(iter.rect()); fWaitingOnInval = false; return true; } return this->INHERITED::onEvent(evt); }
bool SampleCode::KeyQ(const SkEvent& evt, SkKey* outKey) { if (evt.isType(gKeyEvtName, sizeof(gKeyEvtName) - 1)) { if (outKey) { *outKey = (SkKey)evt.getFast32(); } return true; } return false; }
bool SampleCode::CharQ(const SkEvent& evt, SkUnichar* outUni) { if (evt.isType(gCharEvtName, sizeof(gCharEvtName) - 1)) { if (outUni) { *outUni = evt.getFast32(); } return true; } return false; }
bool SkOSWindow::onEvent(const SkEvent& evt) { if (evt.isType("inval-imageview")) { update(NULL); doPaint(); return true; } return INHERITED::onEvent(evt); }
bool SkOSMenu::FindText(const SkEvent& evt, const char slotName[], SkString* value) { if (evt.isType(gMenuEventType)) { const char* text = evt.findString(slotName); if (!text || !*text) return false; else { value->set(text); return true; } } return false; }
bool SkOSWindow::onEvent(const SkEvent& evt) { if (evt.isType("inval-imageview")) { this->update(NULL); const SkBitmap& bm = this->getBitmap(); CGImageRef img = SkCreateCGImageRef(bm); HIImageViewSetImage((HIViewRef)getHVIEW(), img); CGImageRelease(img); return true; } return INHERITED::onEvent(evt); }
bool SkInfoPanelView::onEvent(const SkEvent& evt) { if (evt.isType(SkDebugger_StateType)) { fMatrix = evt.findString(SkDebugger_Matrix); fClip = evt.findString(SkDebugger_Clip); SkPaint* ptr; if (evt.getMetaData().findPtr(SkDebugger_Paint, (void**)&ptr)) { fPaint = *ptr; fPaintInfo = evt.findString(SkDebugger_PaintInfo); } this->inval(NULL); return true; } return this->INHERITED::onEvent(evt); }
bool SkOSWindow::onEvent(const SkEvent& evt) { if (evt.isType("inval-imageview")) { this->update(NULL); SkEvent query("ignore-window-bitmap"); if (!this->doQuery(&query) || !query.getFast32()) { const SkBitmap& bm = this->getBitmap(); CGImageRef img = SkCreateCGImageRef(bm); HIImageViewSetImage((HIViewRef)getHVIEW(), img); CGImageRelease(img); } return true; } return INHERITED::onEvent(evt); }
bool SkOSMenu::FindListItems(const SkEvent& evt, SkString items[]) { if (evt.isType(gMenuEventType) && items) { const char* text = evt.findString(gList_Items_Str); if (text != NULL) { SkString temp(text); char* token = strtok((char*)temp.c_str(), gDelimiter); int index = 0; while (token != NULL) { items[index].set(token, strlen(token)); token = strtok (NULL, gDelimiter); ++index; } } return true; } return false; }
bool SkAnimator::onEvent(const SkEvent& evt) { #ifdef SK_DEBUG SkAnimator* root = fMaker->getRoot(); if (root == nullptr) root = this; if (root->isTrackingEvents()) root->eventDone(evt); #endif if (evt.isType(SK_EventType_OnEnd)) { SkEventState eventState; SkDEBUGCODE(bool success =) evt.findPtr("anim", (void**) &eventState.fDisplayable); SkASSERT(success); SkDEBUGCODE(success =) evt.findS32("time", (int32_t*) &fMaker->fEnableTime); SkASSERT(success); fMaker->fAdjustedStart = fMaker->getAppTime() - fMaker->fEnableTime; fMaker->fEvents.doEvent(*fMaker, SkDisplayEvent::kOnEnd, &eventState); fMaker->fAdjustedStart = 0; goto inval; }
bool SkListView::onEvent(const SkEvent& evt) { if (evt.isType(SK_EventType_Key)) { switch (evt.getFast32()) { case kUp_SkKey: return this->moveSelectionUp(); case kDown_SkKey: return this->moveSelectionDown(); case kRight_SkKey: case kOK_SkKey: this->postWidgetEvent(); return true; default: break; } } return this->INHERITED::onEvent(evt); }
bool SkOSMenu::FindTriState(const SkEvent& evt, const char slotName[], SkOSMenu::TriState* value) { return evt.isType(gMenuEventType) && evt.findS32(slotName, (int*)value); }
bool SkOSMenu::FindListItemCount(const SkEvent& evt, int* count) { return evt.isType(gMenuEventType) && evt.findS32(gList_ItemCount_S32, count); }
bool SkOSMenu::FindSliderMin(const SkEvent& evt, SkScalar* min) { return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Min_Scalar, min); }
bool SkOSMenu::FindSliderMax(const SkEvent& evt, SkScalar* max) { return evt.isType(gMenuEventType) && evt.findScalar(gSlider_Max_Scalar, max); }
bool SkOSMenu::FindAction(const SkEvent& evt, const char label[]) { return evt.isType(gMenuEventType) && evt.findString(label); }
bool SkOSMenu::FindListIndex(const SkEvent& evt, const char slotName[], int* value) { return evt.isType(gMenuEventType) && evt.findS32(slotName, value); }
bool SkOSMenu::FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value) { return evt.isType(gMenuEventType) && evt.findScalar(slotName, value); }
bool SkOSMenu::FindSwitchState(const SkEvent& evt, const char slotName[], bool* value) { return evt.isType(gMenuEventType) && evt.findBool(slotName, value); }
bool SkAnimator::onEvent(const SkEvent& evt) { #ifdef SK_DEBUG SkAnimator* root = fMaker->getRoot(); if (root == NULL) root = this; if (root->isTrackingEvents()) root->eventDone(evt); #endif if (evt.isType(SK_EventType_OnEnd)) { SkEventState eventState; bool success = evt.findPtr("anim", (void**) &eventState.fDisplayable); SkASSERT(success); success = evt.findS32("time", (int32_t*) &fMaker->fEnableTime); SkASSERT(success); fMaker->fAdjustedStart = fMaker->getAppTime() - fMaker->fEnableTime; fMaker->fEvents.doEvent(*fMaker, SkDisplayEvent::kOnEnd, &eventState); fMaker->fAdjustedStart = 0; goto inval; } if (evt.isType(SK_EventType_Delay)) { fMaker->doDelayedEvent(); goto inval; } { const char* id = evt.findString("id"); if (id == NULL) return false; SkDisplayable** firstMovie = fMaker->fMovies.begin(); SkDisplayable** endMovie = fMaker->fMovies.end(); for (SkDisplayable** ptr = firstMovie; ptr < endMovie; ptr++) { SkDisplayMovie* movie = (SkDisplayMovie*) *ptr; movie->doEvent(evt); } { SkDisplayable* event; if (fMaker->find(id, &event) == false) return false; #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING SkString debugOut; SkMSec realTime = fMaker->getAppTime(); debugOut.appendS32(realTime - fMaker->fDebugTimeBase); debugOut.append(" onEvent id="); debugOut.append(id); #endif SkMSec time = evt.getFast32(); if (time != 0) { SkMSec app = fMaker->getAppTime(); fMaker->setEnableTime(app, time); #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING debugOut.append(" time="); debugOut.appendS32(time - fMaker->fDebugTimeBase); debugOut.append(" adjust="); debugOut.appendS32(fMaker->fAdjustedStart); #endif } #if defined SK_DEBUG && defined SK_DEBUG_ANIMATION_TIMING SkDebugf("%s\n", debugOut.c_str()); #endif SkASSERT(event->isEvent()); SkDisplayEvent* displayEvent = (SkDisplayEvent*) event; displayEvent->populateInput(*fMaker, evt); displayEvent->enableEvent(*fMaker); } } inval: fMaker->notifyInval(); return true; }