|
Java example source code file (awt.h)
The awt.h Java example source code/* * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #ifndef _AWT_H_ #define _AWT_H_ #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0600 #endif #ifndef _WIN32_IE #define _WIN32_IE 0x0600 #endif //#ifndef NTDDI_VERSION //#define NTDDI_VERSION NTDDI_LONGHORN //#endif #include "stdhdrs.h" #include "alloc.h" #include "awt_Debug.h" extern COLORREF DesktopColor2RGB(int colorIndex); class AwtObject; typedef AwtObject* PDATA; #define JNI_CHECK_NULL_GOTO(obj, msg, where) { \ if (obj == NULL) { \ JNU_ThrowNullPointerException(env, msg); \ goto where; \ } \ } #define JNI_CHECK_PEER_GOTO(peer, where) { \ JNI_CHECK_NULL_GOTO(peer, "peer", where); \ pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \ THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ goto where; \ } \ } #define JNI_CHECK_NULL_RETURN(obj, msg) { \ if (obj == NULL) { \ JNU_ThrowNullPointerException(env, msg); \ return; \ } \ } #define JNI_CHECK_PEER_RETURN(peer) { \ JNI_CHECK_NULL_RETURN(peer, "peer"); \ pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \ THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return; \ } \ } #define JNI_CHECK_PEER_CREATION_RETURN(peer) { \ if (peer == NULL ) { \ return; \ } \ pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \ return; \ } \ } #define JNI_CHECK_NULL_RETURN_NULL(obj, msg) { \ if (obj == NULL) { \ JNU_ThrowNullPointerException(env, msg); \ return 0; \ } \ } #define JNI_CHECK_NULL_RETURN_VAL(obj, msg, val) { \ if (obj == NULL) { \ JNU_ThrowNullPointerException(env, msg); \ return val; \ } \ } #define JNI_CHECK_PEER_RETURN_NULL(peer) { \ JNI_CHECK_NULL_RETURN_NULL(peer, "peer"); \ pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \ THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return 0; \ } \ } #define JNI_CHECK_PEER_RETURN_VAL(peer, val) { \ JNI_CHECK_NULL_RETURN_VAL(peer, "peer", val); \ pData = JNI_GET_PDATA(peer); \ if (pData == NULL) { \ THROW_NULL_PDATA_IF_NOT_DESTROYED(peer); \ return val; \ } \ } #define THROW_NULL_PDATA_IF_NOT_DESTROYED(peer) { \ jboolean destroyed = JNI_GET_DESTROYED(peer); \ if (destroyed != JNI_TRUE) { \ JNU_ThrowNullPointerException(env, "null pData"); \ } \ } #define JNI_GET_PDATA(peer) (PDATA) env->GetLongField(peer, AwtObject::pDataID) #define JNI_GET_DESTROYED(peer) env->GetBooleanField(peer, AwtObject::destroyedID) #define JNI_SET_PDATA(peer, data) env->SetLongField(peer, \ AwtObject::pDataID, \ (jlong)data) #define JNI_SET_DESTROYED(peer) env->SetBooleanField(peer, \ AwtObject::destroyedID, \ JNI_TRUE) /* /NEW JNI */ /* * IS_WIN64 returns TRUE on 64-bit Itanium */ #if defined (_WIN64) #define IS_WIN64 TRUE #else #define IS_WIN64 FALSE #endif /* * IS_WIN2000 returns TRUE on 2000, XP and Vista * IS_WINXP returns TRUE on XP and Vista * IS_WINVISTA returns TRUE on Vista */ #define IS_WIN2000 (LOBYTE(LOWORD(::GetVersion())) >= 5) #define IS_WINXP ((IS_WIN2000 && HIBYTE(LOWORD(::GetVersion())) >= 1) || LOBYTE(LOWORD(::GetVersion())) > 5) #define IS_WINVISTA (LOBYTE(LOWORD(::GetVersion())) >= 6) #define IS_WINVER_ATLEAST(maj, min) \ ((maj) < LOBYTE(LOWORD(::GetVersion())) || \ (maj) == LOBYTE(LOWORD(::GetVersion())) && \ (min) <= HIBYTE(LOWORD(::GetVersion()))) /* * macros to crack a LPARAM into two ints -- used for signed coordinates, * such as with mouse messages. */ #define LO_INT(l) ((int)(short)(l)) #define HI_INT(l) ((int)(short)(((DWORD)(l) >> 16) & 0xFFFF)) extern JavaVM *jvm; // Platform encoding is Unicode (UTF-16), re-define JNU_ functions // to proper JNI functions. #define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<const jchar*>(x), static_cast Other Java examples (source code examples)Here is a short list of links related to this Java awt.h source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.