J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package java.awt.peer; |
| 27 | |
| 28 | import java.awt.*; |
| 29 | import java.awt.event.PaintEvent; |
| 30 | import java.awt.image.ImageProducer; |
| 31 | import java.awt.image.ImageObserver; |
| 32 | import java.awt.image.ColorModel; |
| 33 | import java.awt.image.VolatileImage; |
| 34 | import java.awt.GraphicsConfiguration; |
| 35 | import sun.awt.CausedFocusEvent; |
| 36 | import sun.java2d.pipe.Region; |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * The peer interfaces are intended only for use in porting |
| 41 | * the AWT. They are not intended for use by application |
| 42 | * developers, and developers should not implement peers |
| 43 | * nor invoke any of the peer methods directly on the peer |
| 44 | * instances. |
| 45 | */ |
| 46 | public interface ComponentPeer { |
| 47 | public static final int SET_LOCATION = 1, |
| 48 | SET_SIZE = 2, |
| 49 | SET_BOUNDS = 3, |
| 50 | SET_CLIENT_SIZE = 4, |
| 51 | RESET_OPERATION = 5, |
| 52 | NO_EMBEDDED_CHECK = (1 << 14), |
| 53 | DEFAULT_OPERATION = SET_BOUNDS; |
| 54 | boolean isObscured(); |
| 55 | boolean canDetermineObscurity(); |
| 56 | void setVisible(boolean b); |
| 57 | void setEnabled(boolean b); |
| 58 | void paint(Graphics g); |
| 59 | void repaint(long tm, int x, int y, int width, int height); |
| 60 | void print(Graphics g); |
| 61 | void setBounds(int x, int y, int width, int height, int op); |
| 62 | void handleEvent(AWTEvent e); |
| 63 | void coalescePaintEvent(PaintEvent e); |
| 64 | Point getLocationOnScreen(); |
| 65 | Dimension getPreferredSize(); |
| 66 | Dimension getMinimumSize(); |
| 67 | ColorModel getColorModel(); |
| 68 | Toolkit getToolkit(); |
| 69 | Graphics getGraphics(); |
| 70 | FontMetrics getFontMetrics(Font font); |
| 71 | void dispose(); |
| 72 | void setForeground(Color c); |
| 73 | void setBackground(Color c); |
| 74 | void setFont(Font f); |
| 75 | void updateCursorImmediately(); |
| 76 | boolean requestFocus(Component lightweightChild, |
| 77 | boolean temporary, |
| 78 | boolean focusedWindowChangeAllowed, |
| 79 | long time, CausedFocusEvent.Cause cause); |
| 80 | boolean isFocusable(); |
| 81 | |
| 82 | Image createImage(ImageProducer producer); |
| 83 | Image createImage(int width, int height); |
| 84 | VolatileImage createVolatileImage(int width, int height); |
| 85 | boolean prepareImage(Image img, int w, int h, ImageObserver o); |
| 86 | int checkImage(Image img, int w, int h, ImageObserver o); |
| 87 | GraphicsConfiguration getGraphicsConfiguration(); |
| 88 | boolean handlesWheelScrolling(); |
| 89 | void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException; |
| 90 | Image getBackBuffer(); |
| 91 | void flip(BufferCapabilities.FlipContents flipAction); |
| 92 | void destroyBuffers(); |
| 93 | |
| 94 | /** |
| 95 | * Reparents this peer to the new parent referenced by <code>newContainer</code> peer |
| 96 | * Implementation depends on toolkit and container. |
| 97 | * @param newContainer peer of the new parent container |
| 98 | * @since 1.5 |
| 99 | */ |
| 100 | void reparent(ContainerPeer newContainer); |
| 101 | /** |
| 102 | * Returns whether this peer supports reparenting to another parent withour destroying the peer |
| 103 | * @return true if appropriate reparent is supported, false otherwise |
| 104 | * @since 1.5 |
| 105 | */ |
| 106 | boolean isReparentSupported(); |
| 107 | |
| 108 | /** |
| 109 | * Used by lightweight implementations to tell a ComponentPeer to layout |
| 110 | * its sub-elements. For instance, a lightweight Checkbox needs to layout |
| 111 | * the box, as well as the text label. |
| 112 | */ |
| 113 | void layout(); |
| 114 | |
| 115 | |
| 116 | Rectangle getBounds(); |
| 117 | |
| 118 | /** |
| 119 | * Applies the shape to the native component window. |
| 120 | * @since 1.7 |
| 121 | */ |
| 122 | void applyShape(Region shape); |
| 123 | |
| 124 | /** |
| 125 | * DEPRECATED: Replaced by getPreferredSize(). |
| 126 | */ |
| 127 | Dimension preferredSize(); |
| 128 | |
| 129 | /** |
| 130 | * DEPRECATED: Replaced by getMinimumSize(). |
| 131 | */ |
| 132 | Dimension minimumSize(); |
| 133 | |
| 134 | /** |
| 135 | * DEPRECATED: Replaced by setVisible(boolean). |
| 136 | */ |
| 137 | void show(); |
| 138 | |
| 139 | /** |
| 140 | * DEPRECATED: Replaced by setVisible(boolean). |
| 141 | */ |
| 142 | void hide(); |
| 143 | |
| 144 | /** |
| 145 | * DEPRECATED: Replaced by setEnabled(boolean). |
| 146 | */ |
| 147 | void enable(); |
| 148 | |
| 149 | /** |
| 150 | * DEPRECATED: Replaced by setEnabled(boolean). |
| 151 | */ |
| 152 | void disable(); |
| 153 | |
| 154 | /** |
| 155 | * DEPRECATED: Replaced by setBounds(int, int, int, int). |
| 156 | */ |
| 157 | void reshape(int x, int y, int width, int height); |
| 158 | } |