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 #ifndef SampleCode_DEFINED | 8 #ifndef SampleCode_DEFINED |
9 #define SampleCode_DEFINED | 9 #define SampleCode_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkEvent.h" | 12 #include "SkEvent.h" |
13 #include "SkKey.h" | 13 #include "SkKey.h" |
14 #include "SkView.h" | 14 #include "SkView.h" |
15 #include "SkOSMenu.h" | 15 #include "SkOSMenu.h" |
16 | 16 |
17 class GrContext; | 17 class GrContext; |
18 class SkAnimTimer; | 18 class SkAnimTimer; |
19 | 19 |
20 #define DEF_SAMPLE(code) \ | 20 #define DEF_SAMPLE(code) \ |
21 static SkView* SK_MACRO_APPEND_LINE(F_)() { code } \ | 21 static SkView* SK_MACRO_APPEND_LINE(F_)() { code } \ |
22 static SkViewRegister SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_)); | 22 static SkViewRegister SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_)); |
23 | 23 |
| 24 #define MAX_ZOOM_LEVEL 8 |
| 25 #define MIN_ZOOM_LEVEL -8 |
| 26 |
| 27 static const char gCharEvtName[] = "SampleCode_Char_Event"; |
| 28 static const char gKeyEvtName[] = "SampleCode_Key_Event"; |
| 29 static const char gTitleEvtName[] = "SampleCode_Title_Event"; |
| 30 static const char gPrefSizeEvtName[] = "SampleCode_PrefSize_Event"; |
| 31 static const char gFastTextEvtName[] = "SampleCode_FastText_Event"; |
| 32 static const char gUpdateWindowTitleEvtName[] = "SampleCode_UpdateWindowTitle"; |
24 | 33 |
25 class SampleCode { | 34 class SampleCode { |
26 public: | 35 public: |
27 static bool KeyQ(const SkEvent&, SkKey* outKey); | 36 static bool KeyQ(const SkEvent&, SkKey* outKey); |
28 static bool CharQ(const SkEvent&, SkUnichar* outUni); | 37 static bool CharQ(const SkEvent&, SkUnichar* outUni); |
29 | 38 |
30 static bool TitleQ(const SkEvent&); | 39 static bool TitleQ(const SkEvent&); |
31 static void TitleR(SkEvent*, const char title[]); | 40 static void TitleR(SkEvent*, const char title[]); |
32 static bool RequestTitle(SkView* view, SkString* title); | 41 static bool RequestTitle(SkView* view, SkString* title); |
33 | 42 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 SkOSMenu::TriState fPipeState; | 151 SkOSMenu::TriState fPipeState; |
143 SkColor fBGColor; | 152 SkColor fBGColor; |
144 | 153 |
145 private: | 154 private: |
146 int fRepeatCount; | 155 int fRepeatCount; |
147 bool fHaveCalledOnceBeforeDraw; | 156 bool fHaveCalledOnceBeforeDraw; |
148 typedef SkView INHERITED; | 157 typedef SkView INHERITED; |
149 }; | 158 }; |
150 | 159 |
151 #endif | 160 #endif |
OLD | NEW |