PieItem.java revision 1acef69ffc079d1bc029ff7eb1f5043f7efd7f36
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17package com.android.browser.view;
18
19import com.android.browser.view.PieMenu.PieView;
20
21import android.view.View;
22
23/**
24 * Pie menu item
25 */
26public class PieItem {
27
28    private View mView;
29    private PieView mPieView;
30    private int level;
31    private float start;
32    private float sweep;
33    private int inner;
34    private int outer;
35    private boolean mSelected;
36
37    public PieItem(View view, int level) {
38        mView = view;
39        this.level = level;
40    }
41
42    public PieItem(View view, int level, PieView sym) {
43        mView = view;
44        this.level = level;
45        mPieView = sym;
46    }
47
48    public void setSelected(boolean s) {
49        mSelected = s;
50        if (mView != null) {
51            mView.setSelected(s);
52        }
53    }
54
55    public boolean isSelected() {
56        return mSelected;
57    }
58
59    public int getLevel() {
60        return level;
61    }
62
63    public void setGeometry(float st, float sw, int inside, int outside) {
64        start = st;
65        sweep = sw;
66        inner = inside;
67        outer = outside;
68    }
69
70    public float getStartAngle() {
71        return start;
72    }
73
74    public float getSweep() {
75        return sweep;
76    }
77
78    public int getInnerRadius() {
79        return inner;
80    }
81
82    public int getOuterRadius() {
83        return outer;
84    }
85
86    public boolean isPieView() {
87        return (mPieView != null);
88    }
89
90    public View getView() {
91        return mView;
92    }
93
94    public void setPieView(PieView sym) {
95        mPieView = sym;
96    }
97
98    public PieView getPieView() {
99        return mPieView;
100    }
101
102}
103