OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "OverView.h" | 8 #include "OverView.h" |
9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 return case_insensitive_find(name, filter); | 42 return case_insensitive_find(name, filter); |
43 } | 43 } |
44 | 44 |
45 class OverView : public SkView { | 45 class OverView : public SkView { |
46 public: | 46 public: |
47 OverView(int count, const SkViewFactory* factories[]); | 47 OverView(int count, const SkViewFactory* factories[]); |
48 virtual ~OverView(); | 48 virtual ~OverView(); |
49 | 49 |
50 protected: | 50 protected: |
51 bool onEvent(const SkEvent&) SK_OVERRIDE; | 51 bool onEvent(const SkEvent&) override; |
52 bool onQuery(SkEvent* evt) SK_OVERRIDE { | 52 bool onQuery(SkEvent* evt) override { |
53 if (SampleCode::TitleQ(*evt)) { | 53 if (SampleCode::TitleQ(*evt)) { |
54 SampleCode::TitleR(evt, "Overview"); | 54 SampleCode::TitleR(evt, "Overview"); |
55 return true; | 55 return true; |
56 } | 56 } |
57 if (evt->isType(gIsOverview)) { | 57 if (evt->isType(gIsOverview)) { |
58 return true; | 58 return true; |
59 } | 59 } |
60 SkUnichar uni; | 60 SkUnichar uni; |
61 if (SampleCode::CharQ(*evt, &uni)) { | 61 if (SampleCode::CharQ(*evt, &uni)) { |
62 fMatchStr.appendUnichar(uni); | 62 fMatchStr.appendUnichar(uni); |
63 this->inval(NULL); | 63 this->inval(NULL); |
64 return true; | 64 return true; |
65 } | 65 } |
66 return this->INHERITED::onQuery(evt); | 66 return this->INHERITED::onQuery(evt); |
67 } | 67 } |
68 | 68 |
69 void onDraw(SkCanvas* canvas) SK_OVERRIDE; | 69 void onDraw(SkCanvas* canvas) override; |
70 | 70 |
71 bool onSendClickToChildren(SkScalar x, SkScalar y, unsigned modi) SK_OVERRID
E { | 71 bool onSendClickToChildren(SkScalar x, SkScalar y, unsigned modi) override { |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 Click* onFindClickHandler(SkScalar cx, SkScalar cy, unsigned modi) SK_OVERRI
DE { | 75 Click* onFindClickHandler(SkScalar cx, SkScalar cy, unsigned modi) override
{ |
76 const SkRect crect = SkRect::MakeXYWH(cx - 0.5f, cy - 0.5f, 1, 1); | 76 const SkRect crect = SkRect::MakeXYWH(cx - 0.5f, cy - 0.5f, 1, 1); |
77 SkPoint loc = this->start(); | 77 SkPoint loc = this->start(); |
78 for (int i = 0; i < fCount; ++i) { | 78 for (int i = 0; i < fCount; ++i) { |
79 if (draw_this_name(fNames[i], fMatchStr)) { | 79 if (draw_this_name(fNames[i], fMatchStr)) { |
80 if (this->bounds(loc).intersects(crect)) { | 80 if (this->bounds(loc).intersects(crect)) { |
81 SkEvent evt("set-curr-index"); | 81 SkEvent evt("set-curr-index"); |
82 evt.setFast32(i); | 82 evt.setFast32(i); |
83 this->sendEventToParents(evt); | 83 this->sendEventToParents(evt); |
84 break; | 84 break; |
85 } | 85 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 SkPoint loc = this->start(); | 164 SkPoint loc = this->start(); |
165 for (int i = 0; i < fCount; ++i) { | 165 for (int i = 0; i < fCount; ++i) { |
166 if (draw_this_name(fNames[i], fMatchStr)) { | 166 if (draw_this_name(fNames[i], fMatchStr)) { |
167 canvas->drawRect(this->bounds(loc), paint); | 167 canvas->drawRect(this->bounds(loc), paint); |
168 canvas->drawText(fNames[i].c_str(), fNames[i].size(), loc.x(), loc.y
(), fNamePaint); | 168 canvas->drawText(fNames[i].c_str(), fNames[i].size(), loc.x(), loc.y
(), fNamePaint); |
169 this->next(&loc); | 169 this->next(&loc); |
170 } | 170 } |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
OLD | NEW |