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 Dmitry Durnev
019: * @version $Revision$
020: */package org.apache.harmony.awt.wtk.linux;
021:
022: import java.awt.Image;
023: import java.awt.Insets;
024: import java.awt.Rectangle;
025:
026: import org.apache.harmony.awt.wtk.CreationParams;
027:
028: /**
029: * This is a child "content" window of a
030: * decorated window(Frame or Dialog).Position
031: * of such a window is the same as position of
032: * WM frame: when insets change it is translated
033: * on insets.
034: */
035: public class ContentWindow extends LinuxWindow {
036:
037: private final LinuxWindow frame;
038:
039: /**
040: * @param factory
041: * @param p
042: */
043: public ContentWindow(LinuxWindowFactory factory, CreationParams p) {
044: super (factory, p);
045: frame = (LinuxWindow) factory.getWindowById(p.parentId);
046: super .setTitle("Content Window"); //$NON-NLS-1$
047: }
048:
049: /**
050: * @see org.apache.harmony.awt.wtk.NativeWindow#setTitle(java.lang.String)
051: */
052: public void setTitle(String title) {
053: frame.setTitle(title);
054: }
055:
056: /**
057: * @see org.apache.harmony.awt.wtk.NativeWindow#setBounds(int, int, int, int, int)
058: */
059: public void setBounds(int x, int y, int w, int h, int boundsMask) {
060: Insets ins = frame.getInsets();
061: frame.setBounds(x/* + ins.left*/, y /*+ ins.top*/, w
062: - (ins.left + ins.right), h - (ins.top + ins.bottom),
063: boundsMask);
064: }
065:
066: /**
067: * @see org.apache.harmony.awt.wtk.NativeWindow#setIconImage(java.awt.Image)
068: */
069: public void setIconImage(Image image) {
070: frame.setIconImage(image);
071: }
072:
073: /**
074: * @see org.apache.harmony.awt.wtk.NativeWindow#setState(int)
075: */
076: public void setState(int state) {
077: frame.setState(state);
078: }
079:
080: /**
081: * @see org.apache.harmony.awt.wtk.NativeWindow#setVisible(boolean)
082: */
083: public void setVisible(boolean v) {
084: super .setVisible(v);
085: frame.setVisible(v);
086: }
087:
088: /**
089: * @see org.apache.harmony.awt.wtk.NativeWindow#setEnabled(boolean)
090: */
091: public void setEnabled(boolean value) {
092: frame.setEnabled(value);
093: }
094:
095: /**
096: * @see org.apache.harmony.awt.wtk.linux.LinuxWindow#setInputAllowed(boolean)
097: */
098: void setInputAllowed(boolean value) {
099: frame.setInputAllowed(value);
100: }
101:
102: /**
103: * @see org.apache.harmony.awt.wtk.NativeWindow#getInsets()
104: */
105: public Insets getInsets() {
106: return frame.getInsets();
107: }
108:
109: /**
110: * @see org.apache.harmony.awt.wtk.linux.LinuxWindow#getCurrentState()
111: */
112: int getCurrentState() {
113: return frame.getCurrentState();
114: }
115:
116: /**
117: * @see org.apache.harmony.awt.wtk.NativeWindow#dispose()
118: */
119: public void dispose() {
120: super .dispose();
121: frame.dispose();
122: }
123:
124: /**
125: * @see org.apache.harmony.awt.wtk.NativeWindow#toBack()
126: */
127: public void toBack() {
128: frame.toBack();
129: }
130:
131: /**
132: * @see org.apache.harmony.awt.wtk.NativeWindow#toFront()
133: */
134: public void toFront() {
135: frame.toFront();
136: }
137:
138: public void setAlwaysOnTop(boolean value) {
139: frame.setAlwaysOnTop(value);
140: }
141:
142: /**
143: * @see org.apache.harmony.awt.wtk.NativeWindow#setMaximizedBounds(java.awt.Rectangle)
144: */
145: public void setMaximizedBounds(Rectangle bounds) {
146: frame.setMaximizedBounds(bounds);
147: }
148:
149: /**
150: * @see org.apache.harmony.awt.wtk.NativeWindow#setResizable(boolean)
151: */
152: public void setResizable(boolean value) {
153: frame.setResizable(value);
154: }
155:
156: /**
157: * @return Returns the frame.
158: */
159: LinuxWindow getFrame() {
160: return frame;
161: }
162: }
|