Home | History | Annotate | Download | only in view
      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 
     17 package com.android.browser.view;
     18 
     19 import com.android.browser.view.PieMenu.PieView;
     20 
     21 import android.graphics.Path;
     22 import android.view.View;
     23 
     24 /**
     25  * Pie menu item
     26  */
     27 public class PieItem {
     28 
     29     private View mView;
     30     private PieView mPieView;
     31     private int level;
     32     private float start;
     33     private float sweep;
     34     private int inner;
     35     private int outer;
     36     private boolean mSelected;
     37     private Path mPath;
     38 
     39     public PieItem(View view, int level) {
     40         mView = view;
     41         this.level = level;
     42     }
     43 
     44     public PieItem(View view, int level, PieView sym) {
     45         mView = view;
     46         this.level = level;
     47         mPieView = sym;
     48     }
     49 
     50     public void setSelected(boolean s) {
     51         mSelected = s;
     52         if (mView != null) {
     53             mView.setSelected(s);
     54         }
     55     }
     56 
     57     public boolean isSelected() {
     58         return mSelected;
     59     }
     60 
     61     public int getLevel() {
     62         return level;
     63     }
     64 
     65     public void setGeometry(float st, float sw, int inside, int outside, Path p) {
     66         start = st;
     67         sweep = sw;
     68         inner = inside;
     69         outer = outside;
     70         mPath = p;
     71     }
     72 
     73     public float getStartAngle() {
     74         return start;
     75     }
     76 
     77     public float getSweep() {
     78         return sweep;
     79     }
     80 
     81     public int getInnerRadius() {
     82         return inner;
     83     }
     84 
     85     public int getOuterRadius() {
     86         return outer;
     87     }
     88 
     89     public boolean isPieView() {
     90         return (mPieView != null);
     91     }
     92 
     93     public View getView() {
     94         return mView;
     95     }
     96 
     97     public void setPieView(PieView sym) {
     98         mPieView = sym;
     99     }
    100 
    101     public PieView getPieView() {
    102         return mPieView;
    103     }
    104 
    105     public Path getPath() {
    106         return mPath;
    107     }
    108 
    109 }
    110