1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SkProgressBarView_DEFINED 18 #define SkProgressBarView_DEFINED 19 20 #include "SkView.h" 21 #include "SkWidgetViews.h" 22 #include "SkAnimator.h" 23 24 class SkProgressBarView : public SkWidgetView { 25 public: 26 SkProgressBarView(); 27 //SkProgressBarView(int max); 28 29 //inflate: "sk-progress" 30 31 void reset(); //reset progress to zero 32 void setProgress(int progress); 33 void changeProgress(int diff); 34 void setMax(int max); 35 getProgress()36 int getProgress() const { return fProgress; } getMax()37 int getMax() const { return fMax; } 38 39 protected: 40 //overrides 41 virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node); 42 virtual void onSizeChange(); 43 virtual void onDraw(SkCanvas* canvas); 44 virtual bool onEvent(const SkEvent& evt); 45 46 private: 47 SkAnimator fAnim; 48 int fProgress; 49 int fMax; 50 51 typedef SkWidgetView INHERITED; 52 }; 53 54 55 56 57 #endif 58