Fix XferDemo by sending push button events directly to parent

Bug: skia:
Change-Id: I3141dd34a9a04c7a660000cba9e483191f28ef03
Reviewed-on: https://skia-review.googlesource.com/75362
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-11-22 11:14:27 -05:00 committed by Skia Commit-Bot
parent e1e926a79c
commit 2bd856ded9

View File

@ -30,21 +30,9 @@ const SkBlendMode gModes[] = {
};
const int N_Modes = SK_ARRAY_COUNT(gModes);
class HasEventWig : public SkView {
public:
void postWidgetEvent() {
SkEvent evt;
this->onPrepareWidEvent(&evt);
this->postToListeners(evt, 0);
}
protected:
virtual void onPrepareWidEvent(SkEvent*) {}
};
static SkRandom gRand;
class PushButtonWig : public HasEventWig {
class PushButtonWig : public SkView {
SkString fLabel;
SkColor fColor;
uint32_t fFast32;
@ -55,14 +43,15 @@ public:
fFast32 = fast;
}
protected:
void onPrepareWidEvent(SkEvent* evt) override {
evt->setType("push-button");
evt->setFast32(fFast32);
evt->setString("label", fLabel.c_str());
void postWidgetEvent() {
SkEvent evt;
evt.setType("push-button");
evt.setFast32(fFast32);
evt.setString("label", fLabel.c_str());
this->sendEventToParents(evt);
}
// bool onEvent(const SkEvent&) override;
protected:
void onDraw(SkCanvas* canvas) override {
SkRect r;
this->getLocalBounds(&r);
@ -98,9 +87,6 @@ protected:
}
return true;
}
private:
typedef HasEventWig INHERITED;
};