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 Mikhail Danilov 19 * @version $Revision$ 20 */ 21 package org.apache.harmony.awt.wtk; 22 23 import java.awt.Dimension; 24 import java.awt.Point; 25 26 /** 27 * Provides factory for NativeWindow 28 */ 29 public interface WindowFactory { 30 /** 31 * Creates and returns NativeWindow with desired 32 * creation params 33 * 34 * @param p - initial window properties 35 * @return created window 36 */ 37 NativeWindow createWindow(CreationParams p); 38 /** 39 * Create NativeWindow instance connected to existing native resource 40 * @param nativeWindowId - id of existing window 41 * @return created NativeWindow instance 42 */ 43 NativeWindow attachWindow(long nativeWindowId); 44 /** 45 * Returns NativeWindow instance if created by this instance of 46 * WindowFactory, otherwise null 47 * 48 * @param id - HWND on Windows xwindow on X 49 * @return NativeWindow or null if unknown 50 */ 51 NativeWindow getWindowById(long id); 52 /** 53 * Returns NativeWindow instance of the top-level window 54 * that contains a specified point and was 55 * created by this instance of WindowFactory 56 * @param p - Point to check 57 * @return NativeWindow or null if the point is 58 * not within a window created by this WindowFactory 59 */ 60 NativeWindow getWindowFromPoint(Point p); 61 62 /** 63 * Returns whether native system supports the state for windows. 64 * This method tells whether the UI concept of, say, maximization or iconification is supported. 65 * It will always return false for "compound" states like Frame.ICONIFIED|Frame.MAXIMIZED_VERT. 66 * In other words, the rule of thumb is that only queries with a single frame state 67 * constant as an argument are meaningful. 68 * 69 * @param state - one of named frame state constants. 70 * @return true is this frame state is supported by this Toolkit implementation, false otherwise. 71 */ 72 boolean isWindowStateSupported(int state); 73 74 /** 75 * @see org.apache.harmony.awt.ComponentInternals 76 */ 77 void setCaretPosition(int x, int y); 78 79 /** 80 * Request size of arbitrary native window 81 * @param id - window ID 82 * @return window size 83 */ 84 Dimension getWindowSizeById(long id); 85 }