1 /*
   2  * Copyright (c) 2005, 2015, 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 */
  50     CHECK_BOX,                  /* GtkCheckButton */
  51     CHECK_BOX_MENU_ITEM,        /* GtkCheckMenuItem */
  52     COLOR_CHOOSER,              /* GtkColorSelectionDialog */
  53     COMBO_BOX,                  /* GtkComboBox */
  54     COMBO_BOX_ARROW_BUTTON,     /* GtkComboBoxEntry */
  55     COMBO_BOX_TEXT_FIELD,       /* GtkComboBoxEntry */
  56     DESKTOP_ICON,               /* GtkLabel */
  57     DESKTOP_PANE,               /* GtkContainer */
  58     EDITOR_PANE,                /* GtkTextView */
  59     FORMATTED_TEXT_FIELD,       /* GtkEntry */
  60     HANDLE_BOX,                 /* GtkHandleBox */
  61     HPROGRESS_BAR,              /* GtkProgressBar */
  62     HSCROLL_BAR,                /* GtkHScrollbar */
  63     HSCROLL_BAR_BUTTON_LEFT,    /* GtkHScrollbar */
  64     HSCROLL_BAR_BUTTON_RIGHT,   /* GtkHScrollbar */
  65     HSCROLL_BAR_TRACK,          /* GtkHScrollbar */
  66     HSCROLL_BAR_THUMB,          /* GtkHScrollbar */
  67     HSEPARATOR,                 /* GtkHSeparator */
  68     HSLIDER,                    /* GtkHScale */
  69     HSLIDER_TRACK,              /* GtkHScale */
  70     HSLIDER_THUMB,              /* GtkHScale */
  71     HSPLIT_PANE_DIVIDER,        /* GtkHPaned */
  72     INTERNAL_FRAME,             /* GtkWindow */
  73     INTERNAL_FRAME_TITLE_PANE,  /* GtkLabel */
  74     IMAGE,                      /* GtkImage */
  75     LABEL,                      /* GtkLabel */
  76     LIST,                       /* GtkTreeView */
  77     MENU,                       /* GtkMenu */
  78     MENU_BAR,                   /* GtkMenuBar */
  79     MENU_ITEM,                  /* GtkMenuItem */
  80     MENU_ITEM_ACCELERATOR,      /* GtkLabel */
  81     OPTION_PANE,                /* GtkMessageDialog */
  82     PANEL,                      /* GtkContainer */
  83     PASSWORD_FIELD,             /* GtkEntry */
  84     POPUP_MENU,                 /* GtkMenu */
  85     POPUP_MENU_SEPARATOR,       /* GtkSeparatorMenuItem */
  86     RADIO_BUTTON,               /* GtkRadioButton */
  87     RADIO_BUTTON_MENU_ITEM,     /* GtkRadioMenuItem */
  88     ROOT_PANE,                  /* GtkContainer */
  89     SCROLL_PANE,                /* GtkScrolledWindow */
  90     SPINNER,                    /* GtkSpinButton */
  91     SPINNER_ARROW_BUTTON,       /* GtkSpinButton */
  92     SPINNER_TEXT_FIELD,         /* GtkSpinButton */
  93     SPLIT_PANE,                 /* GtkPaned */
  94     TABBED_PANE,                /* GtkNotebook */
  95     TABBED_PANE_TAB_AREA,       /* GtkNotebook */
  96     TABBED_PANE_CONTENT,        /* GtkNotebook */
  97     TABBED_PANE_TAB,            /* GtkNotebook */
  98     TABLE,                      /* GtkTreeView */
  99     TABLE_HEADER,               /* GtkButton */
 100     TEXT_AREA,                  /* GtkTextView */
 101     TEXT_FIELD,                 /* GtkEntry */
 102     TEXT_PANE,                  /* GtkTextView */
 103     TITLED_BORDER,              /* GtkFrame */
 104     TOGGLE_BUTTON,              /* GtkToggleButton */
 105     TOOL_BAR,                   /* GtkToolbar */
 106     TOOL_BAR_DRAG_WINDOW,       /* GtkToolbar */
 107     TOOL_BAR_SEPARATOR,         /* GtkSeparatorToolItem */
 108     TOOL_TIP,                   /* GtkWindow */
 109     TREE,                       /* GtkTreeView */
 110     TREE_CELL,                  /* GtkTreeView */
 111     VIEWPORT,                   /* GtkViewport */
 112     VPROGRESS_BAR,              /* GtkProgressBar */
 113     VSCROLL_BAR,                /* GtkVScrollbar */
 114     VSCROLL_BAR_BUTTON_UP,      /* GtkVScrollbar */
 115     VSCROLL_BAR_BUTTON_DOWN,    /* GtkVScrollbar */
 116     VSCROLL_BAR_TRACK,          /* GtkVScrollbar */
 117     VSCROLL_BAR_THUMB,          /* GtkVScrollbar */
 118     VSEPARATOR,                 /* GtkVSeparator */
 119     VSLIDER,                    /* GtkVScale */
 120     VSLIDER_TRACK,              /* GtkVScale */
 121     VSLIDER_THUMB,              /* GtkVScale */
 122     VSPLIT_PANE_DIVIDER,        /* GtkVPaned */
 123     WIDGET_TYPE_SIZE
 124 } WidgetType;
 125 
 126 typedef enum _ColorType
 127 {
 128     FOREGROUND,
 129     BACKGROUND,
 130     TEXT_FOREGROUND,
 131     TEXT_BACKGROUND,
 132     FOCUS,
 133     LIGHT,
 134     DARK,
 135     MID,
 136     BLACK,
 137     WHITE
 138 } ColorType;
 139 
 140 typedef enum _Setting
 141 {
 142     GTK_FONT_NAME,
 143     GTK_ICON_SIZES,
 144     GTK_CURSOR_BLINK,
 145     GTK_CURSOR_BLINK_TIME
 146 } Setting;
 147 
 148 /* GTK types, here to eliminate need for GTK headers at compile time */
 149 
 150 #ifndef FALSE
 151 #define FALSE           (0)
 152 #define TRUE            (!FALSE)
 153 #endif
 154 
 155 #define GTK_HAS_FOCUS   (1 << 12)
 156 #define GTK_HAS_DEFAULT (1 << 14)
 157 
 158 
 159 /* basic types */
 160 typedef char    gchar;
 161 typedef short   gshort;
 162 typedef int     gint;
 163 typedef long    glong;
 164 typedef float   gfloat;
 165 typedef double  gdouble;
 166 typedef void*   gpointer;
 167 typedef gint    gboolean;
 168 
 169 typedef signed char  gint8;
 170 typedef signed short gint16;
 171 typedef signed int   gint32;
 172 
 173 typedef unsigned char  guchar;
 174 typedef unsigned char  guint8;
 175 typedef unsigned short gushort;
 176 typedef unsigned short guint16;
 177 typedef unsigned int   guint;
 178 typedef unsigned int   guint32;
 179 typedef unsigned int   gsize;
 180 typedef unsigned long  gulong;
 181 
 182 typedef signed long long   gint64;
 183 typedef unsigned long long guint64;
 184 
 185 /* enumerated constants */
 186 typedef enum
 187 {
 188   GTK_ARROW_UP,
 189   GTK_ARROW_DOWN,
 190   GTK_ARROW_LEFT,
 191   GTK_ARROW_RIGHT
 192 } GtkArrowType;
 193 
 194 typedef enum {
 195   GDK_COLORSPACE_RGB
 196 } GdkColorspace;
 197 
 198 typedef enum
 199 {
 200   GTK_EXPANDER_COLLAPSED,
 201   GTK_EXPANDER_SEMI_COLLAPSED,
 202   GTK_EXPANDER_SEMI_EXPANDED,
 203   GTK_EXPANDER_EXPANDED
 204 } GtkExpanderStyle;
 205 
 206 typedef enum
 207 {
 208   GTK_ICON_SIZE_INVALID,
 209   GTK_ICON_SIZE_MENU,
 210   GTK_ICON_SIZE_SMALL_TOOLBAR,
 211   GTK_ICON_SIZE_LARGE_TOOLBAR,
 212   GTK_ICON_SIZE_BUTTON,
 213   GTK_ICON_SIZE_DND,
 214   GTK_ICON_SIZE_DIALOG
 215 } GtkIconSize;
 216 
 217 typedef enum
 218 {
 219   GTK_ORIENTATION_HORIZONTAL,
 220   GTK_ORIENTATION_VERTICAL
 221 } GtkOrientation;
 222 
 223 typedef enum
 224 {
 225   GTK_POS_LEFT,
 226   GTK_POS_RIGHT,
 227   GTK_POS_TOP,
 228   GTK_POS_BOTTOM
 229 } GtkPositionType;
 230 
 231 typedef enum
 232 {
 233   GTK_SHADOW_NONE,
 234   GTK_SHADOW_IN,
 235   GTK_SHADOW_OUT,
 236   GTK_SHADOW_ETCHED_IN,
 237   GTK_SHADOW_ETCHED_OUT
 238 } GtkShadowType;
 239 
 240 typedef enum
 241 {
 242   GTK_STATE_NORMAL,
 243   GTK_STATE_ACTIVE,
 244   GTK_STATE_PRELIGHT,
 245   GTK_STATE_SELECTED,
 246   GTK_STATE_INSENSITIVE
 247 } GtkStateType;
 248 
 249 typedef enum
 250 {
 251   GTK_TEXT_DIR_NONE,
 252   GTK_TEXT_DIR_LTR,
 253   GTK_TEXT_DIR_RTL
 254 } GtkTextDirection;
 255 
 256 typedef enum
 257 {
 258   GTK_WINDOW_TOPLEVEL,
 259   GTK_WINDOW_POPUP
 260 } GtkWindowType;
 261 
 262 typedef enum
 263 {
 264   G_PARAM_READABLE            = 1 << 0,
 265   G_PARAM_WRITABLE            = 1 << 1,
 266   G_PARAM_CONSTRUCT           = 1 << 2,
 267   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
 268   G_PARAM_LAX_VALIDATION      = 1 << 4,
 269   G_PARAM_PRIVATE             = 1 << 5
 270 } GParamFlags;
 271 
 272 /* We define all structure pointers to be void* */
 273 typedef void GError;
 274 typedef void GMainContext;
 275 typedef void GVfs;
 276 
 277 typedef struct _GSList GSList;
 278 struct _GSList
 279 {
 280   gpointer data;
 281   GSList *next;
 282 };
 283 
 284 typedef void GdkColormap;
 285 typedef void GdkDrawable;
 286 typedef void GdkGC;
 287 typedef void GdkScreen;
 288 typedef void GdkPixbuf;
 289 typedef void GdkPixmap;
 290 typedef void GdkWindow;
 291 
 292 typedef void GtkFixed;
 293 typedef void GtkMenuItem;
 294 typedef void GtkMenuShell;
 295 typedef void GtkWidgetClass;
 296 typedef void PangoFontDescription;
 297 typedef void GtkSettings;
 298 
 299 /* Some real structures */
 300 typedef struct
 301 {
 302   guint32 pixel;
 303   guint16 red;
 304   guint16 green;
 305   guint16 blue;
 306 } GdkColor;
 307 
 308 typedef struct {
 309   gint      fd;
 310   gushort   events;
 311   gushort   revents;
 312 } GPollFD;
 313 
 314 typedef struct {
 315   gint x;
 316   gint y;
 317   gint width;
 318   gint height;
 319 } GdkRectangle;
 320 
 321 typedef struct {
 322   gint x;
 323   gint y;
 324   gint width;
 325   gint height;
 326 } GtkAllocation;
 327 
 328 typedef struct {
 329   gint width;
 330   gint height;
 331 } GtkRequisition;
 332 
 333 typedef struct {
 334   GtkWidgetClass *g_class;
 335 } GTypeInstance;
 336 
 337 typedef struct {
 338   gint left;
 339   gint right;
 340   gint top;
 341   gint bottom;
 342 } GtkBorder;
 343 
 344 /******************************************************
 345  * FIXME: it is more safe to include gtk headers for
 346  * the precise type definition of GType and other
 347  * structures. This is a place where getting rid of gtk
 348  * headers may be dangerous.
 349  ******************************************************/
 350 typedef gulong         GType;
 351 
 352 typedef struct
 353 {
 354   GType         g_type;
 355 
 356   union {
 357     gint        v_int;
 358     guint       v_uint;
 359     glong       v_long;
 360     gulong      v_ulong;
 361     gint64      v_int64;
 362     guint64     v_uint64;
 363     gfloat      v_float;
 364     gdouble     v_double;
 365     gpointer    v_pointer;
 366   } data[2];
 367 } GValue;
 368 
 369 typedef struct
 370 {
 371   GTypeInstance  g_type_instance;
 372 
 373   gchar         *name;
 374   GParamFlags    flags;
 375   GType          value_type;
 376   GType          owner_type;
 377 } GParamSpec;
 378 
 379 typedef struct {
 380   GTypeInstance g_type_instance;
 381   guint         ref_count;
 382   void         *qdata;
 383 } GObject;
 384 
 385 typedef struct {
 386   GObject parent_instance;
 387   guint32 flags;
 388 } GtkObject;
 389 
 390 typedef struct
 391 {
 392   GObject parent_instance;
 393 
 394   GdkColor fg[5];
 395   GdkColor bg[5];
 396   GdkColor light[5];
 397   GdkColor dark[5];
 398   GdkColor mid[5];
 399   GdkColor text[5];
 400   GdkColor base[5];
 401   GdkColor text_aa[5];          /* Halfway between text/base */
 402 
 403   GdkColor black;
 404   GdkColor white;
 405   PangoFontDescription *font_desc;
 406 
 407   gint xthickness;
 408   gint ythickness;
 409 
 410   GdkGC *fg_gc[5];
 411   GdkGC *bg_gc[5];
 412   GdkGC *light_gc[5];
 413   GdkGC *dark_gc[5];
 414   GdkGC *mid_gc[5];
 415   GdkGC *text_gc[5];
 416   GdkGC *base_gc[5];
 417   GdkGC *text_aa_gc[5];
 418   GdkGC *black_gc;
 419   GdkGC *white_gc;
 420 
 421   GdkPixmap *bg_pixmap[5];
 422 } GtkStyle;
 423 
 424 typedef struct _GtkWidget GtkWidget;
 425 struct _GtkWidget
 426 {
 427   GtkObject object;
 428   guint16 private_flags;
 429   guint8 state;
 430   guint8 saved_state;
 431   gchar *name;
 432   GtkStyle *style;
 433   GtkRequisition requisition;
 434   GtkAllocation allocation;
 435   GdkWindow *window;
 436   GtkWidget *parent;
 437 };
 438 
 439 typedef struct
 440 {
 441   GtkWidget widget;
 442 
 443   gfloat xalign;
 444   gfloat yalign;
 445 
 446   guint16 xpad;
 447   guint16 ypad;
 448 } GtkMisc;
 449 
 450 typedef struct {
 451   GtkWidget widget;
 452   GtkWidget *focus_child;
 453   guint border_width : 16;
 454   guint need_resize : 1;
 455   guint resize_mode : 2;
 456   guint reallocate_redraws : 1;
 457   guint has_focus_chain : 1;
 458 } GtkContainer;
 459 
 460 typedef struct {
 461   GtkContainer container;
 462   GtkWidget *child;
 463 } GtkBin;
 464 
 465 typedef struct {
 466   GtkBin bin;
 467   GdkWindow *event_window;
 468   gchar *label_text;
 469   guint activate_timeout;
 470   guint constructed : 1;
 471   guint in_button : 1;
 472   guint button_down : 1;
 473   guint relief : 2;
 474   guint use_underline : 1;
 475   guint use_stock : 1;
 476   guint depressed : 1;
 477   guint depress_on_activate : 1;
 478   guint focus_on_click : 1;
 479 } GtkButton;
 480 
 481 typedef struct {
 482   GtkButton button;
 483   guint active : 1;
 484   guint draw_indicator : 1;
 485   guint inconsistent : 1;
 486 } GtkToggleButton;
 487 
 488 typedef struct _GtkAdjustment GtkAdjustment;
 489 struct _GtkAdjustment
 490 {
 491   GtkObject parent_instance;
 492 
 493   gdouble lower;
 494   gdouble upper;
 495   gdouble value;
 496   gdouble step_increment;
 497   gdouble page_increment;
 498   gdouble page_size;
 499 };
 500 
 501 typedef enum
 502 {
 503   GTK_UPDATE_CONTINUOUS,
 504   GTK_UPDATE_DISCONTINUOUS,
 505   GTK_UPDATE_DELAYED
 506 } GtkUpdateType;
 507 
 508 typedef struct _GtkRange GtkRange;
 509 struct _GtkRange
 510 {
 511   GtkWidget widget;
 512   GtkAdjustment *adjustment;
 513   GtkUpdateType update_policy;
 514   guint inverted : 1;
 515   /*< protected >*/
 516   guint flippable : 1;
 517   guint has_stepper_a : 1;
 518   guint has_stepper_b : 1;
 519   guint has_stepper_c : 1;
 520   guint has_stepper_d : 1;
 521   guint need_recalc : 1;
 522   guint slider_size_fixed : 1;
 523   gint min_slider_size;
 524   GtkOrientation orientation;
 525   GdkRectangle range_rect;
 526   gint slider_start, slider_end;
 527   gint round_digits;
 528   /*< private >*/
 529   guint trough_click_forward : 1;
 530   guint update_pending : 1;
 531   /*GtkRangeLayout * */ void *layout;
 532   /*GtkRangeStepTimer * */ void* timer;
 533   gint slide_initial_slider_position;
 534   gint slide_initial_coordinate;
 535   guint update_timeout_id;
 536   GdkWindow *event_window;
 537 };
 538 
 539 typedef struct _GtkProgressBar       GtkProgressBar;
 540 
 541 typedef enum
 542 {
 543   GTK_PROGRESS_CONTINUOUS,
 544   GTK_PROGRESS_DISCRETE
 545 } GtkProgressBarStyle;
 546 
 547 typedef enum
 548 {
 549   GTK_PROGRESS_LEFT_TO_RIGHT,
 550   GTK_PROGRESS_RIGHT_TO_LEFT,
 551   GTK_PROGRESS_BOTTOM_TO_TOP,
 552   GTK_PROGRESS_TOP_TO_BOTTOM
 553 } GtkProgressBarOrientation;
 554 
 555 typedef struct _GtkProgress       GtkProgress;
 556 
 557 struct _GtkProgress
 558 {
 559   GtkWidget widget;
 560   GtkAdjustment *adjustment;
 561   GdkPixmap     *offscreen_pixmap;
 562   gchar         *format;
 563   gfloat         x_align;
 564   gfloat         y_align;
 565   guint          show_text : 1;
 566   guint          activity_mode : 1;
 567   guint          use_text_format : 1;
 568 };
 569 
 570 struct _GtkProgressBar
 571 {
 572   GtkProgress progress;
 573   GtkProgressBarStyle bar_style;
 574   GtkProgressBarOrientation orientation;
 575   guint blocks;
 576   gint  in_block;
 577   gint  activity_pos;
 578   guint activity_step;
 579   guint activity_blocks;
 580   gdouble pulse_fraction;
 581   guint activity_dir : 1;
 582   guint ellipsize : 3;
 583 };
 584 
 585 typedef enum {
 586   GTK_RESPONSE_NONE = -1,
 587   GTK_RESPONSE_REJECT = -2,
 588   GTK_RESPONSE_ACCEPT = -3,
 589   GTK_RESPONSE_DELETE_EVENT = -4,
 590   GTK_RESPONSE_OK = -5,
 591   GTK_RESPONSE_CANCEL = -6,
 592   GTK_RESPONSE_CLOSE = -7,
 593   GTK_RESPONSE_YES = -8,
 594   GTK_RESPONSE_NO = -9,
 595   GTK_RESPONSE_APPLY = -10,
 596   GTK_RESPONSE_HELP = -11
 597 } GtkResponseType;
 598 
 599 typedef struct _GtkWindow GtkWindow;
 600 
 601 typedef struct _GtkFileChooser GtkFileChooser;
 602 
 603 typedef enum {
 604   GTK_FILE_CHOOSER_ACTION_OPEN,
 605   GTK_FILE_CHOOSER_ACTION_SAVE,
 606   GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
 607   GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
 608 } GtkFileChooserAction;
 609 
 610 typedef struct _GtkFileFilter GtkFileFilter;
 611 
 612 typedef enum {
 613   GTK_FILE_FILTER_FILENAME = 1 << 0,
 614   GTK_FILE_FILTER_URI = 1 << 1,
 615   GTK_FILE_FILTER_DISPLAY_NAME = 1 << 2,
 616   GTK_FILE_FILTER_MIME_TYPE = 1 << 3
 617 } GtkFileFilterFlags;
 618 
 619 typedef struct {
 620   GtkFileFilterFlags contains;
 621   const gchar *filename;
 622   const gchar *uri;
 623   const gchar *display_name;
 624   const gchar *mime_type;
 625 } GtkFileFilterInfo;
 626 
 627 typedef gboolean (*GtkFileFilterFunc)(const GtkFileFilterInfo *filter_info,
 628     gpointer data);
 629 
 630 typedef void (*GDestroyNotify)(gpointer data);
 631 
 632 typedef void (*GCallback)(void);
 633 
 634 typedef struct _GClosure GClosure;
 635 
 636 typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
 637 
 638 typedef enum {
 639   G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1
 640 } GConnectFlags;
 641 
 642 typedef struct _GThreadFunctions GThreadFunctions;
 643 
 644 /*
 645  * Converts java.lang.String object to UTF-8 character string.
 646  */
 647 const char *getStrFor(JNIEnv *env, jstring value);
 648 
 649 /**
 650  * Returns :
 651  * NULL if the GLib library is compatible with the given version, or a string
 652  * describing the version mismatch.
 653  * Please note that the glib_check_version() is available since 2.6,
 654  * so you should use GLIB_CHECK_VERSION macro instead.
 655  */
 656 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
 657                        guint required_micro);
 658 
 659 /**
 660  * Returns :
 661  *  TRUE if the GLib library is compatible with the given version
 662  */
 663 #define GLIB_CHECK_VERSION(major, minor, micro) \
 664     (fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)
 665 
 666 /*
 667  * Check whether the gtk2 library is available and meets the minimum
 668  * version requirement.  If the library is already loaded this method has no
 669  * effect and returns success.
 670  * Returns FALSE on failure and TRUE on success.
 671  */
 672 gboolean gtk2_check_version();
 673 
 674 /**
 675  * Returns :
 676  * NULL if the GTK+ library is compatible with the given version, or a string
 677  * describing the version mismatch.
 678  */
 679 gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor,
 680                        guint required_micro);
 681 /*
 682  * Load the gtk2 library.  If the library is already loaded this method has no
 683  * effect and returns success.
 684  * Returns FALSE on failure and TRUE on success.
 685  */
 686 gboolean gtk2_load(JNIEnv *env);
 687 
 688 /*
 689  * Loads fp_gtk_show_uri function pointer. This initialization is
 690  * separated because the function is required only
 691  * for java.awt.Desktop API. The function relies on initialization in
 692  * gtk2_load, so it must be invoked only after a successful gtk2_load
 693  * invocation
 694  */
 695 gboolean gtk2_show_uri_load(JNIEnv *env);
 696 
 697 /*
 698  * Unload the gtk2 library.  If the library is already unloaded this method has
 699  * no effect and returns success.
 700  * Returns FALSE on failure and TRUE on success.
 701  */
 702 gboolean gtk2_unload();
 703 
 704 void gtk2_paint_arrow(WidgetType widget_type, GtkStateType state_type,
 705         GtkShadowType shadow_type, const gchar *detail,
 706         gint x, gint y, gint width, gint height,
 707         GtkArrowType arrow_type, gboolean fill);
 708 void gtk2_paint_box(WidgetType widget_type, GtkStateType state_type,
 709         GtkShadowType shadow_type, const gchar *detail,
 710         gint x, gint y, gint width, gint height,
 711         gint synth_state, GtkTextDirection dir);
 712 void gtk2_paint_box_gap(WidgetType widget_type, GtkStateType state_type,
 713         GtkShadowType shadow_type, const gchar *detail,
 714         gint x, gint y, gint width, gint height,
 715         GtkPositionType gap_side, gint gap_x, gint gap_width);
 716 void gtk2_paint_check(WidgetType widget_type, gint synth_state,
 717         const gchar *detail, gint x, gint y, gint width, gint height);
 718 void gtk2_paint_diamond(WidgetType widget_type, GtkStateType state_type,
 719         GtkShadowType shadow_type, const gchar *detail,
 720         gint x, gint y, gint width, gint height);
 721 void gtk2_paint_expander(WidgetType widget_type, GtkStateType state_type,
 722         const gchar *detail, gint x, gint y, gint width, gint height,
 723         GtkExpanderStyle expander_style);
 724 void gtk2_paint_extension(WidgetType widget_type, GtkStateType state_type,
 725         GtkShadowType shadow_type, const gchar *detail,
 726         gint x, gint y, gint width, gint height, GtkPositionType gap_side);
 727 void gtk2_paint_flat_box(WidgetType widget_type, GtkStateType state_type,
 728         GtkShadowType shadow_type, const gchar *detail,
 729         gint x, gint y, gint width, gint height, gboolean has_focus);
 730 void gtk2_paint_focus(WidgetType widget_type, GtkStateType state_type,
 731         const char *detail, gint x, gint y, gint width, gint height);
 732 void gtk2_paint_handle(WidgetType widget_type, GtkStateType state_type,
 733         GtkShadowType shadow_type, const gchar *detail,
 734         gint x, gint y, gint width, gint height, GtkOrientation orientation);
 735 void gtk2_paint_hline(WidgetType widget_type, GtkStateType state_type,
 736         const gchar *detail, gint x, gint y, gint width, gint height);
 737 void gtk2_paint_option(WidgetType widget_type, gint synth_state,
 738         const gchar *detail, gint x, gint y, gint width, gint height);
 739 void gtk2_paint_shadow(WidgetType widget_type, GtkStateType state_type,
 740         GtkShadowType shadow_type, const gchar *detail,
 741         gint x, gint y, gint width, gint height,
 742         gint synth_state, GtkTextDirection dir);
 743 void gtk2_paint_slider(WidgetType widget_type, GtkStateType state_type,
 744         GtkShadowType shadow_type, const gchar *detail,
 745         gint x, gint y, gint width, gint height, GtkOrientation orientation);
 746 void gtk2_paint_vline(WidgetType widget_type, GtkStateType state_type,
 747         const gchar *detail, gint x, gint y, gint width, gint height);
 748 void gtk_paint_background(WidgetType widget_type, GtkStateType state_type,
 749         gint x, gint y, gint width, gint height);
 750 
 751 void gtk2_init_painting(JNIEnv *env, gint w, gint h);
 752 gint gtk2_copy_image(gint *dest, gint width, gint height);
 753 
 754 gint gtk2_get_xthickness(JNIEnv *env, WidgetType widget_type);
 755 gint gtk2_get_ythickness(JNIEnv *env, WidgetType widget_type);
 756 gint gtk2_get_color_for_state(JNIEnv *env, WidgetType widget_type,
 757                               GtkStateType state_type, ColorType color_type);
 758 jobject gtk2_get_class_value(JNIEnv *env, WidgetType widget_type, jstring key);
 759 
 760 GdkPixbuf *gtk2_get_stock_icon(gint widget_type, const gchar *stock_id,
 761         GtkIconSize size, GtkTextDirection direction, const char *detail);
 762 GdkPixbuf *gtk2_get_icon(const gchar *filename, gint size);
 763 jstring gtk2_get_pango_font_name(JNIEnv *env, WidgetType widget_type);
 764 
 765 void flush_gtk_event_loop();
 766 
 767 jobject gtk2_get_setting(JNIEnv *env, Setting property);
 768 
 769 void gtk2_set_range_value(WidgetType widget_type, jdouble value,
 770                           jdouble min, jdouble max, jdouble visible);
 771 
 772 void (*fp_g_free)(gpointer mem);
 773 void (*fp_g_object_unref)(gpointer object);
 774 int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 775 guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 776 gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 777 int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 778 int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 779 int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 780 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 781 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
 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);
 802 void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
 803     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
 804     GDestroyNotify notify);
 805 void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
 806     GtkFileFilter *filter);
 807 GType (*fp_gtk_file_chooser_get_type)(void);
 808 GtkFileFilter* (*fp_gtk_file_filter_new)(void);
 809 void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
 810     GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
 811 void (*fp_gtk_file_chooser_set_select_multiple)(
 812     GtkFileChooser *chooser, gboolean select_multiple);
 813 gchar* (*fp_gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
 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 gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 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 gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
 836     guint32 timestamp, GError **error);
 837 
 838 #endif /* !_GTK2_INTERFACE_H */
--- EOF ---