GNU Classpath (0.20) | |
Frames | No Frames |
1: /* ComponentPeer.java -- Toplevel component peer 2: Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package java.awt.peer; 40: 41: import java.awt.AWTEvent; 42: import java.awt.AWTException; 43: import java.awt.BufferCapabilities; 44: import java.awt.Color; 45: import java.awt.Component; 46: import java.awt.Cursor; 47: import java.awt.Dimension; 48: import java.awt.Font; 49: import java.awt.FontMetrics; 50: import java.awt.Graphics; 51: import java.awt.GraphicsConfiguration; 52: import java.awt.Image; 53: import java.awt.Point; 54: import java.awt.Rectangle; 55: import java.awt.Toolkit; 56: import java.awt.event.PaintEvent; 57: import java.awt.image.ColorModel; 58: import java.awt.image.ImageObserver; 59: import java.awt.image.ImageProducer; 60: import java.awt.image.VolatileImage; 61: 62: public interface ComponentPeer 63: { 64: int checkImage(Image img, int width, int height, 65: ImageObserver ob); 66: Image createImage(ImageProducer prod); 67: Image createImage(int width, int height); 68: void disable(); 69: void dispose(); 70: void enable(); 71: ColorModel getColorModel(); 72: FontMetrics getFontMetrics(Font f); 73: Graphics getGraphics(); 74: Point getLocationOnScreen(); 75: Dimension getMinimumSize(); 76: Dimension getPreferredSize(); 77: Toolkit getToolkit(); 78: void handleEvent(AWTEvent e); 79: void hide(); 80: 81: /** 82: * Part of the earlier 1.1 API, replaced by isFocusable(). 83: */ 84: boolean isFocusTraversable(); 85: boolean isFocusable(); 86: Dimension minimumSize(); 87: Dimension preferredSize(); 88: void paint(Graphics graphics); 89: boolean prepareImage(Image img, int width, int height, 90: ImageObserver ob); 91: void print(Graphics graphics); 92: void repaint(long tm, int x, int y, int width, int height); 93: 94: /** 95: * Part of the earlier 1.1 API, apparently replaced by argument 96: * form of the same method. 97: */ 98: void requestFocus(); 99: boolean requestFocus (Component source, boolean bool1, boolean bool2, long x); 100: 101: void reshape(int x, int y, int width, int height); 102: void setBackground(Color color); 103: void setBounds(int x, int y, int width, int height); 104: 105: /** 106: * Part of the earlier 1.1 API, apparently no longer needed. 107: */ 108: void setCursor(Cursor cursor); 109: 110: void setEnabled(boolean enabled); 111: void setFont(Font font); 112: void setForeground(Color color); 113: void setVisible(boolean visible); 114: void show(); 115: 116: /** 117: * Get the graphics configuration of the component. The color model 118: * of the component can be derived from the configuration. 119: */ 120: GraphicsConfiguration getGraphicsConfiguration(); 121: 122: /** 123: * Part of an older API, no longer needed. 124: */ 125: void setEventMask (long mask); 126: 127: // Methods below are introduced since 1.1 128: boolean isObscured(); 129: boolean canDetermineObscurity(); 130: void coalescePaintEvent(PaintEvent e); 131: void updateCursorImmediately(); 132: boolean handlesWheelScrolling(); 133: 134: /** 135: * A convenience method that creates a volatile image. The volatile 136: * image is created on the screen device on which this component is 137: * displayed, in the device's current graphics configuration. 138: * 139: * @param width width of the image 140: * @param height height of the image 141: * 142: * @see VolatileImage 143: * 144: * @since 1.2 145: */ 146: VolatileImage createVolatileImage(int width, int height); 147: 148: /** 149: * Create a number of image buffers that implement a buffering 150: * strategy according to the given capabilities. 151: * 152: * @param numBuffers the number of buffers 153: * @param caps the buffering capabilities 154: * 155: * @throws AWTException if the specified buffering strategy is not 156: * implemented 157: * 158: * @since 1.2 159: */ 160: void createBuffers(int numBuffers, BufferCapabilities caps) 161: throws AWTException; 162: 163: /** 164: * Return the back buffer of this component. 165: * 166: * @return the back buffer of this component. 167: * 168: * @since 1.2 169: */ 170: Image getBackBuffer(); 171: 172: /** 173: * Perform a page flip, leaving the contents of the back buffer in 174: * the specified state. 175: * 176: * @param contents the state in which to leave the back buffer 177: * 178: * @since 1.2 179: */ 180: void flip(BufferCapabilities.FlipContents contents); 181: 182: /** 183: * Destroy the resources created by createBuffers. 184: * 185: * @since 1.2 186: */ 187: void destroyBuffers(); 188: 189: /** 190: * Get the bounds of this component peer. 191: * 192: * @return component peer bounds 193: * @since 1.5 194: */ 195: Rectangle getBounds(); 196: 197: /** 198: * Reparent this component under another container. 199: * 200: * @param parent 201: * @since 1.5 202: */ 203: void reparent(ContainerPeer parent); 204: 205: /** 206: * Set the bounds of this component peer. 207: * 208: * @param x the new x co-ordinate 209: * @param y the new y co-ordinate 210: * @param width the new width 211: * @param height the new height 212: * @param z the new stacking level 213: * @since 1.5 214: */ 215: void setBounds (int x, int y, int width, int height, int z); 216: 217: /** 218: * Check if this component supports being reparented. 219: * 220: * @return true if this component can be reparented, 221: * false otherwise. 222: * @since 1.5 223: */ 224: boolean isReparentSupported(); 225: 226: /** 227: * Layout this component peer. 228: * 229: * @since 1.5 230: */ 231: void layout(); 232: }
GNU Classpath (0.20) |