1 /* 2 * Copyright (c) 2005, 2010, 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 #include <stdlib.h> 27 #include "gtk2_interface.h" 28 #include "com_sun_java_swing_plaf_gtk_GTKStyle.h" 29 30 /* 31 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 32 * Method: nativeGetXThickness 33 * Signature: (I)I 34 */ 35 JNIEXPORT jint JNICALL 36 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness( 37 JNIEnv *env, jclass klass, jint widget_type) 38 { 39 jint ret; 40 fp_gdk_threads_enter(); 41 ret = gtk2_get_xthickness(env, widget_type); 42 fp_gdk_threads_leave(); 43 return ret; 44 } 45 46 /* 47 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 48 * Method: nativeGetYThickness 49 * Signature: (I)I 50 */ 51 JNIEXPORT jint JNICALL 52 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness( 53 JNIEnv *env, jclass klass, jint widget_type) 54 { 55 jint ret; 56 fp_gdk_threads_enter(); 57 ret = gtk2_get_ythickness(env, widget_type); 58 fp_gdk_threads_leave(); 59 return ret; 60 } 61 62 /* 63 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 64 * Method: nativeGetColorForState 65 * Signature: (III)I 66 */ 67 JNIEXPORT jint JNICALL 68 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState( 69 JNIEnv *env, jclass klass, jint widget_type, 70 jint state_type, jint type_id) 71 { 72 jint ret; 73 fp_gdk_threads_enter(); 74 ret = gtk2_get_color_for_state(env, widget_type, state_type, type_id); 75 fp_gdk_threads_leave(); 76 return ret; 77 } 78 79 /* 80 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 81 * Method: nativeGetClassValue 82 * Signature: (ILjava/lang/String;)Ljava/lang/Object; 83 */ 84 JNIEXPORT jobject JNICALL 85 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue( 86 JNIEnv *env, jclass klass, jint widget_type, jstring key) 87 { 88 jobject ret; 89 fp_gdk_threads_enter(); 90 ret = gtk2_get_class_value(env, widget_type, key); 91 fp_gdk_threads_leave(); 92 return ret; 93 } 94 95 /* 96 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 97 * Method: nativeGetPangoFontName 98 * Signature: (I)Ljava/lang/String; 99 */ 100 JNIEXPORT jstring JNICALL 101 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName( 102 JNIEnv *env, jclass klass, jint widget_type) 103 { 104 jstring ret; 105 fp_gdk_threads_enter(); 106 ret = gtk2_get_pango_font_name(env, widget_type); 107 fp_gdk_threads_leave(); 108 return ret; 109 } | 1 /* 2 * Copyright (c) 2005, 2018, 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 #include <stdlib.h> 27 #include <stdio.h> 28 #include "gtk_interface.h" 29 #include "com_sun_java_swing_plaf_gtk_GTKStyle.h" 30 31 const char *getStrFor(JNIEnv *env, jstring val); 32 33 /* 34 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 35 * Method: nativeGetXThickness 36 * Signature: (I)I 37 */ 38 JNIEXPORT jint JNICALL 39 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness( 40 JNIEnv *env, jclass klass, jint widget_type) 41 { 42 jint ret; 43 gtk->gdk_threads_enter(); 44 ret = gtk->get_xthickness(env, widget_type); 45 gtk->gdk_threads_leave(); 46 return ret; 47 } 48 49 /* 50 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 51 * Method: nativeGetYThickness 52 * Signature: (I)I 53 */ 54 JNIEXPORT jint JNICALL 55 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness( 56 JNIEnv *env, jclass klass, jint widget_type) 57 { 58 jint ret; 59 gtk->gdk_threads_enter(); 60 ret = gtk->get_ythickness(env, widget_type); 61 gtk->gdk_threads_leave(); 62 return ret; 63 } 64 65 /* 66 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 67 * Method: nativeGetColorForState 68 * Signature: (III)I 69 */ 70 JNIEXPORT jint JNICALL 71 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState( 72 JNIEnv *env, jclass klass, jint widget_type, 73 jint state_type, jint type_id) 74 { 75 jint ret; 76 gtk->gdk_threads_enter(); 77 ret = gtk->get_color_for_state(env, widget_type, state_type, type_id); 78 gtk->gdk_threads_leave(); 79 return ret; 80 } 81 82 /* 83 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 84 * Method: nativeGetClassValue 85 * Signature: (ILjava/lang/String;)Ljava/lang/Object; 86 */ 87 JNIEXPORT jobject JNICALL 88 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue( 89 JNIEnv *env, jclass klass, jint widget_type, jstring key) 90 { 91 jobject ret; 92 gtk->gdk_threads_enter(); 93 ret = gtk->get_class_value(env, widget_type, getStrFor(env, key)); 94 gtk->gdk_threads_leave(); 95 return ret; 96 } 97 98 /* 99 * Class: com_sun_java_swing_plaf_gtk_GTKStyle 100 * Method: nativeGetPangoFontName 101 * Signature: (I)Ljava/lang/String; 102 */ 103 JNIEXPORT jstring JNICALL 104 Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName( 105 JNIEnv *env, jclass klass, jint widget_type) 106 { 107 jstring ret; 108 gtk->gdk_threads_enter(); 109 ret = gtk->get_pango_font_name(env, widget_type); 110 gtk->gdk_threads_leave(); 111 return ret; 112 } |