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 SkScrollBarView_DEFINED 18 #define SkScrollBarView_DEFINED 19 20 #include "SkView.h" 21 #include "SkWidgetViews.h" 22 #include "SkAnimator.h" 23 24 class SkScrollBarView : public SkWidgetView { 25 public: 26 SkScrollBarView(); 27 28 unsigned getStart() const { return fStartPoint; } 29 unsigned getShown() const { return fShownLength; } 30 unsigned getTotal() const { return fTotalLength; } 31 32 void setStart(unsigned start); 33 void setShown(unsigned shown); 34 void setTotal(unsigned total); 35 36 protected: 37 //overrides 38 virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node); 39 virtual void onSizeChange(); 40 virtual void onDraw(SkCanvas* canvas); 41 virtual bool onEvent(const SkEvent& evt); 42 43 private: 44 SkAnimator fAnim; 45 unsigned fTotalLength, fStartPoint, fShownLength; 46 47 void adjust(); 48 49 typedef SkWidgetView INHERITED; 50 }; 51 #endif 52 53