1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import java.awt.geom.Rectangle2D;
  29 
  30 public final class CWrapper {
  31     private CWrapper() { }
  32 
  33     public static final class NSWindow {
  34         // NSWindowOrderingMode
  35         public static final int NSWindowAbove = 1;
  36         public static final int NSWindowBelow = -1;
  37         public static final int NSWindowOut = 0;
  38 
  39         // Window level constants
  40         // The number of supported levels: (we'll use more in the future)
  41         public static final int MAX_WINDOW_LEVELS = 2;
  42         // The levels: (these are NOT real constants, these are keys. See native code.)
  43         public static final int NSNormalWindowLevel = 0;
  44         public static final int NSFloatingWindowLevel = 1;
  45 
  46         // 'level' is one of the keys defined above
  47         public static native void setLevel(long window, int level);
  48 
  49         public static native void makeKeyAndOrderFront(long window);
  50         public static native void makeKeyWindow(long window);
  51         public static native void makeMainWindow(long window);
  52         public static native boolean canBecomeMainWindow(long window);
  53         public static native boolean isKeyWindow(long window);
  54 
  55         public static native void orderFront(long window);
  56         public static native void orderFrontRegardless(long window);
  57         public static native void orderWindow(long window, int ordered, long relativeTo);
  58         public static native void orderOut(long window);
  59 
  60         public static native void addChildWindow(long parent, long child, int ordered);
  61         public static native void removeChildWindow(long parent, long child);
  62 
  63         public static native void setFrame(long window, int x, int y, int w, int h, boolean display);
  64 
  65         public static native void setAlphaValue(long window, float alpha);
  66         public static native void setOpaque(long window, boolean opaque);
  67         public static native void setBackgroundColor(long window, long color);
  68 
  69         public static native void miniaturize(long window);
  70         public static native void deminiaturize(long window);

  71         public static native void zoom(long window);
  72 
  73         public static native void makeFirstResponder(long window, long responder);
  74     }
  75 
  76     public static final class NSView {
  77         public static native void addSubview(long view, long subview);
  78         public static native void removeFromSuperview(long view);
  79 
  80         public static native void setFrame(long view, int x, int y, int w, int h);
  81         public static native Rectangle2D frame(long view);
  82         public static native long window(long view);
  83 
  84         public static native void enterFullScreenMode(long view);
  85         public static native void exitFullScreenMode(long view);
  86 
  87         public static native void setHidden(long view, boolean hidden);
  88 
  89         public static native void setToolTip(long view, String msg);
  90     }
  91 
  92     public static final class NSObject {
  93         public static native void release(long object);
  94     }
  95 
  96     public static final class NSColor {
  97         public static native long clearColor();
  98     }
  99 }
--- EOF ---