1 /*
   2  * Copyright (c) 2005, 2011, 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 
  46 typedef enum _WidgetType
  47 {
  48     BUTTON,                     /* GtkButton */
  49     CHECK_BOX,                  /* GtkCheckButton */
  50     CHECK_BOX_MENU_ITEM,        /* GtkCheckMenuItem */
  51     COLOR_CHOOSER,              /* GtkColorSelectionDialog */
  52     COMBO_BOX,                  /* GtkComboBox */
  53     COMBO_BOX_ARROW_BUTTON,     /* GtkComboBoxEntry */
  54     COMBO_BOX_TEXT_FIELD,       /* GtkComboBoxEntry */
  55     DESKTOP_ICON,               /* GtkLabel */
  56     DESKTOP_PANE,               /* GtkContainer */
  57     EDITOR_PANE,                /* GtkTextView */
  58     FORMATTED_TEXT_FIELD,       /* GtkEntry */
  59     HANDLE_BOX,                 /* GtkHandleBox */
  60     HPROGRESS_BAR,              /* GtkProgressBar */
  61     HSCROLL_BAR,                /* GtkHScrollbar */
  62     HSCROLL_BAR_BUTTON_LEFT,    /* GtkHScrollbar */
  63     HSCROLL_BAR_BUTTON_RIGHT,   /* GtkHScrollbar */
  64     HSCROLL_BAR_TRACK,          /* GtkHScrollbar */
  65     HSCROLL_BAR_THUMB,          /* GtkHScrollbar */
  66     HSEPARATOR,                 /* GtkHSeparator */
  67     HSLIDER,                    /* GtkHScale */
  68     HSLIDER_TRACK,              /* GtkHScale */
  69     HSLIDER_THUMB,              /* GtkHScale */
  70     HSPLIT_PANE_DIVIDER,        /* GtkHPaned */
  71     INTERNAL_FRAME,             /* GtkWindow */
  72     INTERNAL_FRAME_TITLE_PANE,  /* GtkLabel */
  73     IMAGE,                      /* GtkImage */
  74     LABEL,                      /* GtkLabel */
  75     LIST,                       /* GtkTreeView */
  76     MENU,                       /* GtkMenu */
  77     MENU_BAR,                   /* GtkMenuBar */
  78     MENU_ITEM,                  /* GtkMenuItem */
  79     MENU_ITEM_ACCELERATOR,      /* GtkLabel */
  80     OPTION_PANE,                /* GtkMessageDialog */
  81     PANEL,                      /* GtkContainer */
  82     PASSWORD_FIELD,             /* GtkEntry */
  83     POPUP_MENU,                 /* GtkMenu */
  84     POPUP_MENU_SEPARATOR,       /* GtkSeparatorMenuItem */
  85     RADIO_BUTTON,               /* GtkRadioButton */
  86     RADIO_BUTTON_MENU_ITEM,     /* GtkRadioMenuItem */
  87     ROOT_PANE,                  /* GtkContainer */
  88     SCROLL_PANE,                /* GtkScrolledWindow */
  89     SPINNER,                    /* GtkSpinButton */
  90     SPINNER_ARROW_BUTTON,       /* GtkSpinButton */
  91     SPINNER_TEXT_FIELD,         /* GtkSpinButton */
  92     SPLIT_PANE,                 /* GtkPaned */
  93     TABBED_PANE,                /* GtkNotebook */
  94     TABBED_PANE_TAB_AREA,       /* GtkNotebook */
  95     TABBED_PANE_CONTENT,        /* GtkNotebook */
  96     TABBED_PANE_TAB,            /* GtkNotebook */
  97     TABLE,                      /* GtkTreeView */
  98     TABLE_HEADER,               /* GtkButton */
  99     TEXT_AREA,                  /* GtkTextView */
 100     TEXT_FIELD,                 /* GtkEntry */
 101     TEXT_PANE,                  /* GtkTextView */
 102     TITLED_BORDER,              /* GtkFrame */
 103     TOGGLE_BUTTON,              /* GtkToggleButton */
 104     TOOL_BAR,                   /* GtkToolbar */
 105     TOOL_BAR_DRAG_WINDOW,       /* GtkToolbar */
 106     TOOL_BAR_SEPARATOR,         /* GtkSeparatorToolItem */
 107     TOOL_TIP,                   /* GtkWindow */
 108     TREE,                       /* GtkTreeView */
 109     TREE_CELL,                  /* GtkTreeView */
 110     VIEWPORT,                   /* GtkViewport */
 111     VPROGRESS_BAR,              /* GtkProgressBar */
 112     VSCROLL_BAR,                /* GtkVScrollbar */
 113     VSCROLL_BAR_BUTTON_UP,      /* GtkVScrollbar */
 114     VSCROLL_BAR_BUTTON_DOWN,    /* GtkVScrollbar */
 115     VSCROLL_BAR_TRACK,          /* GtkVScrollbar */
 116     VSCROLL_BAR_THUMB,          /* GtkVScrollbar */
 117     VSEPARATOR,                 /* GtkVSeparator */
 118     VSLIDER,                    /* GtkVScale */
 119     VSLIDER_TRACK,              /* GtkVScale */
 120     VSLIDER_THUMB,              /* GtkVScale */
 121     VSPLIT_PANE_DIVIDER,        /* GtkVPaned */
 122     WIDGET_TYPE_SIZE
 123 } WidgetType;
 124 
 125 typedef enum _ColorType
 126 {
 127     FOREGROUND,
 128     BACKGROUND,
 129     TEXT_FOREGROUND,
 130     TEXT_BACKGROUND,
 131     FOCUS,
 132     LIGHT,
 133     DARK,
 134     MID,
 135     BLACK,
 136     WHITE
 137 } ColorType;
 138 
 139 typedef enum _Setting
 140 {
 141     GTK_FONT_NAME,
 142     GTK_ICON_SIZES
 143 } Setting;
 144 
 145 /* GTK types, here to eliminate need for GTK headers at compile time */
 146 
 147 #ifndef FALSE
 148 #define FALSE           (0)
 149 #define TRUE            (!FALSE)
 150 #endif
 151 
 152 #define GTK_HAS_FOCUS   (1 << 12)
 153 #define GTK_HAS_DEFAULT (1 << 14)
 154 
 155 
 156 /* basic types */
 157 typedef char    gchar;
 158 typedef short   gshort;
 159 typedef int     gint;
 160 typedef long    glong;
 161 typedef float   gfloat;
 162 typedef double  gdouble;
 163 typedef void*   gpointer;
 164 typedef gint    gboolean;
 165 
 166 typedef signed char  gint8;
 167 typedef signed short gint16;
 168 typedef signed int   gint32;
 169 
 170 typedef unsigned char  guchar;
 171 typedef unsigned char  guint8;
 172 typedef unsigned short gushort;
 173 typedef unsigned short guint16;
 174 typedef unsigned int   guint;
 175 typedef unsigned int   guint32;
 176 typedef unsigned int   gsize;
 177 typedef unsigned long  gulong;
 178 
 179 typedef signed long long   gint64;
 180 typedef unsigned long long guint64;
 181 
 182 /* enumerated constants */
 183 typedef enum
 184 {
 185   GTK_ARROW_UP,
 186   GTK_ARROW_DOWN,
 187   GTK_ARROW_LEFT,
 188   GTK_ARROW_RIGHT
 189 } GtkArrowType;
 190 
 191 typedef enum {
 192   GDK_COLORSPACE_RGB
 193 } GdkColorspace;
 194 
 195 typedef enum
 196 {
 197   GTK_EXPANDER_COLLAPSED,
 198   GTK_EXPANDER_SEMI_COLLAPSED,
 199   GTK_EXPANDER_SEMI_EXPANDED,
 200   GTK_EXPANDER_EXPANDED
 201 } GtkExpanderStyle;
 202 
 203 typedef enum
 204 {
 205   GTK_ICON_SIZE_INVALID,
 206   GTK_ICON_SIZE_MENU,
 207   GTK_ICON_SIZE_SMALL_TOOLBAR,
 208   GTK_ICON_SIZE_LARGE_TOOLBAR,
 209   GTK_ICON_SIZE_BUTTON,
 210   GTK_ICON_SIZE_DND,
 211   GTK_ICON_SIZE_DIALOG
 212 } GtkIconSize;
 213 
 214 typedef enum
 215 {
 216   GTK_ORIENTATION_HORIZONTAL,
 217   GTK_ORIENTATION_VERTICAL
 218 } GtkOrientation;
 219 
 220 typedef enum
 221 {
 222   GTK_POS_LEFT,
 223   GTK_POS_RIGHT,
 224   GTK_POS_TOP,
 225   GTK_POS_BOTTOM
 226 } GtkPositionType;
 227 
 228 typedef enum
 229 {
 230   GTK_SHADOW_NONE,
 231   GTK_SHADOW_IN,
 232   GTK_SHADOW_OUT,
 233   GTK_SHADOW_ETCHED_IN,
 234   GTK_SHADOW_ETCHED_OUT
 235 } GtkShadowType;
 236 
 237 typedef enum
 238 {
 239   GTK_STATE_NORMAL,
 240   GTK_STATE_ACTIVE,
 241   GTK_STATE_PRELIGHT,
 242   GTK_STATE_SELECTED,
 243   GTK_STATE_INSENSITIVE
 244 } GtkStateType;
 245 
 246 typedef enum
 247 {
 248   GTK_TEXT_DIR_NONE,
 249   GTK_TEXT_DIR_LTR,
 250   GTK_TEXT_DIR_RTL
 251 } GtkTextDirection;
 252 
 253 typedef enum
 254 {
 255   GTK_WINDOW_TOPLEVEL,
 256   GTK_WINDOW_POPUP
 257 } GtkWindowType;
 258 
 259 typedef enum
 260 {
 261   G_PARAM_READABLE            = 1 << 0,
 262   G_PARAM_WRITABLE            = 1 << 1,
 263   G_PARAM_CONSTRUCT           = 1 << 2,
 264   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
 265   G_PARAM_LAX_VALIDATION      = 1 << 4,
 266   G_PARAM_PRIVATE             = 1 << 5
 267 } GParamFlags;
 268 
 269 /* We define all structure pointers to be void* */
 270 typedef void GError;
 271 typedef void GMainContext;
 272 
 273 typedef struct _GSList GSList;
 274 struct _GSList
 275 {
 276   gpointer data;
 277   GSList *next;
 278 };
 279 
 280 typedef void GdkColormap;
 281 typedef void GdkDrawable;

 282 typedef void GdkGC;
 283 typedef void GdkPixbuf;
 284 typedef void GdkPixmap;
 285 typedef void GdkWindow;
 286 
 287 typedef void GtkFixed;
 288 typedef void GtkMenuItem;
 289 typedef void GtkMenuShell;
 290 typedef void GtkWidgetClass;
 291 typedef void PangoFontDescription;
 292 typedef void GtkSettings;
 293 
 294 /* Some real structures */
 295 typedef struct
 296 {
 297   guint32 pixel;
 298   guint16 red;
 299   guint16 green;
 300   guint16 blue;
 301 } GdkColor;
 302 
 303 typedef struct {
 304   gint      fd;
 305   gushort   events;
 306   gushort   revents;
 307 } GPollFD;
 308 
 309 typedef struct {
 310   gint x;
 311   gint y;
 312   gint width;
 313   gint height;
 314 } GdkRectangle;
 315 
 316 typedef struct {
 317   gint x;
 318   gint y;
 319   gint width;
 320   gint height;
 321 } GtkAllocation;
 322 
 323 typedef struct {
 324   gint width;
 325   gint height;
 326 } GtkRequisition;
 327 
 328 typedef struct {
 329   GtkWidgetClass *g_class;
 330 } GTypeInstance;
 331 
 332 typedef struct {
 333   gint left;
 334   gint right;
 335   gint top;
 336   gint bottom;
 337 } GtkBorder;
 338 
 339 /******************************************************
 340  * FIXME: it is more safe to include gtk headers for
 341  * the precise type definition of GType and other
 342  * structures. This is a place where getting rid of gtk
 343  * headers may be dangerous.
 344  ******************************************************/
 345 typedef gulong         GType;
 346 
 347 typedef struct
 348 {
 349   GType         g_type;
 350 
 351   union {
 352     gint        v_int;
 353     guint       v_uint;
 354     glong       v_long;
 355     gulong      v_ulong;
 356     gint64      v_int64;
 357     guint64     v_uint64;
 358     gfloat      v_float;
 359     gdouble     v_double;
 360     gpointer    v_pointer;
 361   } data[2];
 362 } GValue;
 363 
 364 typedef struct
 365 {
 366   GTypeInstance  g_type_instance;
 367 
 368   gchar         *name;
 369   GParamFlags    flags;
 370   GType          value_type;
 371   GType          owner_type;
 372 } GParamSpec;
 373 
 374 typedef struct {
 375   GTypeInstance g_type_instance;
 376   guint         ref_count;
 377   void         *qdata;
 378 } GObject;
 379 
 380 typedef struct {
 381   GObject parent_instance;
 382   guint32 flags;
 383 } GtkObject;
 384 
 385 typedef struct
 386 {
 387   GObject parent_instance;
 388 
 389   GdkColor fg[5];
 390   GdkColor bg[5];
 391   GdkColor light[5];
 392   GdkColor dark[5];
 393   GdkColor mid[5];
 394   GdkColor text[5];
 395   GdkColor base[5];
 396   GdkColor text_aa[5];          /* Halfway between text/base */
 397 
 398   GdkColor black;
 399   GdkColor white;
 400   PangoFontDescription *font_desc;
 401 
 402   gint xthickness;
 403   gint ythickness;
 404 
 405   GdkGC *fg_gc[5];
 406   GdkGC *bg_gc[5];
 407   GdkGC *light_gc[5];
 408   GdkGC *dark_gc[5];
 409   GdkGC *mid_gc[5];
 410   GdkGC *text_gc[5];
 411   GdkGC *base_gc[5];
 412   GdkGC *text_aa_gc[5];
 413   GdkGC *black_gc;
 414   GdkGC *white_gc;
 415 
 416   GdkPixmap *bg_pixmap[5];
 417 } GtkStyle;
 418 
 419 typedef struct _GtkWidget GtkWidget;
 420 struct _GtkWidget
 421 {
 422   GtkObject object;
 423   guint16 private_flags;
 424   guint8 state;
 425   guint8 saved_state;
 426   gchar *name;
 427   GtkStyle *style;
 428   GtkRequisition requisition;
 429   GtkAllocation allocation;
 430   GdkWindow *window;
 431   GtkWidget *parent;
 432 };
 433 
 434 typedef struct
 435 {
 436   GtkWidget widget;
 437 
 438   gfloat xalign;
 439   gfloat yalign;
 440 
 441   guint16 xpad;
 442   guint16 ypad;
 443 } GtkMisc;
 444 
 445 typedef struct {
 446   GtkWidget widget;
 447   GtkWidget *focus_child;
 448   guint border_width : 16;
 449   guint need_resize : 1;
 450   guint resize_mode : 2;
 451   guint reallocate_redraws : 1;
 452   guint has_focus_chain : 1;
 453 } GtkContainer;
 454 
 455 typedef struct {
 456   GtkContainer container;
 457   GtkWidget *child;
 458 } GtkBin;
 459 
 460 typedef struct {
 461   GtkBin bin;
 462   GdkWindow *event_window;
 463   gchar *label_text;
 464   guint activate_timeout;
 465   guint constructed : 1;
 466   guint in_button : 1;
 467   guint button_down : 1;
 468   guint relief : 2;
 469   guint use_underline : 1;
 470   guint use_stock : 1;
 471   guint depressed : 1;
 472   guint depress_on_activate : 1;
 473   guint focus_on_click : 1;
 474 } GtkButton;
 475 
 476 typedef struct {
 477   GtkButton button;
 478   guint active : 1;
 479   guint draw_indicator : 1;
 480   guint inconsistent : 1;
 481 } GtkToggleButton;
 482 
 483 typedef struct _GtkAdjustment GtkAdjustment;
 484 struct _GtkAdjustment
 485 {
 486   GtkObject parent_instance;
 487 
 488   gdouble lower;
 489   gdouble upper;
 490   gdouble value;
 491   gdouble step_increment;
 492   gdouble page_increment;
 493   gdouble page_size;
 494 };
 495 
 496 typedef enum
 497 {
 498   GTK_UPDATE_CONTINUOUS,
 499   GTK_UPDATE_DISCONTINUOUS,
 500   GTK_UPDATE_DELAYED
 501 } GtkUpdateType;
 502 
 503 typedef struct _GtkRange GtkRange;
 504 struct _GtkRange
 505 {
 506   GtkWidget widget;
 507   GtkAdjustment *adjustment;
 508   GtkUpdateType update_policy;
 509   guint inverted : 1;
 510   /*< protected >*/
 511   guint flippable : 1;
 512   guint has_stepper_a : 1;
 513   guint has_stepper_b : 1;
 514   guint has_stepper_c : 1;
 515   guint has_stepper_d : 1;
 516   guint need_recalc : 1;
 517   guint slider_size_fixed : 1;
 518   gint min_slider_size;
 519   GtkOrientation orientation;
 520   GdkRectangle range_rect;
 521   gint slider_start, slider_end;
 522   gint round_digits;
 523   /*< private >*/
 524   guint trough_click_forward : 1;
 525   guint update_pending : 1;
 526   /*GtkRangeLayout * */ void *layout;
 527   /*GtkRangeStepTimer * */ void* timer;
 528   gint slide_initial_slider_position;
 529   gint slide_initial_coordinate;
 530   guint update_timeout_id;
 531   GdkWindow *event_window;
 532 };
 533 
 534 typedef struct _GtkProgressBar       GtkProgressBar;
 535 
 536 typedef enum
 537 {
 538   GTK_PROGRESS_CONTINUOUS,
 539   GTK_PROGRESS_DISCRETE
 540 } GtkProgressBarStyle;
 541 
 542 typedef enum
 543 {
 544   GTK_PROGRESS_LEFT_TO_RIGHT,
 545   GTK_PROGRESS_RIGHT_TO_LEFT,
 546   GTK_PROGRESS_BOTTOM_TO_TOP,
 547   GTK_PROGRESS_TOP_TO_BOTTOM
 548 } GtkProgressBarOrientation;
 549 
 550 typedef struct _GtkProgress       GtkProgress;
 551 
 552 struct _GtkProgress
 553 {
 554   GtkWidget widget;
 555   GtkAdjustment *adjustment;
 556   GdkPixmap     *offscreen_pixmap;
 557   gchar         *format;
 558   gfloat         x_align;
 559   gfloat         y_align;
 560   guint          show_text : 1;
 561   guint          activity_mode : 1;
 562   guint          use_text_format : 1;
 563 };
 564 
 565 struct _GtkProgressBar
 566 {
 567   GtkProgress progress;
 568   GtkProgressBarStyle bar_style;
 569   GtkProgressBarOrientation orientation;
 570   guint blocks;
 571   gint  in_block;
 572   gint  activity_pos;
 573   guint activity_step;
 574   guint activity_blocks;
 575   gdouble pulse_fraction;
 576   guint activity_dir : 1;
 577   guint ellipsize : 3;
 578 };
 579 
 580 typedef enum {
 581   GTK_RESPONSE_NONE = -1,
 582   GTK_RESPONSE_REJECT = -2,
 583   GTK_RESPONSE_ACCEPT = -3,
 584   GTK_RESPONSE_DELETE_EVENT = -4,
 585   GTK_RESPONSE_OK = -5,
 586   GTK_RESPONSE_CANCEL = -6,
 587   GTK_RESPONSE_CLOSE = -7,
 588   GTK_RESPONSE_YES = -8,
 589   GTK_RESPONSE_NO = -9,
 590   GTK_RESPONSE_APPLY = -10,
 591   GTK_RESPONSE_HELP = -11
 592 } GtkResponseType;
 593 
 594 typedef struct _GtkWindow GtkWindow;
 595 
 596 typedef struct _GtkFileChooser GtkFileChooser;
 597 
 598 typedef enum {
 599   GTK_FILE_CHOOSER_ACTION_OPEN,
 600   GTK_FILE_CHOOSER_ACTION_SAVE,
 601   GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
 602   GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
 603 } GtkFileChooserAction;
 604 
 605 typedef struct _GtkFileFilter GtkFileFilter;
 606 
 607 typedef enum {
 608   GTK_FILE_FILTER_FILENAME = 1 << 0,
 609   GTK_FILE_FILTER_URI = 1 << 1,
 610   GTK_FILE_FILTER_DISPLAY_NAME = 1 << 2,
 611   GTK_FILE_FILTER_MIME_TYPE = 1 << 3
 612 } GtkFileFilterFlags;
 613 
 614 typedef struct {
 615   GtkFileFilterFlags contains;
 616   const gchar *filename;
 617   const gchar *uri;
 618   const gchar *display_name;
 619   const gchar *mime_type;
 620 } GtkFileFilterInfo;
 621 
 622 typedef gboolean (*GtkFileFilterFunc)(const GtkFileFilterInfo *filter_info,
 623     gpointer data);
 624 
 625 typedef void (*GDestroyNotify)(gpointer data);
 626 
 627 typedef void (*GCallback)(void);
 628 
 629 typedef struct _GClosure GClosure;
 630 
 631 typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
 632 
 633 typedef enum {
 634   G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1
 635 } GConnectFlags;
 636 
 637 typedef struct _GThreadFunctions GThreadFunctions;
 638 
 639 /*
 640  * Converts java.lang.String object to UTF-8 character string.
 641  */
 642 const char *getStrFor(JNIEnv *env, jstring value);
 643 
 644 /*
 645  * Check whether the gtk2 library is available and meets the minimum
 646  * version requirement.  If the library is already loaded this method has no
 647  * effect and returns success.
 648  * Returns FALSE on failure and TRUE on success.
 649  */
 650 gboolean gtk2_check_version();
 651 
 652 /**
 653  * Returns :
 654  * NULL if the GTK+ library is compatible with the given version, or a string
 655  * describing the version mismatch.
 656  */
 657 gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor,
 658                        guint required_micro);
 659 /*
 660  * Load the gtk2 library.  If the library is already loaded this method has no
 661  * effect and returns success.
 662  * Returns FALSE on failure and TRUE on success.
 663  */
 664 gboolean gtk2_load();
 665 
 666 /*
 667  * Unload the gtk2 library.  If the library is already unloaded this method has
 668  * no effect and returns success.
 669  * Returns FALSE on failure and TRUE on success.
 670  */
 671 gboolean gtk2_unload();
 672 
 673 void gtk2_paint_arrow(WidgetType widget_type, GtkStateType state_type,
 674         GtkShadowType shadow_type, const gchar *detail,
 675         gint x, gint y, gint width, gint height,
 676         GtkArrowType arrow_type, gboolean fill);
 677 void gtk2_paint_box(WidgetType widget_type, GtkStateType state_type,
 678         GtkShadowType shadow_type, const gchar *detail,
 679         gint x, gint y, gint width, gint height,
 680         gint synth_state, GtkTextDirection dir);
 681 void gtk2_paint_box_gap(WidgetType widget_type, GtkStateType state_type,
 682         GtkShadowType shadow_type, const gchar *detail,
 683         gint x, gint y, gint width, gint height,
 684         GtkPositionType gap_side, gint gap_x, gint gap_width);
 685 void gtk2_paint_check(WidgetType widget_type, gint synth_state,
 686         const gchar *detail, gint x, gint y, gint width, gint height);
 687 void gtk2_paint_diamond(WidgetType widget_type, GtkStateType state_type,
 688         GtkShadowType shadow_type, const gchar *detail,
 689         gint x, gint y, gint width, gint height);
 690 void gtk2_paint_expander(WidgetType widget_type, GtkStateType state_type,
 691         const gchar *detail, gint x, gint y, gint width, gint height,
 692         GtkExpanderStyle expander_style);
 693 void gtk2_paint_extension(WidgetType widget_type, GtkStateType state_type,
 694         GtkShadowType shadow_type, const gchar *detail,
 695         gint x, gint y, gint width, gint height, GtkPositionType gap_side);
 696 void gtk2_paint_flat_box(WidgetType widget_type, GtkStateType state_type,
 697         GtkShadowType shadow_type, const gchar *detail,
 698         gint x, gint y, gint width, gint height, gboolean has_focus);
 699 void gtk2_paint_focus(WidgetType widget_type, GtkStateType state_type,
 700         const char *detail, gint x, gint y, gint width, gint height);
 701 void gtk2_paint_handle(WidgetType widget_type, GtkStateType state_type,
 702         GtkShadowType shadow_type, const gchar *detail,
 703         gint x, gint y, gint width, gint height, GtkOrientation orientation);
 704 void gtk2_paint_hline(WidgetType widget_type, GtkStateType state_type,
 705         const gchar *detail, gint x, gint y, gint width, gint height);
 706 void gtk2_paint_option(WidgetType widget_type, gint synth_state,
 707         const gchar *detail, gint x, gint y, gint width, gint height);
 708 void gtk2_paint_shadow(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_slider(WidgetType widget_type, GtkStateType state_type,
 713         GtkShadowType shadow_type, const gchar *detail,
 714         gint x, gint y, gint width, gint height, GtkOrientation orientation);
 715 void gtk2_paint_vline(WidgetType widget_type, GtkStateType state_type,
 716         const gchar *detail, gint x, gint y, gint width, gint height);
 717 void gtk_paint_background(WidgetType widget_type, GtkStateType state_type,
 718         gint x, gint y, gint width, gint height);
 719 
 720 void gtk2_init_painting(JNIEnv *env, gint w, gint h);
 721 gint gtk2_copy_image(gint *dest, gint width, gint height);
 722 
 723 gint gtk2_get_xthickness(JNIEnv *env, WidgetType widget_type);
 724 gint gtk2_get_ythickness(JNIEnv *env, WidgetType widget_type);
 725 gint gtk2_get_color_for_state(JNIEnv *env, WidgetType widget_type,
 726                               GtkStateType state_type, ColorType color_type);
 727 jobject gtk2_get_class_value(JNIEnv *env, WidgetType widget_type, jstring key);
 728 
 729 GdkPixbuf *gtk2_get_stock_icon(gint widget_type, const gchar *stock_id,
 730         GtkIconSize size, GtkTextDirection direction, const char *detail);
 731 GdkPixbuf *gtk2_get_icon(const gchar *filename, gint size);
 732 jstring gtk2_get_pango_font_name(JNIEnv *env, WidgetType widget_type);
 733 
 734 void flush_gtk_event_loop();
 735 
 736 jobject gtk2_get_setting(JNIEnv *env, Setting property);
 737 
 738 void gtk2_set_range_value(WidgetType widget_type, jdouble value,
 739                           jdouble min, jdouble max, jdouble visible);
 740 
 741 void (*fp_g_free)(gpointer mem);
 742 void (*fp_g_object_unref)(gpointer object);
 743 int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 744 guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 745 gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 746 int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 747 int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 748 int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 749 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 750 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
 751 void (*fp_gtk_widget_destroy)(GtkWidget *widget);
 752 void (*fp_gtk_window_present)(GtkWindow *window);
 753 void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
 754 void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
 755 
 756 /**
 757  * Function Pointers for GtkFileChooser
 758  */
 759 gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
 760 void (*fp_gtk_widget_hide)(GtkWidget *widget);
 761 void (*fp_gtk_main_quit)(void);
 762 GtkWidget* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
 763     GtkWindow *parent, GtkFileChooserAction action,
 764     const gchar *first_button_text, ...);
 765 gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
 766     const gchar *filename);
 767 gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
 768     const char *filename);
 769 void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
 770     const gchar *name);
 771 void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
 772     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
 773     GDestroyNotify notify);
 774 void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
 775     GtkFileFilter *filter);
 776 GType (*fp_gtk_file_chooser_get_type)(void);
 777 GtkFileFilter* (*fp_gtk_file_filter_new)(void);
 778 void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
 779     GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
 780 void (*fp_gtk_file_chooser_set_select_multiple)(
 781     GtkFileChooser *chooser, gboolean select_multiple);
 782 gchar* (*fp_gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
 783 GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
 784 guint (*fp_gtk_g_slist_length)(GSList *list);
 785 gulong (*fp_g_signal_connect_data)(gpointer instance,
 786     const gchar *detailed_signal, GCallback c_handler, gpointer data,
 787     GClosureNotify destroy_data, GConnectFlags connect_flags);
 788 void (*fp_gtk_widget_show)(GtkWidget *widget);
 789 void (*fp_gtk_main)(void);
 790 guint (*fp_gtk_main_level)(void);
 791 
 792 
 793 void (*fp_g_thread_init)(GThreadFunctions *vtable);
 794 void (*fp_gdk_threads_init)(void);
 795 void (*fp_gdk_threads_enter)(void);
 796 void (*fp_gdk_threads_leave)(void);
 797 



 798 #endif /* !_GTK2_INTERFACE_H */
--- EOF ---