Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: gl4java/jau/awt/windows/MSWin32HandleAccess.java


1   /*
2    * @(#) MSWin32HandleAccess.java
3    */
4   
5   package gl4java.jau.awt.windows;
6   
7   import java.awt.Component;
8   import com.ms.awt.GraphicsX;
9   
10  /**
11   * The ms-windows implementation for accessing the native window handle
12   *
13   * This class has no user servicable parts inside.  It is
14   * used internally by GLFrame and by our package spoofed
15   * sun.awt classes that give us internal access to window
16   * variables that we need to set up the OpenGL drawing
17   * ontext 
18   *
19   * @see gl4java.jau.awt.WinHandleAccess
20   * @version     0.1, 3. JULY 1999
21   * @author      Ron Cemer
22   * 
23   */
24  public class MSWin32HandleAccess 
25    implements gl4java.jau.awt.WinHandleAccess
26  {
27      protected long window;
28      protected int depth;
29  
30      /**
31       * @dll.import("USER32",auto)
32       */
33      private static native int WindowFromDC(int hdc);
34  
35      protected void achieveData(java.awt.Component c, java.awt.Graphics g)
36      {
37          window = (long) WindowFromDC(((GraphicsX)g).gdc.pGetDC());
38          depth = c.getColorModel().getPixelSize();
39      }
40  
41      /**
42       *
43       * get the window handle
44       */
45      public long getWinHandle(java.awt.Component c, java.awt.Graphics g)
46      {
47          achieveData(c, g);
48          return window;
49      }
50  
51      /**
52       *
53       * get the color depth
54       */
55      public int getWinDepth(java.awt.Component c, java.awt.Graphics g)
56      {
57          achieveData(c, g);
58          return depth;
59      }
60  }
61