src/solaris/native/sun/awt/gtk2_interface.h

Print this page


   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 */


 620   const gchar *uri;
 621   const gchar *display_name;
 622   const gchar *mime_type;
 623 } GtkFileFilterInfo;
 624 
 625 typedef gboolean (*GtkFileFilterFunc)(const GtkFileFilterInfo *filter_info,
 626     gpointer data);
 627 
 628 typedef void (*GDestroyNotify)(gpointer data);
 629 
 630 typedef void (*GCallback)(void);
 631 
 632 typedef struct _GClosure GClosure;
 633 
 634 typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
 635 
 636 typedef enum {
 637   G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1
 638 } GConnectFlags;
 639 
















 640 typedef struct _GThreadFunctions GThreadFunctions;
 641 
 642 /*
 643  * Converts java.lang.String object to UTF-8 character string.
 644  */
 645 const char *getStrFor(JNIEnv *env, jstring value);
 646 
 647 /**
 648  * Returns :
 649  * NULL if the GLib library is compatible with the given version, or a string
 650  * describing the version mismatch.
 651  * Please note that the glib_check_version() is available since 2.6,
 652  * so you should use GLIB_CHECK_VERSION macro instead.
 653  */
 654 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
 655                        guint required_micro);
 656 
 657 /**
 658  * Returns :
 659  *  TRUE if the GLib library is compatible with the given version


 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 */


 621   const gchar *uri;
 622   const gchar *display_name;
 623   const gchar *mime_type;
 624 } GtkFileFilterInfo;
 625 
 626 typedef gboolean (*GtkFileFilterFunc)(const GtkFileFilterInfo *filter_info,
 627     gpointer data);
 628 
 629 typedef void (*GDestroyNotify)(gpointer data);
 630 
 631 typedef void (*GCallback)(void);
 632 
 633 typedef struct _GClosure GClosure;
 634 
 635 typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
 636 
 637 typedef enum {
 638   G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1
 639 } GConnectFlags;
 640 
 641 typedef enum
 642 {
 643     GDK_CONFIGURE
 644 } GdkEventType;
 645 
 646 typedef struct _GdkEventConfigure   GdkEventConfigure;
 647 struct _GdkEventConfigure
 648 {
 649   GdkEventType type;
 650   GdkWindow *window;
 651   gint8 send_event;
 652   gint x, y;
 653   gint width;
 654   gint height;
 655 };
 656 
 657 typedef struct _GThreadFunctions GThreadFunctions;
 658 
 659 /*
 660  * Converts java.lang.String object to UTF-8 character string.
 661  */
 662 const char *getStrFor(JNIEnv *env, jstring value);
 663 
 664 /**
 665  * Returns :
 666  * NULL if the GLib library is compatible with the given version, or a string
 667  * describing the version mismatch.
 668  * Please note that the glib_check_version() is available since 2.6,
 669  * so you should use GLIB_CHECK_VERSION macro instead.
 670  */
 671 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
 672                        guint required_micro);
 673 
 674 /**
 675  * Returns :
 676  *  TRUE if the GLib library is compatible with the given version


 777 GdkPixbuf *gtk2_get_icon(const gchar *filename, gint size);
 778 jstring gtk2_get_pango_font_name(JNIEnv *env, WidgetType widget_type);
 779 
 780 void flush_gtk_event_loop();
 781 
 782 jobject gtk2_get_setting(JNIEnv *env, Setting property);
 783 
 784 void gtk2_set_range_value(WidgetType widget_type, jdouble value,
 785                           jdouble min, jdouble max, jdouble visible);
 786 
 787 void (*fp_g_free)(gpointer mem);
 788 void (*fp_g_object_unref)(gpointer object);
 789 int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 790 guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 791 gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 792 int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 793 int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 794 int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 795 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 796 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
 797 void (*fp_gtk_widget_realize)(GtkWidget *widget);
 798 void (*fp_gtk_widget_destroy)(GtkWidget *widget);
 799 void (*fp_gtk_window_present)(GtkWindow *window);
 800 void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
 801 void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
 802 
 803 /**
 804  * Function Pointers for GtkFileChooser
 805  */
 806 gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
 807 void (*fp_gtk_widget_hide)(GtkWidget *widget);
 808 void (*fp_gtk_main_quit)(void);
 809 GtkWidget* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
 810     GtkWindow *parent, GtkFileChooserAction action,
 811     const gchar *first_button_text, ...);
 812 gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
 813     const gchar *filename);
 814 gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
 815     const char *filename);
 816 void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
 817     const gchar *name);


 830 GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
 831 guint (*fp_gtk_g_slist_length)(GSList *list);
 832 gulong (*fp_g_signal_connect_data)(gpointer instance,
 833     const gchar *detailed_signal, GCallback c_handler, gpointer data,
 834     GClosureNotify destroy_data, GConnectFlags connect_flags);
 835 void (*fp_gtk_widget_show)(GtkWidget *widget);
 836 void (*fp_gtk_main)(void);
 837 guint (*fp_gtk_main_level)(void);
 838 
 839 
 840 /**
 841  * This function is available for GLIB > 2.20, so it MUST be
 842  * called within GLIB_CHECK_VERSION(2, 20, 0) check.
 843  */
 844 gboolean (*fp_g_thread_get_initialized)(void);
 845 
 846 void (*fp_g_thread_init)(GThreadFunctions *vtable);
 847 void (*fp_gdk_threads_init)(void);
 848 void (*fp_gdk_threads_enter)(void);
 849 void (*fp_gdk_threads_leave)(void);
 850 
 851 XID (*fp_gdk_x11_drawable_get_xid)(GdkDrawable *drawable);
 852 
 853 gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
 854     guint32 timestamp, GError **error);
 855 
 856 #endif /* !_GTK2_INTERFACE_H */