bool SkWindow::handleKey(SkKey key) { if (key == kNONE_SkKey) return false; if (this->onHandleKey(key)) return true; // send an event to the focus-view { SkView* focus = this->getFocusView(); if (focus == NULL) focus = this; SkEvent evt(SK_EventType_Key); evt.setFast32(key); if (focus->doEvent(evt)) return true; } if (key == kUp_SkKey || key == kDown_SkKey) { if (this->moveFocus(key == kUp_SkKey ? kPrev_FocusDirection : kNext_FocusDirection) == NULL) this->onSetFocusView(NULL); return true; } return false; }
SkView* SkView::sendEventToParents(const SkEvent& evt) { SkView* parent = fParent; while (parent) { if (parent->doEvent(evt)) { return parent; } parent = parent->fParent; } return nullptr; }
bool SkWindow::handleChar(SkUnichar uni) { if (this->onHandleChar(uni)) return true; SkView* focus = this->getFocusView(); if (focus == NULL) focus = this; SkEvent evt(SK_EventType_Unichar); evt.setFast32(uni); return focus->doEvent(evt); }
SkView* SkView::sendEventToParents(const SkEvent& evt) { SkView* parent = fParent; while (parent) { if (parent->doEvent(evt)) return parent; parent = parent->fParent; } return NULL; }
bool SkWindow::handleKeyUp(SkKey key) { if (key == kNONE_SkKey) return false; if (this->onHandleKeyUp(key)) return true; //send an event to the focus-view { SkView* focus = this->getFocusView(); if (focus == NULL) focus = this; //should this one be the same? SkEvent evt(SK_EventType_KeyUp); evt.setFast32(key); if (focus->doEvent(evt)) return true; } return false; }