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 Mikhail Danilov
019: * @version $Revision$
020: */package org.apache.harmony.awt.wtk;
021:
022: import java.awt.Image;
023: import java.awt.Insets;
024: import java.awt.Point;
025: import java.awt.Rectangle;
026:
027: import org.apache.harmony.awt.gl.MultiRectArea;
028:
029: /**
030: * Provides cross-platform way to manipulate native window.
031: *
032: * Results of methods are reported through native messages.
033: */
034: public interface NativeWindow {
035: /**
036: * Returns system id of the associated window
037: * @return HWND on Windows, xwindow on X
038: */
039: long getId();
040:
041: /**
042: * Shows/hides window
043: * @param v - new visibility
044: */
045: void setVisible(boolean v);
046:
047: /**
048: * Means only size should be changed
049: */
050: static final int BOUNDS_NOMOVE = 1;
051:
052: /**
053: * Means only position should be changed
054: */
055: static final int BOUNDS_NOSIZE = 2;
056:
057: /**
058: * Tries to set desired window bounds. It's not gurantied the
059: * property will have the desired value. The value change
060: * should be reported by system event (as for other properties).
061: *
062: * <p/> If child, position is relative to parent window.
063: * @param x - desired x
064: * @param y - desired y
065: * @param w - desired width
066: * @param h - desired height
067: * @param boundsMask - bitwise OR of BOUNDS_* constants.
068: * Governs the new bounds interpretation.
069: */
070: void setBounds(int x, int y, int w, int h, int boundsMask);
071:
072: /**
073: * Returns last notified window bounds. This means the last bounds
074: * reported by system event.
075: *
076: * <p/> If child, position is relative to parent window.
077: * @return last notified window bounds
078: */
079: Rectangle getBounds();
080:
081: /**
082: * Returns last notified insets. This means the last insets
083: * reported by system event. Insets are margins around client area
084: * ocupied by system provided decor, ususally border and titlebar.
085: * @return last notified insets
086: */
087: Insets getInsets();
088:
089: /**
090: * Enables/disables processing of input (key, mouse) event
091: * by window. If disabled input events are ignored.
092: * @param value - if enabled
093: */
094: void setEnabled(boolean value);
095:
096: /**
097: * Sets the "focusable" window state.
098: * @param value - if true makes window focusable
099: */
100: void setFocusable(boolean value);
101:
102: /**
103: *
104: * @return current focusable window state
105: */
106: boolean isFocusable();
107:
108: /**
109: * Tries to set application input focus to the window or clear
110: * current focus from focused window.
111: *
112: * <p/> For toplevel windows it's not gurantied focus will land in
113: * desired window even if function returns true. Focus traversal should be tracked
114: * by processing system events.
115: *
116: * @param focus - if true sets focus, else clears focus
117: * @return if success
118: */
119: boolean setFocus(boolean focus);
120:
121: /**
122: * Destroys the asscoiated window.
123: * Attempts to use it thereafter can result in
124: * unpredictable bechavior.
125: */
126: void dispose();
127:
128: /**
129: * Changes window Z-order to place this window under, If w is null
130: * places places this window on the top. Z-order is per parent.
131: * Toplevels a children of desktop in terms of Z-order.
132: * @param w - window to place under.
133: */
134: void placeAfter(NativeWindow w);
135:
136: /**
137: * Places window on top of Z-order
138: */
139: void toFront();
140:
141: /**
142: * Places window on bottom of Z-order
143: */
144: void toBack();
145:
146: /**
147: * Makes the window resizable/not resizable by user
148: * @param value - if resizable
149: */
150: void setResizable(boolean value);
151:
152: /**
153: * Sets the window caption
154: * @param title - caption text
155: */
156: void setTitle(String title);
157:
158: /**
159: * Activate the mouse event capturing
160: */
161: void grabMouse();
162:
163: /**
164: * Deactivate mouse event capturing
165: */
166: void ungrabMouse();
167:
168: /**
169: * Set extended state for top-level window.
170: *
171: * @param state - new state, bitmask of ICONIFIED, MAXIMIZED_BOTH, etc.
172: */
173: void setState(int state);
174:
175: /**
176: * Set the image to be displayed in the minimized icon for
177: * top-level [decorated] window.
178: * @param image the icon image to be displayed
179: */
180: void setIconImage(Image image);
181:
182: /**
183: * Makes window top-most if value is true,
184: * non-topmost(normal) otherwise.
185: */
186: void setAlwaysOnTop(boolean value);
187:
188: /**
189: * Set desired [top-level] window bounds when being in maximized state.
190: * Fields set to Integer.MAX_VALUE are ignored[system-supplied values are
191: * used instead]
192: */
193: void setMaximizedBounds(Rectangle bounds);
194:
195: /**
196: * Get absolute position on the screen
197: */
198: Point getScreenPos();
199:
200: /**
201: * Set a window "packed" flag:
202: * the flag indicates that if insets change
203: * client area shouldn't be resized, but frame
204: * must be resized instead
205: */
206: void setPacked(boolean packed);
207:
208: /**
209: * Make window an "input method window" by setting
210: * special window style, e. g. small title bar, no
211: * close, minimize/maximize buttons. For internal
212: * use by input method framework.
213: *
214: */
215: void setIMStyle();
216:
217: MultiRectArea getObscuredRegion(Rectangle part);
218: }
|