001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Dmitry A. Durnev
019: * @version $Revision$
020: */package org.apache.harmony.awt;
021:
022: import java.awt.Adjustable;
023: import java.awt.Component;
024: import java.awt.Dimension;
025: import java.awt.Insets;
026: import java.awt.Point;
027: import java.awt.Rectangle;
028:
029: /**
030: * An internal AWT interface similar to
031: * javax.swing.Scrollable. Should be implemented
032: * by a Container with a single child component
033: * and scrolling behavior, such as
034: * ScrollPane.
035: */
036: public interface Scrollable {
037:
038: /**
039: * Constants for possible scrollbar
040: * display policies, define which scrollbars
041: * should be displayed and when they should
042: * be displayed
043: */
044: public static final int AS_NEEDED = 0;
045:
046: public static final int ALWAYS = 1;
047:
048: public static final int NEVER = 2;
049:
050: public static final int HORIZONTAL_ONLY = 3;
051:
052: public static final int VERTICAL_ONLY = 4;
053:
054: /**
055: * @return Adjustable interface
056: * of vertical scrollbar
057: */
058: Adjustable getVAdjustable();
059:
060: /**
061: * @return Adjustable interface
062: * of horizontal scrollbar
063: */
064: Adjustable getHAdjustable();
065:
066: /**
067: * Gets container insets NOT including
068: * scrollbars(adjustables) area
069: */
070: Insets getInsets();
071:
072: /**
073: * Gets scroll location
074: * @return current scroll location, i. e.
075: * (0, 0) point of container viewport
076: * in child component coordinates
077: */
078: Point getLocation();
079:
080: /**
081: * Scrolls component to the specified location
082: * within child component
083: * @param p new scroll location in
084: * Container coordinates
085: */
086: void setLocation(Point p);
087:
088: /**
089: * Gets the current child component to scroll.
090: * @return component location of which should be changed
091: * while scrolling
092: */
093: Component getComponent();
094:
095: /**
096: * Gets the current scroll size
097: * @return size of the child component being scrolled inside
098: * container, which typically exceeds size of the
099: * container itself
100: */
101: Dimension getSize();
102:
103: /**
104: * Repaints all the viewport(client area) of the Container
105: */
106: void doRepaint();
107:
108: /**
109: * Repaints the specified rectangle of the container
110: */
111: void doRepaint(Rectangle r);
112:
113: /**
114: * Gets vertical scrollbar width
115: * @return width of the vertical adjustable
116: */
117: int getAdjustableWidth();
118:
119: /**
120: * Gets horizontal scrollbar height
121: * @return height of the horizontal adjustable
122: */
123: int getAdjustableHeight();
124:
125: /**
126: * Internal AWT method for changing adjustable minimum,
127: * maximum and visible amount
128: * @param adj Adjustable to be changed
129: * @param vis new visible amount
130: * @param min new minimum value
131: * @param max new maximum value
132: */
133: void setAdjustableSizes(Adjustable adj, int vis, int min, int max);
134:
135: /**
136: * Gets scrollbar display policy for adjustable
137: * @param adj scrollbar
138: * @return one of 5 constants
139: * identifying when the specified scrollbar is displayed
140: */
141: int getAdjustableMode(Adjustable adj);
142:
143: /**
144: * Sets scrollbar bounds relative to container origin
145: * @param adj scrollbar being changed
146: * @param r new bounds
147: */
148: void setAdjustableBounds(Adjustable adj, Rectangle r);
149:
150: /**
151: * @return width of the container
152: */
153: int getWidth();
154:
155: /**
156: * @return height of the container
157: */
158: int getHeight();
159: }
|