jdk/src/windows/native/sun/windows/awt.h
author lana
Wed, 05 Jan 2011 15:54:45 -0800
changeset 7775 c75bf08f7e0c
parent 7772 bf119e738928
parent 7668 d4a77089c587
child 18232 b538b71fb429
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 6099
diff changeset
     2
 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4831
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4831
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4831
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4831
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4831
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef _AWT_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define _AWT_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    29
#ifndef _WIN32_WINNT
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    30
#define _WIN32_WINNT 0x0600
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    31
#endif
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    32
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    33
#ifndef _WIN32_IE
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    34
#define _WIN32_IE 0x0600
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    35
#endif
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    36
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    37
//#ifndef NTDDI_VERSION
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    38
//#define NTDDI_VERSION NTDDI_LONGHORN
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    39
//#endif
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
    40
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#include "stdhdrs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#include "alloc.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include "awt_Debug.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
extern COLORREF DesktopColor2RGB(int colorIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
class AwtObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
typedef AwtObject* PDATA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define JNI_CHECK_NULL_GOTO(obj, msg, where) {                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    if (obj == NULL) {                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        JNU_ThrowNullPointerException(env, msg);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        goto where;                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#define JNI_CHECK_PEER_GOTO(peer, where) {                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    JNI_CHECK_NULL_GOTO(peer, "peer", where);                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    pData = JNI_GET_PDATA(peer);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    if (pData == NULL) {                                                  \
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
    61
        THROW_NULL_PDATA_IF_NOT_DESTROYED(peer);                          \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        goto where;                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#define JNI_CHECK_NULL_RETURN(obj, msg) {                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    if (obj == NULL) {                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        JNU_ThrowNullPointerException(env, msg);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        return;                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define JNI_CHECK_PEER_RETURN(peer) {                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    JNI_CHECK_NULL_RETURN(peer, "peer");                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    pData = JNI_GET_PDATA(peer);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    if (pData == NULL) {                                                  \
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
    77
        THROW_NULL_PDATA_IF_NOT_DESTROYED(peer);                          \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        return;                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define JNI_CHECK_PEER_CREATION_RETURN(peer) {                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    if (peer == NULL ) {                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return;                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    pData = JNI_GET_PDATA(peer);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    if (pData == NULL) {                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        return;                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#define JNI_CHECK_NULL_RETURN_NULL(obj, msg) {                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    if (obj == NULL) {                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        JNU_ThrowNullPointerException(env, msg);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return 0;                                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
#define JNI_CHECK_NULL_RETURN_VAL(obj, msg, val) {                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    if (obj == NULL) {                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        JNU_ThrowNullPointerException(env, msg);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        return val;                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#define JNI_CHECK_PEER_RETURN_NULL(peer) {                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    JNI_CHECK_NULL_RETURN_NULL(peer, "peer");                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    pData = JNI_GET_PDATA(peer);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    if (pData == NULL) {                                                  \
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   110
        THROW_NULL_PDATA_IF_NOT_DESTROYED(peer);                          \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        return 0;                                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#define JNI_CHECK_PEER_RETURN_VAL(peer, val) {                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    JNI_CHECK_NULL_RETURN_VAL(peer, "peer", val);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    pData = JNI_GET_PDATA(peer);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    if (pData == NULL) {                                                  \
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   119
        THROW_NULL_PDATA_IF_NOT_DESTROYED(peer);                          \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        return val;                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }                                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   124
#define THROW_NULL_PDATA_IF_NOT_DESTROYED(peer) {                         \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   125
    jboolean destroyed = JNI_GET_DESTROYED(peer);                         \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   126
    if (destroyed != JNI_TRUE) {                                          \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   127
        JNU_ThrowNullPointerException(env, "null pData");                 \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   128
    }                                                                     \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   129
}
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   130
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
#define JNI_GET_PDATA(peer) (PDATA) env->GetLongField(peer, AwtObject::pDataID)
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   132
#define JNI_GET_DESTROYED(peer) env->GetBooleanField(peer, AwtObject::destroyedID)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
#define JNI_SET_PDATA(peer, data) env->SetLongField(peer,                  \
108
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   135
                                                    AwtObject::pDataID,    \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   136
                                                    (jlong)data)
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   137
#define JNI_SET_DESTROYED(peer) env->SetBooleanField(peer,                   \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   138
                                                     AwtObject::destroyedID, \
deaaed5cedb7 6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents: 2
diff changeset
   139
                                                     JNI_TRUE)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
/*  /NEW JNI */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * IS_WIN64 returns TRUE on 64-bit Itanium
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
#if defined (_WIN64)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    #define IS_WIN64 TRUE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    #define IS_WIN64 FALSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
#endif
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   150
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   151
/*
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   152
 * IS_WIN2000 returns TRUE on 2000, XP and Vista
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   153
 * IS_WINXP returns TRUE on XP and Vista
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   154
 * IS_WINVISTA returns TRUE on Vista
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   155
 */
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   156
#define IS_WIN2000 (LOBYTE(LOWORD(::GetVersion())) >= 5)
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   157
#define IS_WINXP ((IS_WIN2000 && HIBYTE(LOWORD(::GetVersion())) >= 1) || LOBYTE(LOWORD(::GetVersion())) > 5)
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   158
#define IS_WINVISTA (LOBYTE(LOWORD(::GetVersion())) >= 6)
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   159
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
#define IS_WINVER_ATLEAST(maj, min) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                   ((maj) < LOBYTE(LOWORD(::GetVersion())) || \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                      (maj) == LOBYTE(LOWORD(::GetVersion())) && \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                      (min) <= HIBYTE(LOWORD(::GetVersion())))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * macros to crack a LPARAM into two ints -- used for signed coordinates,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * such as with mouse messages.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
#define LO_INT(l)           ((int)(short)(l))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
#define HI_INT(l)           ((int)(short)(((DWORD)(l) >> 16) & 0xFFFF))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
extern JavaVM *jvm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   174
// Platform encoding is Unicode (UTF-16), re-define JNU_ functions
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   175
// to proper JNI functions.
7772
bf119e738928 6999766: Changes to correct c/c++ language issues for use of parfait
dav
parents: 6099
diff changeset
   176
#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<const jchar*>(x), static_cast<jsize>(_tcslen(x)))
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   177
#define JNU_GetStringPlatformChars(env, x, y) reinterpret_cast<LPCWSTR>(env->GetStringChars(x, y))
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   178
#define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast<const jchar*>(y))
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   179
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * Itanium symbols needed for 64-bit compilation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * These are defined in winuser.h in the August 2001 MSDN update.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#ifndef GCLP_HBRBACKGROUND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    #ifdef _WIN64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        #error Macros for GetClassLongPtr, etc. are for 32-bit windows only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    #endif /* !_WIN64 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    #define GetClassLongPtr GetClassLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    #define SetClassLongPtr SetClassLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    #define GCLP_HBRBACKGROUND GCL_HBRBACKGROUND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    #define GCLP_HCURSOR GCL_HCURSOR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    #define GCLP_HICON GCL_HICON
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    #define GCLP_HICONSM GCL_HICONSM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    #define GCLP_HMODULE GCL_HMODULE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    #define GCLP_MENUNAME GCL_MENUNAME
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    #define GCLP_WNDPROC GCL_WNDPROC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    #define GetWindowLongPtr GetWindowLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    #define SetWindowLongPtr SetWindowLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    #define GWLP_WNDPROC GWL_WNDPROC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    #define GWLP_HINSTANCE GWL_HINSTANCE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    #define GWLP_HWNDPARENT GWL_HWNDPARENT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    #define GWLP_ID GWL_ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    #define GWLP_USERDATA GWL_USERDATA
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    #define DWLP_DLGPROC DWL_DLGPROC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    #define DWLP_MSGRESULT DWL_MSGRESULT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    #define DWLP_USER DWL_USER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
#endif /* !GCLP_HBRBACKGROUND */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * macros for saving and restoring FPU control word
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * NOTE: float.h must be defined if using these macros
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
#define SAVE_CONTROLWORD  \
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   214
  unsigned int fpu_cw = _control87(0, 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   216
#define RESTORE_CONTROLWORD  \
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   217
  if (_control87(0, 0) != fpu_cw) {  \
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   218
    _control87(fpu_cw, 0xffffffff);  \
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 887
diff changeset
   219
  }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * checks if the current thread is/isn't the toolkit thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#if defined(DEBUG) || defined(INTERNAL_BUILD)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
#define CHECK_IS_TOOLKIT_THREAD() \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
  if (GetCurrentThreadId() != AwtToolkit::MainThread())  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
  { JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
#define CHECK_ISNOT_TOOLKIT_THREAD()  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  if (GetCurrentThreadId() == AwtToolkit::MainThread())  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  { JNU_ThrowInternalError(env,"Operation is not permitted on toolkit thread!\n"); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
#define CHECK_IS_TOOLKIT_THREAD()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
#define CHECK_ISNOT_TOOLKIT_THREAD()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   236
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   237
struct EnvHolder
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   238
{
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   239
    JavaVM *m_pVM;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   240
    JNIEnv *m_env;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   241
    bool    m_isOwner;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   242
    EnvHolder(
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   243
        JavaVM *pVM,
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   244
        LPCSTR name = "COM holder",
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   245
        jint ver = JNI_VERSION_1_2)
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   246
    : m_pVM(pVM),
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   247
      m_env((JNIEnv *)JNU_GetEnv(pVM, ver)),
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   248
      m_isOwner(false)
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   249
    {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   250
        if (NULL == m_env) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   251
            JavaVMAttachArgs attachArgs;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   252
            attachArgs.version  = ver;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   253
            attachArgs.name     = const_cast<char *>(name);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   254
            attachArgs.group    = NULL;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   255
            jint status = m_pVM->AttachCurrentThread(
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   256
                (void**)&m_env,
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   257
                &attachArgs);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   258
            m_isOwner = (NULL!=m_env);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   259
        }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   260
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   261
    ~EnvHolder() {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   262
        if (m_isOwner) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   263
            m_pVM->DetachCurrentThread();
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   264
        }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   265
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   266
    operator bool()  const { return NULL!=m_env; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   267
    bool operator !()  const { return NULL==m_env; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   268
    operator JNIEnv*() const { return m_env; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   269
    JNIEnv* operator ->() const { return m_env; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   270
};
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   271
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   272
template <class T>
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   273
class JLocalRef {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   274
    JNIEnv* m_env;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   275
    T m_localJRef;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   276
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   277
public:
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   278
    JLocalRef(JNIEnv* env, T localJRef = NULL)
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   279
    : m_env(env),
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   280
    m_localJRef(localJRef)
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   281
    {}
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   282
    T Detach() {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   283
        T ret = m_localJRef;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   284
        m_localJRef = NULL;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   285
        return ret;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   286
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   287
    void Attach(T newValue) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   288
        if (m_localJRef) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   289
            m_env->DeleteLocalRef((jobject)m_localJRef);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   290
        }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   291
        m_localJRef = newValue;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   292
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   293
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   294
    operator T() { return m_localJRef; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   295
    operator bool() { return NULL!=m_localJRef; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   296
    bool operator !() { return NULL==m_localJRef; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   297
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   298
    ~JLocalRef() {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   299
        if (m_localJRef) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   300
            m_env->DeleteLocalRef((jobject)m_localJRef);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   301
        }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   302
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   303
};
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   304
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   305
typedef JLocalRef<jobject> JLObject;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   306
typedef JLocalRef<jstring> JLString;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   307
typedef JLocalRef<jclass>  JLClass;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   308
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   309
/*
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   310
 * Class to encapsulate the extraction of the java string contents
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   311
 * into a buffer and the cleanup of the buffer
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   312
 */
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   313
class JavaStringBuffer
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   314
{
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   315
protected:
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   316
    LPWSTR m_pStr;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   317
    jsize  m_dwSize;
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   318
    LPWSTR getNonEmptyString() {
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   319
        return (NULL==m_pStr)
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   320
                ? L""
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   321
                : m_pStr;
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   322
    }
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   323
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   324
public:
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   325
    JavaStringBuffer(jsize cbTCharCount) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   326
        m_dwSize = cbTCharCount;
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   327
        m_pStr = (0 == m_dwSize)
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   328
            ? NULL
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   329
            : (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   330
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   331
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   332
    JavaStringBuffer(JNIEnv *env, jstring text) {
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   333
        m_dwSize = (NULL == text)
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   334
            ? 0
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   335
            : env->GetStringLength(text);
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   336
        if (0 == m_dwSize) {
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   337
            m_pStr = NULL;
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   338
        } else {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   339
            m_pStr = (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   340
            env->GetStringRegion(text, 0, m_dwSize, reinterpret_cast<jchar *>(m_pStr));
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   341
            m_pStr[m_dwSize] = 0;
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   342
        }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   343
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   344
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   345
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   346
    ~JavaStringBuffer() {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   347
        free(m_pStr);
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   348
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   349
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   350
    void Resize(jsize cbTCharCount) {
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   351
        m_dwSize = cbTCharCount;
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   352
        //It is ok to have non-null terminated string here.
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   353
        //The function is used only for space reservation in staff buffer for
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   354
        //followed data copying process. And that is the reason why we ignore
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   355
        //the special case m_dwSize==0 here.
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   356
        m_pStr = (LPWSTR)safe_Realloc(m_pStr, (m_dwSize+1)*sizeof(WCHAR) );
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   357
    }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   358
    //we are in UNICODE now, so LPWSTR:=:LPTSTR
6099
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   359
    operator LPWSTR() { return getNonEmptyString(); }
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   360
    operator LPARAM() { return (LPARAM)getNonEmptyString(); }
b86331187c24 6969851: VM hangs/crashes in FileDialog test (VS2008/2010 build)
uta
parents: 5506
diff changeset
   361
    void *GetData() { return (void *)getNonEmptyString(); }
4831
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   362
    jsize  GetSize() { return m_dwSize; }
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   363
};
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   364
85d01a4fe115 4874070: invoking DragSource's startDrag with an Image renders no image on drag
uta
parents: 1954
diff changeset
   365
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
#endif  /* _AWT_H_ */