Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/awt/gtk2_interface.h
32287 views
/*1* Copyright (c) 2005, 2018, 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*/24#ifndef _GTK2_INTERFACE_H25#define _GTK2_INTERFACE_H2627#include <stdlib.h>28#include <jni.h>29#include "gtk_interface.h"3031#define GTK_HAS_FOCUS (1 << 12)32#define GTK_HAS_DEFAULT (1 << 14)3334typedef enum35{36GTK_WINDOW_TOPLEVEL,37GTK_WINDOW_POPUP38} GtkWindowType;3940typedef enum41{42G_PARAM_READABLE = 1 << 0,43G_PARAM_WRITABLE = 1 << 1,44G_PARAM_CONSTRUCT = 1 << 2,45G_PARAM_CONSTRUCT_ONLY = 1 << 3,46G_PARAM_LAX_VALIDATION = 1 << 4,47G_PARAM_PRIVATE = 1 << 548} GParamFlags;4950/* We define all structure pointers to be void* */51typedef void GMainContext;52typedef void GVfs;5354typedef void GdkColormap;55typedef void GdkDrawable;56typedef void GdkGC;57typedef void GdkPixbuf;58typedef void GdkPixmap;5960typedef void GtkFixed;61typedef void GtkMenuItem;62typedef void GtkMenuShell;63typedef void GtkWidgetClass;64typedef void PangoFontDescription;65typedef void GtkSettings;6667/* Some real structures */68typedef struct69{70guint32 pixel;71guint16 red;72guint16 green;73guint16 blue;74} GdkColor;7576typedef struct {77gint fd;78gushort events;79gushort revents;80} GPollFD;8182typedef struct {83gint x;84gint y;85gint width;86gint height;87} GdkRectangle;8889typedef struct {90gint x;91gint y;92gint width;93gint height;94} GtkAllocation;9596typedef struct {97gint width;98gint height;99} GtkRequisition;100101typedef struct {102GtkWidgetClass *g_class;103} GTypeInstance;104105typedef struct {106gint left;107gint right;108gint top;109gint bottom;110} GtkBorder;111112/******************************************************113* FIXME: it is more safe to include gtk headers for114* the precise type definition of GType and other115* structures. This is a place where getting rid of gtk116* headers may be dangerous.117******************************************************/118119typedef struct120{121GType g_type;122123union {124gint v_int;125guint v_uint;126glong v_long;127gulong v_ulong;128gint64 v_int64;129guint64 v_uint64;130gfloat v_float;131gdouble v_double;132gpointer v_pointer;133} data[2];134} GValue;135136typedef struct137{138GTypeInstance g_type_instance;139140gchar *name;141GParamFlags flags;142GType value_type;143GType owner_type;144} GParamSpec;145146typedef struct {147GTypeInstance g_type_instance;148guint ref_count;149void *qdata;150} GObject;151152typedef struct {153GObject parent_instance;154guint32 flags;155} GtkObject;156157typedef struct158{159GObject parent_instance;160161GdkColor fg[5];162GdkColor bg[5];163GdkColor light[5];164GdkColor dark[5];165GdkColor mid[5];166GdkColor text[5];167GdkColor base[5];168GdkColor text_aa[5]; /* Halfway between text/base */169170GdkColor black;171GdkColor white;172PangoFontDescription *font_desc;173174gint xthickness;175gint ythickness;176177GdkGC *fg_gc[5];178GdkGC *bg_gc[5];179GdkGC *light_gc[5];180GdkGC *dark_gc[5];181GdkGC *mid_gc[5];182GdkGC *text_gc[5];183GdkGC *base_gc[5];184GdkGC *text_aa_gc[5];185GdkGC *black_gc;186GdkGC *white_gc;187188GdkPixmap *bg_pixmap[5];189} GtkStyle;190191typedef struct _GtkWidget GtkWidget;192struct _GtkWidget193{194GtkObject object;195guint16 private_flags;196guint8 state;197guint8 saved_state;198gchar *name;199GtkStyle *style;200GtkRequisition requisition;201GtkAllocation allocation;202GdkWindow *window;203GtkWidget *parent;204};205206typedef struct207{208GtkWidget widget;209210gfloat xalign;211gfloat yalign;212213guint16 xpad;214guint16 ypad;215} GtkMisc;216217typedef struct {218GtkWidget widget;219GtkWidget *focus_child;220guint border_width : 16;221guint need_resize : 1;222guint resize_mode : 2;223guint reallocate_redraws : 1;224guint has_focus_chain : 1;225} GtkContainer;226227typedef struct {228GtkContainer container;229GtkWidget *child;230} GtkBin;231232typedef struct {233GtkBin bin;234GdkWindow *event_window;235gchar *label_text;236guint activate_timeout;237guint constructed : 1;238guint in_button : 1;239guint button_down : 1;240guint relief : 2;241guint use_underline : 1;242guint use_stock : 1;243guint depressed : 1;244guint depress_on_activate : 1;245guint focus_on_click : 1;246} GtkButton;247248typedef struct {249GtkButton button;250guint active : 1;251guint draw_indicator : 1;252guint inconsistent : 1;253} GtkToggleButton;254255typedef struct _GtkAdjustment GtkAdjustment;256struct _GtkAdjustment257{258GtkObject parent_instance;259260gdouble lower;261gdouble upper;262gdouble value;263gdouble step_increment;264gdouble page_increment;265gdouble page_size;266};267268typedef enum269{270GTK_UPDATE_CONTINUOUS,271GTK_UPDATE_DISCONTINUOUS,272GTK_UPDATE_DELAYED273} GtkUpdateType;274275typedef struct _GtkRange GtkRange;276struct _GtkRange277{278GtkWidget widget;279GtkAdjustment *adjustment;280GtkUpdateType update_policy;281guint inverted : 1;282/*< protected >*/283guint flippable : 1;284guint has_stepper_a : 1;285guint has_stepper_b : 1;286guint has_stepper_c : 1;287guint has_stepper_d : 1;288guint need_recalc : 1;289guint slider_size_fixed : 1;290gint min_slider_size;291GtkOrientation orientation;292GdkRectangle range_rect;293gint slider_start, slider_end;294gint round_digits;295/*< private >*/296guint trough_click_forward : 1;297guint update_pending : 1;298/*GtkRangeLayout * */ void *layout;299/*GtkRangeStepTimer * */ void* timer;300gint slide_initial_slider_position;301gint slide_initial_coordinate;302guint update_timeout_id;303GdkWindow *event_window;304};305306typedef struct _GtkProgressBar GtkProgressBar;307308typedef enum309{310GTK_PROGRESS_CONTINUOUS,311GTK_PROGRESS_DISCRETE312} GtkProgressBarStyle;313314typedef enum315{316GTK_PROGRESS_LEFT_TO_RIGHT,317GTK_PROGRESS_RIGHT_TO_LEFT,318GTK_PROGRESS_BOTTOM_TO_TOP,319GTK_PROGRESS_TOP_TO_BOTTOM320} GtkProgressBarOrientation;321322typedef struct _GtkProgress GtkProgress;323324struct _GtkProgress325{326GtkWidget widget;327GtkAdjustment *adjustment;328GdkPixmap *offscreen_pixmap;329gchar *format;330gfloat x_align;331gfloat y_align;332guint show_text : 1;333guint activity_mode : 1;334guint use_text_format : 1;335};336337struct _GtkProgressBar338{339GtkProgress progress;340GtkProgressBarStyle bar_style;341GtkProgressBarOrientation orientation;342guint blocks;343gint in_block;344gint activity_pos;345guint activity_step;346guint activity_blocks;347gdouble pulse_fraction;348guint activity_dir : 1;349guint ellipsize : 3;350};351352/**353* Returns :354* NULL if the GLib library is compatible with the given version, or a string355* describing the version mismatch.356* Please note that the glib_check_version() is available since 2.6,357* so you should use GLIB_CHECK_VERSION macro instead.358*/359static gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,360guint required_micro);361362/**363* Returns :364* TRUE if the GLib library is compatible with the given version365*/366#define GLIB_CHECK_VERSION(major, minor, micro) \367(fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)368369/**370* Returns :371* NULL if the GTK+ library is compatible with the given version, or a string372* describing the version mismatch.373*/374static gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor,375guint required_micro);376377static void gtk2_init(GtkApi* gtk);378static void (*fp_g_free)(gpointer mem);379static void (*fp_g_object_unref)(gpointer object);380381static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);382static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);383static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);384static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);385static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);386static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);387static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);388static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);389390static void (*fp_gtk_widget_destroy)(void *widget);391static void (*fp_gtk_window_present)(GtkWindow *window);392static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);393static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);394395/**396* Function Pointers for GtkFileChooser397*/398static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);399static void (*fp_gtk_widget_hide)(void *widget);400static void (*fp_gtk_main_quit)(void);401static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,402GtkWindow *parent, GtkFileChooserAction action,403const gchar *first_button_text, ...);404static gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,405const gchar *filename);406static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,407const char *filename);408static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,409const gchar *name);410static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,411GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,412GDestroyNotify notify);413static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,414GtkFileFilter *filter);415static GType (*fp_gtk_file_chooser_get_type)(void);416static GtkFileFilter* (*fp_gtk_file_filter_new)(void);417static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(418GtkFileChooser *chooser, gboolean do_overwrite_confirmation);419static void (*fp_gtk_file_chooser_set_select_multiple)(420GtkFileChooser *chooser, gboolean select_multiple);421static gchar* (*fp_gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);422static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);423static guint (*fp_gtk_g_slist_length)(GSList *list);424static gulong (*fp_g_signal_connect_data)(gpointer instance,425const gchar *detailed_signal, GCallback c_handler, gpointer data,426GClosureNotify destroy_data, GConnectFlags connect_flags);427static void (*fp_gtk_widget_show)(void *widget);428static void (*fp_gtk_main)(void);429static guint (*fp_gtk_main_level)(void);430static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);431432static GList* (*fp_g_list_append) (GList *list, gpointer data);433static void (*fp_g_list_free) (GList *list);434static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);435436static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,437guint32 timestamp, GError **error);438439#endif /* !_GTK2_INTERFACE_H */440441442