1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17/** 18 * @author Pavel Dolgov 19 * @version $Revision$ 20 */ 21package org.apache.harmony.awt; 22 23//???AWT 24//import java.awt.Component; 25//import java.awt.Container; 26//import java.awt.Dialog; 27import java.awt.Dimension; 28//import java.awt.Image; 29import java.awt.Insets; 30import java.awt.Point; 31import java.awt.Rectangle; 32//import java.awt.Window; 33//import java.awt.Choice; 34import java.lang.reflect.InvocationTargetException; 35 36import org.apache.harmony.awt.gl.MultiRectArea; 37//import org.apache.harmony.awt.text.TextFieldKit; 38//import org.apache.harmony.awt.text.TextKit; 39//import org.apache.harmony.awt.wtk.NativeWindow; 40 41import org.apache.harmony.luni.util.NotImplementedException; 42 43/** 44 * The accessor to AWT private API 45 */ 46public abstract class ComponentInternals { 47 48 /** 49 * @return the ComponentInternals instance to serve the requests 50 */ 51 public static ComponentInternals getComponentInternals() { 52 return ContextStorage.getComponentInternals(); 53 } 54 55 /** 56 * This method must be called by AWT to establish the connection 57 * @param internals - implementation of ComponentInternals created by AWT 58 */ 59 public static void setComponentInternals(ComponentInternals internals) { 60 ContextStorage.setComponentInternals(internals); 61 } 62 63 /** 64 * The accessor to native resource connected to a component. 65 * It returns non-<code>null</code> value only if component 66 * already has the native resource 67 */ 68 //public abstract NativeWindow getNativeWindow(Component component); 69 70 /** 71 * Connect Window object to existing native resource 72 * @param nativeWindowId - id of native window to attach 73 * @return Window object with special behaviour that 74 * restricts manupulation with that window 75 */ 76 //public abstract Window attachNativeWindow(long nativeWindowId); 77 78 /** 79 * Start mouse grab in "client" mode. 80 * All mouse events in AWT components will be reported as usual, 81 * mouse events that occured outside of AWT components will be sent to 82 * the window passed as grabWindow parameter. When mouse grab is canceled 83 * (because of click in non-AWT window or by task switching) 84 * the whenCanceled callback is called 85 * 86 * @param grabWindow - window that will own the grab 87 * @param whenCanceled - callback called when grab is canceled by user's action 88 */ 89 //public abstract void startMouseGrab(Window grabWindow, Runnable whenCanceled); 90 91 /** 92 * End mouse grab and resume normal processing of mouse events 93 */ 94 //public abstract void endMouseGrab(); 95 96 /** 97 * Set the <code>popup</code> flag of the window to true. 98 * This window won't be controlled by window manager on Linux. 99 * Call this method before the window is shown first time 100 * @param window - the window that should become popup one 101 */ 102 //public abstract void makePopup(Window window); 103 104 /** 105 * This method must be called by Graphics at the beginning of drawImage() 106 * to store image drawing parameters (defined by application developer) in component 107 * 108 * @param comp - component that draws the image 109 * @param image - image to be drawn 110 * @param destLocation - location of the image upon the component's surface. Never null. 111 * @param destSize - size of the component's area to be filled with the image. 112 * Equals to null if size parameters omitted in drawImage. 113 * @param source - area of the image to be drawn on the component. 114 * Equals to null if src parameters omitted in drawImage. 115 */ 116 /* 117 public abstract void onDrawImage(Component comp, Image image, Point destLocation, 118 Dimension destSize, Rectangle source); 119*/ 120 /** 121 * Sets system's caret position. 122 * This method should be called by text component to synchronize our caret position 123 * with system's caret position. 124 * @param x 125 * @param y 126 */ 127 //public abstract void setCaretPos(Component c, int x, int y); 128 129 /** 130 * NEVER USE IT. FORGET IT. IT DOES NOT EXIST. 131 * See Toolkit.unsafeInvokeAndWait(Runnable). 132 * 133 * Accessor for Toolkit.unsafeInvokeAndWait(Runnable) method. 134 * For use in exceptional cases only. 135 * Read comments for Toolkit.unsafeInvokeAndWait(Runnable) before use. 136 */ 137 /* 138 public abstract void unsafeInvokeAndWait(Runnable runnable) 139 throws InterruptedException, InvocationTargetException; 140 141 public abstract TextKit getTextKit(Component comp); 142 143 public abstract void setTextKit(Component comp, TextKit kit); 144 145 public abstract TextFieldKit getTextFieldKit(Component comp); 146 147 public abstract void setTextFieldKit(Component comp, TextFieldKit kit); 148*/ 149 /** 150 * Terminate event dispatch thread, completely destroy AWT context.<br> 151 * Intended for multi-context mode, in single-context mode does nothing. 152 * 153 */ 154 public abstract void shutdown(); 155 156 /** 157 * Sets mouse events preprocessor for event queue 158 */ 159 //public abstract void setMouseEventPreprocessor(MouseEventPreprocessor preprocessor); 160 161 /** 162 * Create customized Choice using style 163 */ 164 //public abstract Choice createCustomChoice(ChoiceStyle style); 165 166 //public abstract Insets getNativeInsets(Window w); 167 168 /** 169 * Region to be repainted (could be null). Use this in overridden repaint() 170 */ 171 //public abstract MultiRectArea getRepaintRegion(Component c); 172 173 //public abstract MultiRectArea subtractPendingRepaintRegion(Component c, MultiRectArea mra); 174 175 /** 176 * Returns true if the window was at least once painted due to native paint events 177 */ 178 //public abstract boolean wasPainted(Window w); 179 180 /** 181 * The component's region hidden behind top-level windows 182 * (belonging to both this Java app and all other apps), and behind 183 * heavyweight components overlapping with passed component 184 */ 185 //public abstract MultiRectArea getObscuredRegion(Component c); 186 187 /** 188 * An accessor to Container.addObscuredRegions() method 189 * @see java.awt.Container#addObscuredRegions(MultiRectArea, Component) 190 */ 191 //public abstract void addObscuredRegions(MultiRectArea mra, Component c, Container container); 192 193 /** 194 * Makes it possible to call protected Toolkit.setDesktopProperty() 195 * method from any class outside of java.awt package 196 */ 197 public abstract void setDesktopProperty(String name, Object value); 198 199 /** 200 * Makes it possible to start/stop dialog modal loop 201 * from anywhere outside of java.awt package 202 */ 203 //public abstract void runModalLoop(Dialog dlg); 204 //public abstract void endModalLoop(Dialog dlg); 205 206 /** 207 * Sets component's visible flag only 208 * (the component is not actually shown/hidden) 209 */ 210 //public abstract void setVisibleFlag(Component comp, boolean visible); 211 212} 213