1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 *************************************************************************/
32 // property name to register own window procedure on hwnd
33 #define OLD_PROC_KEY "oldwindowproc"
34 // signature of this window procedure
35 static LRESULT APIENTRY
NativeViewWndProc( HWND
, UINT
, WPARAM
, LPARAM
);
41 #include "NativeView.h"
43 #define MY_ASSERT(X,S) if (!X) { fprintf(stderr,"%s\n",S); return 0L;}
45 #define SYSTEM_WIN32 1
46 #define SYSTEM_WIN16 2
49 #define SYSTEM_XWINDOW 6
51 /*****************************************************************************
54 * Method : getNativeWindowSystemType
56 * Description: returns an identifier for the current operating system
58 JNIEXPORT jint JNICALL Java_embeddedobj_test_NativeView_getNativeWindowSystemType
59 (JNIEnv
* env
, jobject obj_this
)
61 return (SYSTEM_WIN32
);
64 /*****************************************************************************
67 * Method : getNativeWindow
69 * Description: returns the native systemw window handle of this object
71 JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
72 (JNIEnv
* env
, jobject obj_this
)
77 JAWT_DrawingSurface
* ds
;
78 JAWT_DrawingSurfaceInfo
* dsi
;
79 JAWT_Win32DrawingSurfaceInfo
* dsi_win
;
83 awt
.version
= JAWT_VERSION_1_3
;
84 result
= JAWT_GetAWT(env
, &awt
);
85 MY_ASSERT(result
!=JNI_FALSE
,"wrong jawt version");
87 /* Get the drawing surface */
88 if ((ds
= awt
.GetDrawingSurface(env
, obj_this
)) == NULL
)
91 /* Lock the drawing surface */
93 MY_ASSERT((lock
& JAWT_LOCK_ERROR
)==0,"can't lock the drawing surface");
95 /* Get the drawing surface info */
96 dsi
= ds
->GetDrawingSurfaceInfo(ds
);
98 /* Get the platform-specific drawing info */
100 dsi_win
= (JAWT_Win32DrawingSurfaceInfo
*)dsi
->platformInfo
;
101 drawable
= (jlong
)dsi_win
->hwnd
;
103 dsi_x11
= (JAWT_X11DrawingSurfaceInfo
*)dsi
->platformInfo
;
104 drawable
= (jlong
)dsi_x11
->drawable
;
107 /* Free the drawing surface info */
108 ds
->FreeDrawingSurfaceInfo(dsi
);
109 /* Unlock the drawing surface */
111 /* Free the drawing surface */
112 awt
.FreeDrawingSurface(ds
);
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */