aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/views/SkScrollBarView.h
blob: 110d0e12f0826a6f3ad7e1f7403efff3121b5aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SkScrollBarView_DEFINED
#define SkScrollBarView_DEFINED

#include "SkView.h"
#include "SkWidgetViews.h"
#include "SkAnimator.h"

class SkScrollBarView : public SkWidgetView {
public:
    SkScrollBarView();

    unsigned getStart() const { return fStartPoint; }
    unsigned getShown() const { return fShownLength; }
    unsigned getTotal() const { return fTotalLength; }

    void setStart(unsigned start);  
    void setShown(unsigned shown);
    void setTotal(unsigned total);
    
protected:
    //overrides
    virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
    virtual void onSizeChange();
    virtual void onDraw(SkCanvas* canvas);
    virtual bool onEvent(const SkEvent& evt);

private:
    SkAnimator  fAnim;
    unsigned    fTotalLength, fStartPoint, fShownLength;
    
    void adjust();
    
    typedef SkWidgetView INHERITED;
};
#endif