1 /* 2 * Copyright 2012 AndroidPlot.com 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 package com.androidplot.ui; 18 19 import android.graphics.RectF; 20 21 /** 22 * Encapsulates the functionality of a BoxModel. 23 * See http://www.w3.org/TR/CSS21/box.html for a good explanation of how 24 * the box model works. 25 */ 26 public interface BoxModelable { 27 /** 28 * Returns a RectF instance describing the inner edge of the margin layer. 29 * @param boundsRect 30 * @return 31 */ 32 public RectF getMarginatedRect(RectF boundsRect); 33 34 /** 35 * Returns a RectF instance describing the inner edge of the padding layer. 36 * @param marginRect 37 * @return 38 */ 39 public RectF getPaddedRect(RectF marginRect); 40 41 42 public void setMargins(float left, float top, float right, float bottom); 43 44 public void setPadding(float left, float top, float right, float bottom); 45 46 public float getMarginLeft(); 47 48 public void setMarginLeft(float marginLeft); 49 50 public float getMarginTop(); 51 52 public void setMarginTop(float marginTop); 53 54 public float getMarginRight(); 55 56 public void setMarginRight(float marginRight); 57 58 public float getMarginBottom(); 59 60 public float getPaddingLeft(); 61 62 public void setPaddingLeft(float paddingLeft); 63 64 public float getPaddingTop(); 65 66 public void setPaddingTop(float paddingTop); 67 68 public float getPaddingRight(); 69 70 public void setPaddingRight(float paddingRight); 71 72 public float getPaddingBottom(); 73 74 public void setPaddingBottom(float paddingBottom); 75 } 76