1 /*
2 * Copyright (c) 2005, 2013, 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 #ifndef _GTK2_INTERFACE_H
26 #define _GTK2_INTERFACE_H
27
28 #include <stdlib.h>
29 #include <jni.h>
30
31 #define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
32 #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
33 #define GTK_TYPE_FILE_CHOOSER (fp_gtk_file_chooser_get_type ())
34 #define GTK_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
35 #define fp_g_signal_connect(instance, detailed_signal, c_handler, data) \
36 fp_g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
37 #define G_CALLBACK(f) ((GCallback) (f))
38 #define G_TYPE_FUNDAMENTAL_SHIFT (2)
39 #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
40 #define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
41 #define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
42 #define GTK_STOCK_CANCEL "gtk-cancel"
43 #define GTK_STOCK_SAVE "gtk-save"
44 #define GTK_STOCK_OPEN "gtk-open"
45 #define GDK_CURRENT_TIME 0L
46
47 typedef enum _WidgetType
48 {
49 BUTTON, /* GtkButton */
760 GdkPixbuf *gtk2_get_icon(const gchar *filename, gint size);
761 jstring gtk2_get_pango_font_name(JNIEnv *env, WidgetType widget_type);
762
763 void flush_gtk_event_loop();
764
765 jobject gtk2_get_setting(JNIEnv *env, Setting property);
766
767 void gtk2_set_range_value(WidgetType widget_type, jdouble value,
768 jdouble min, jdouble max, jdouble visible);
769
770 void (*fp_g_free)(gpointer mem);
771 void (*fp_g_object_unref)(gpointer object);
772 int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
773 guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
774 gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
775 int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
776 int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
777 int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
778 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
779 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
780 void (*fp_gtk_widget_destroy)(GtkWidget *widget);
781 void (*fp_gtk_window_present)(GtkWindow *window);
782 void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
783 void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
784
785 /**
786 * Function Pointers for GtkFileChooser
787 */
788 gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
789 void (*fp_gtk_widget_hide)(GtkWidget *widget);
790 void (*fp_gtk_main_quit)(void);
791 GtkWidget* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
792 GtkWindow *parent, GtkFileChooserAction action,
793 const gchar *first_button_text, ...);
794 gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
795 const gchar *filename);
796 gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
797 const char *filename);
798 void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
799 const gchar *name);
812 GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
813 guint (*fp_gtk_g_slist_length)(GSList *list);
814 gulong (*fp_g_signal_connect_data)(gpointer instance,
815 const gchar *detailed_signal, GCallback c_handler, gpointer data,
816 GClosureNotify destroy_data, GConnectFlags connect_flags);
817 void (*fp_gtk_widget_show)(GtkWidget *widget);
818 void (*fp_gtk_main)(void);
819 guint (*fp_gtk_main_level)(void);
820
821
822 /**
823 * This function is available for GLIB > 2.20, so it MUST be
824 * called within GLIB_CHECK_VERSION(2, 20, 0) check.
825 */
826 gboolean (*fp_g_thread_get_initialized)(void);
827
828 void (*fp_g_thread_init)(GThreadFunctions *vtable);
829 void (*fp_gdk_threads_init)(void);
830 void (*fp_gdk_threads_enter)(void);
831 void (*fp_gdk_threads_leave)(void);
832
833 gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
834 guint32 timestamp, GError **error);
835
836 #endif /* !_GTK2_INTERFACE_H */
|
1 /*
2 * Copyright (c) 2005, 2014, 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 #ifndef _GTK2_INTERFACE_H
26 #define _GTK2_INTERFACE_H
27
28 #include <stdlib.h>
29 #include <jni.h>
30 #include <X11/Xlib.h>
31
32 #define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
33 #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
34 #define GTK_TYPE_FILE_CHOOSER (fp_gtk_file_chooser_get_type ())
35 #define GTK_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER, GtkFileChooser))
36 #define fp_g_signal_connect(instance, detailed_signal, c_handler, data) \
37 fp_g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
38 #define G_CALLBACK(f) ((GCallback) (f))
39 #define G_TYPE_FUNDAMENTAL_SHIFT (2)
40 #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
41 #define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
42 #define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
43 #define GTK_STOCK_CANCEL "gtk-cancel"
44 #define GTK_STOCK_SAVE "gtk-save"
45 #define GTK_STOCK_OPEN "gtk-open"
46 #define GDK_CURRENT_TIME 0L
47
48 typedef enum _WidgetType
49 {
50 BUTTON, /* GtkButton */
761 GdkPixbuf *gtk2_get_icon(const gchar *filename, gint size);
762 jstring gtk2_get_pango_font_name(JNIEnv *env, WidgetType widget_type);
763
764 void flush_gtk_event_loop();
765
766 jobject gtk2_get_setting(JNIEnv *env, Setting property);
767
768 void gtk2_set_range_value(WidgetType widget_type, jdouble value,
769 jdouble min, jdouble max, jdouble visible);
770
771 void (*fp_g_free)(gpointer mem);
772 void (*fp_g_object_unref)(gpointer object);
773 int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
774 guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
775 gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
776 int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
777 int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
778 int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
779 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
780 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
781 void (*fp_gtk_widget_realize)(GtkWidget *widget);
782 void (*fp_gtk_widget_destroy)(GtkWidget *widget);
783 void (*fp_gtk_window_present)(GtkWindow *window);
784 void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
785 void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
786
787 /**
788 * Function Pointers for GtkFileChooser
789 */
790 gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
791 void (*fp_gtk_widget_hide)(GtkWidget *widget);
792 void (*fp_gtk_main_quit)(void);
793 GtkWidget* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
794 GtkWindow *parent, GtkFileChooserAction action,
795 const gchar *first_button_text, ...);
796 gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
797 const gchar *filename);
798 gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
799 const char *filename);
800 void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
801 const gchar *name);
814 GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
815 guint (*fp_gtk_g_slist_length)(GSList *list);
816 gulong (*fp_g_signal_connect_data)(gpointer instance,
817 const gchar *detailed_signal, GCallback c_handler, gpointer data,
818 GClosureNotify destroy_data, GConnectFlags connect_flags);
819 void (*fp_gtk_widget_show)(GtkWidget *widget);
820 void (*fp_gtk_main)(void);
821 guint (*fp_gtk_main_level)(void);
822
823
824 /**
825 * This function is available for GLIB > 2.20, so it MUST be
826 * called within GLIB_CHECK_VERSION(2, 20, 0) check.
827 */
828 gboolean (*fp_g_thread_get_initialized)(void);
829
830 void (*fp_g_thread_init)(GThreadFunctions *vtable);
831 void (*fp_gdk_threads_init)(void);
832 void (*fp_gdk_threads_enter)(void);
833 void (*fp_gdk_threads_leave)(void);
834
835 XID (*fp_gdk_x11_drawable_get_xid)(GdkDrawable *drawable);
836
837 gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
838 guint32 timestamp, GError **error);
839
840 #endif /* !_GTK2_INTERFACE_H */
|