2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / gnu / gcj / xlib / WindowAttributes.java
blob23be37d6363ae47f48a2f42edf980b87603f13ce
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
7 details. */
9 package gnu.gcj.xlib;
10 import gnu.gcj.RawData;
12 /**
14 * Collection of attributes that can be applied to or read from an
15 * X11 window.
17 * <p>TODO: Split this class into two classes. One for the structure
18 * XSetWindowAttributes and one for the XWindowAttributes. However
19 * they should still share this common base class.
21 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> */
22 public class WindowAttributes
24 // Must match definitions in X.h:
25 public final static long MASK_BUTTON_PRESS = 1L<< 2,
26 MASK_BUTTON_RELEASE = 1L<< 3,
27 MASK_EXPOSURE = 1L<<15,
28 MASK_STRUCTURE_NOTIFY = 1L<<17;
30 public WindowAttributes()
32 init(null);
35 public WindowAttributes(Window from)
37 initFromWindow(from);
40 private native void initFromWindow(Window from);
41 private native void init(WindowAttributes copyFrom);
42 protected native void finalize();
44 public Object clone()
46 try
48 WindowAttributes attributes = (WindowAttributes) super.clone();
49 // In case of an exception before the stucture is copied.
50 attributes.in = null;
51 attributes.out = null;
53 // FIXME: do anything else?
55 attributes.init(this);
56 return attributes;
58 catch (CloneNotSupportedException ex)
60 // This should never happen.
61 throw new InternalError ();
65 public native void setBackground(long pixel);
66 public native void setBackground(Pixmap pixmap);
67 public native void setEventMask(long eventMask);
69 public void setVisual(Visual visual)
71 this.visual = visual;
74 /**
75 * Retrieve the visual.
77 * @return the visual that is or should be used by a window. null
78 * means CopyFormParent.
80 public native Visual getVisual();
82 Display display;
84 /**
85 * Reference to XWindowAttribute structure containing attributes
86 * read from a window.
88 RawData in = null;
90 /**
91 * Reference to XSetWindowAttribute structure containing attributes
92 * to be applied to a window.
94 RawData out = null;
96 long mask;
98 /** null means CopyFromParent during window creation. */
99 Visual visual = null;
101 public native void apply(Window window);
103 final RawData getXSetWindowAttributesStructure()
105 if (out == null)
106 initOut();
107 return out;
110 void initOut()
112 throw new UnsupportedOperationException("not implemented yet");