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 }