Path: blob/master/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKStyle.c
41154 views
/*1* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifdef HEADLESS26#error This file should not be included in headless library27#endif2829#include <stdlib.h>30#include <stdio.h>31#include "gtk_interface.h"32#include "com_sun_java_swing_plaf_gtk_GTKStyle.h"3334const char *getStrFor(JNIEnv *env, jstring val);3536/*37* Class: com_sun_java_swing_plaf_gtk_GTKStyle38* Method: nativeGetXThickness39* Signature: (I)I40*/41JNIEXPORT jint JNICALL42Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness(43JNIEnv *env, jclass klass, jint widget_type)44{45jint ret;46gtk->gdk_threads_enter();47ret = gtk->get_xthickness(env, widget_type);48gtk->gdk_threads_leave();49return ret;50}5152/*53* Class: com_sun_java_swing_plaf_gtk_GTKStyle54* Method: nativeGetYThickness55* Signature: (I)I56*/57JNIEXPORT jint JNICALL58Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness(59JNIEnv *env, jclass klass, jint widget_type)60{61jint ret;62gtk->gdk_threads_enter();63ret = gtk->get_ythickness(env, widget_type);64gtk->gdk_threads_leave();65return ret;66}6768/*69* Class: com_sun_java_swing_plaf_gtk_GTKStyle70* Method: nativeGetColorForState71* Signature: (III)I72*/73JNIEXPORT jint JNICALL74Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState(75JNIEnv *env, jclass klass, jint widget_type,76jint state_type, jint type_id)77{78jint ret;79gtk->gdk_threads_enter();80ret = gtk->get_color_for_state(env, widget_type, state_type, type_id);81gtk->gdk_threads_leave();82return ret;83}8485/*86* Class: com_sun_java_swing_plaf_gtk_GTKStyle87* Method: nativeGetClassValue88* Signature: (ILjava/lang/String;)Ljava/lang/Object;89*/90JNIEXPORT jobject JNICALL91Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue(92JNIEnv *env, jclass klass, jint widget_type, jstring key)93{94jobject ret;95gtk->gdk_threads_enter();96ret = gtk->get_class_value(env, widget_type, getStrFor(env, key));97gtk->gdk_threads_leave();98return ret;99}100101/*102* Class: com_sun_java_swing_plaf_gtk_GTKStyle103* Method: nativeGetPangoFontName104* Signature: (I)Ljava/lang/String;105*/106JNIEXPORT jstring JNICALL107Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName(108JNIEnv *env, jclass klass, jint widget_type)109{110jstring ret;111gtk->gdk_threads_enter();112ret = gtk->get_pango_font_name(env, widget_type);113gtk->gdk_threads_leave();114return ret;115}116117118