1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 import gnu
.gcj
.RawData
;
12 import java
.awt
.Rectangle
;
17 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
19 public class Window
extends Drawable
21 // Must correspond with X.h definitions:
22 public static final int COPY_FROM_PARENT
= 0;
23 public static final int INPUT_OUTPUT
= 1;
24 public static final int INPUT_ONLY
= 2;
26 public Window(Window parent
, Rectangle bounds
,
27 WindowAttributes attributes
)
29 this(parent
, bounds
, attributes
, null);
32 public Window(Window parent
, Rectangle bounds
,
33 WindowAttributes attributes
, Visual visual
)
35 this(parent
, bounds
, 0, attributes
, COPY_FROM_PARENT
, visual
);
38 public Window(Window parent
, Rectangle bounds
, int borderWidth
,
39 WindowAttributes attributes
, int windowIOClass
,
43 parent
.createChildXID(bounds
, borderWidth
, attributes
,
44 windowIOClass
, visual
));
48 protected Window(Display display
, int xid
)
51 display
.addXID(xid
, this);
54 protected void finalize()
56 display
.removeXID(xid
);
64 protected native void destroy();
66 protected native int createChildXID(Rectangle bounds
,
68 WindowAttributes attributes
,
72 public native void setAttributes(WindowAttributes attributes
);
74 public native void map();
75 public native void unmap();
76 public native void toFront();
77 public native void toBack();
79 protected boolean owned
= false;
81 public native void setProperty(int nameAtom
, int typeAtom
, byte[] data
);
83 public void setProperty(int nameAtom
, int typeAtom
, String data
)
85 int length
= data
.length();
86 byte[] byteData
= new byte[length
];
88 for (int i
=0; i
<length
; i
++)
89 byteData
[i
] = (byte) data
.charAt(i
);
91 setProperty(nameAtom
, typeAtom
, byteData
);
94 public native void setWMProtocols(int[] atoms
);
95 public native int[] getWMProtocols();
97 public void setProperty(String nameAtom
, String typeAtom
, String data
)
99 int xaName
= display
.getAtom(nameAtom
);
100 int xaType
= display
.getAtom(typeAtom
);
102 setProperty(xaName
, xaType
, data
);
105 public native void setBounds(int x
, int y
, int width
, int height
);