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 */ 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 } Setting; 145 146 /* GTK types, here to eliminate need for GTK headers at compile time */ 147 148 #ifndef FALSE 149 #define FALSE (0) 150 #define TRUE (!FALSE) 151 #endif 152 153 #define GTK_HAS_FOCUS (1 << 12) 154 #define GTK_HAS_DEFAULT (1 << 14) 155 156 157 /* basic types */ 158 typedef char gchar; 159 typedef short gshort; 160 typedef int gint; 161 typedef long glong; 162 typedef float gfloat; 163 typedef double gdouble; 164 typedef void* gpointer; 165 typedef gint gboolean; 166 167 typedef signed char gint8; 168 typedef signed short gint16; 169 typedef signed int gint32; 170 171 typedef unsigned char guchar; 172 typedef unsigned char guint8; 173 typedef unsigned short gushort; 174 typedef unsigned short guint16; 175 typedef unsigned int guint; 176 typedef unsigned int guint32; 177 typedef unsigned int gsize; 178 typedef unsigned long gulong; 179 180 typedef signed long long gint64; 181 typedef unsigned long long guint64; 182 183 /* enumerated constants */ 184 typedef enum 185 { 186 GTK_ARROW_UP, 187 GTK_ARROW_DOWN, 188 GTK_ARROW_LEFT, 189 GTK_ARROW_RIGHT 190 } GtkArrowType; 191 192 typedef enum { 193 GDK_COLORSPACE_RGB 194 } GdkColorspace; 195 196 typedef enum 197 { 198 GTK_EXPANDER_COLLAPSED, 199 GTK_EXPANDER_SEMI_COLLAPSED, 200 GTK_EXPANDER_SEMI_EXPANDED, 201 GTK_EXPANDER_EXPANDED 202 } GtkExpanderStyle; 203 204 typedef enum 205 { 206 GTK_ICON_SIZE_INVALID, 207 GTK_ICON_SIZE_MENU, 208 GTK_ICON_SIZE_SMALL_TOOLBAR, 209 GTK_ICON_SIZE_LARGE_TOOLBAR, 210 GTK_ICON_SIZE_BUTTON, 211 GTK_ICON_SIZE_DND, 212 GTK_ICON_SIZE_DIALOG 213 } GtkIconSize; 214 215 typedef enum 216 { 217 GTK_ORIENTATION_HORIZONTAL, 218 GTK_ORIENTATION_VERTICAL 219 } GtkOrientation; 220 221 typedef enum 222 { 223 GTK_POS_LEFT, 224 GTK_POS_RIGHT, 225 GTK_POS_TOP, 226 GTK_POS_BOTTOM 227 } GtkPositionType; 228 229 typedef enum 230 { 231 GTK_SHADOW_NONE, 232 GTK_SHADOW_IN, 233 GTK_SHADOW_OUT, 234 GTK_SHADOW_ETCHED_IN, 235 GTK_SHADOW_ETCHED_OUT 236 } GtkShadowType; 237 238 typedef enum 239 { 240 GTK_STATE_NORMAL, 241 GTK_STATE_ACTIVE, 242 GTK_STATE_PRELIGHT, 243 GTK_STATE_SELECTED, 244 GTK_STATE_INSENSITIVE 245 } GtkStateType; 246 247 typedef enum 248 { 249 GTK_TEXT_DIR_NONE, 250 GTK_TEXT_DIR_LTR, 251 GTK_TEXT_DIR_RTL 252 } GtkTextDirection; 253 254 typedef enum 255 { 256 GTK_WINDOW_TOPLEVEL, 257 GTK_WINDOW_POPUP 258 } GtkWindowType; 259 260 typedef enum 261 { 262 G_PARAM_READABLE = 1 << 0, 263 G_PARAM_WRITABLE = 1 << 1, 264 G_PARAM_CONSTRUCT = 1 << 2, 265 G_PARAM_CONSTRUCT_ONLY = 1 << 3, 266 G_PARAM_LAX_VALIDATION = 1 << 4, 267 G_PARAM_PRIVATE = 1 << 5 268 } GParamFlags; 269 270 /* We define all structure pointers to be void* */ 271 typedef void GError; 272 typedef void GMainContext; 273 typedef void GVfs; 274 275 typedef struct _GSList GSList; 276 struct _GSList 277 { 278 gpointer data; 279 GSList *next; 280 }; 281 282 typedef void GdkColormap; 283 typedef void GdkDrawable; 284 typedef void GdkGC; 285 typedef void GdkScreen; 286 typedef void GdkPixbuf; 287 typedef void GdkPixmap; 288 typedef void GdkWindow; 289 290 typedef void GtkFixed; 291 typedef void GtkMenuItem; 292 typedef void GtkMenuShell; 293 typedef void GtkWidgetClass; 294 typedef void PangoFontDescription; 295 typedef void GtkSettings; 296 297 /* Some real structures */ 298 typedef struct 299 { 300 guint32 pixel; 301 guint16 red; 302 guint16 green; 303 guint16 blue; 304 } GdkColor; 305 306 typedef struct { 307 gint fd; 308 gushort events; 309 gushort revents; 310 } GPollFD; 311 312 typedef struct { 313 gint x; 314 gint y; 315 gint width; 316 gint height; 317 } GdkRectangle; 318 319 typedef struct { 320 gint x; 321 gint y; 322 gint width; 323 gint height; 324 } GtkAllocation; 325 326 typedef struct { 327 gint width; 328 gint height; 329 } GtkRequisition; 330 331 typedef struct { 332 GtkWidgetClass *g_class; 333 } GTypeInstance; 334 335 typedef struct { 336 gint left; 337 gint right; 338 gint top; 339 gint bottom; 340 } GtkBorder; 341 342 /****************************************************** 343 * FIXME: it is more safe to include gtk headers for 344 * the precise type definition of GType and other 345 * structures. This is a place where getting rid of gtk 346 * headers may be dangerous. 347 ******************************************************/ 348 typedef gulong GType; 349 350 typedef struct 351 { 352 GType g_type; 353 354 union { 355 gint v_int; 356 guint v_uint; 357 glong v_long; 358 gulong v_ulong; 359 gint64 v_int64; 360 guint64 v_uint64; 361 gfloat v_float; 362 gdouble v_double; 363 gpointer v_pointer; 364 } data[2]; 365 } GValue; 366 367 typedef struct 368 { 369 GTypeInstance g_type_instance; 370 371 gchar *name; 372 GParamFlags flags; 373 GType value_type; 374 GType owner_type; 375 } GParamSpec; 376 377 typedef struct { 378 GTypeInstance g_type_instance; 379 guint ref_count; 380 void *qdata; 381 } GObject; 382 383 typedef struct { 384 GObject parent_instance; 385 guint32 flags; 386 } GtkObject; 387 388 typedef struct 389 { 390 GObject parent_instance; 391 392 GdkColor fg[5]; 393 GdkColor bg[5]; 394 GdkColor light[5]; 395 GdkColor dark[5]; 396 GdkColor mid[5]; 397 GdkColor text[5]; 398 GdkColor base[5]; 399 GdkColor text_aa[5]; /* Halfway between text/base */ 400 401 GdkColor black; 402 GdkColor white; 403 PangoFontDescription *font_desc; 404 405 gint xthickness; 406 gint ythickness; 407 408 GdkGC *fg_gc[5]; 409 GdkGC *bg_gc[5]; 410 GdkGC *light_gc[5]; 411 GdkGC *dark_gc[5]; 412 GdkGC *mid_gc[5]; 413 GdkGC *text_gc[5]; 414 GdkGC *base_gc[5]; 415 GdkGC *text_aa_gc[5]; 416 GdkGC *black_gc; 417 GdkGC *white_gc; 418 419 GdkPixmap *bg_pixmap[5]; 420 } GtkStyle; 421 422 typedef struct _GtkWidget GtkWidget; 423 struct _GtkWidget 424 { 425 GtkObject object; 426 guint16 private_flags; 427 guint8 state; 428 guint8 saved_state; 429 gchar *name; 430 GtkStyle *style; 431 GtkRequisition requisition; 432 GtkAllocation allocation; 433 GdkWindow *window; 434 GtkWidget *parent; 435 }; 436 437 typedef struct 438 { 439 GtkWidget widget; 440 441 gfloat xalign; 442 gfloat yalign; 443 444 guint16 xpad; 445 guint16 ypad; 446 } GtkMisc; 447 448 typedef struct { 449 GtkWidget widget; 450 GtkWidget *focus_child; 451 guint border_width : 16; 452 guint need_resize : 1; 453 guint resize_mode : 2; 454 guint reallocate_redraws : 1; 455 guint has_focus_chain : 1; 456 } GtkContainer; 457 458 typedef struct { 459 GtkContainer container; 460 GtkWidget *child; 461 } GtkBin; 462 463 typedef struct { 464 GtkBin bin; 465 GdkWindow *event_window; 466 gchar *label_text; 467 guint activate_timeout; 468 guint constructed : 1; 469 guint in_button : 1; 470 guint button_down : 1; 471 guint relief : 2; 472 guint use_underline : 1; 473 guint use_stock : 1; 474 guint depressed : 1; 475 guint depress_on_activate : 1; 476 guint focus_on_click : 1; 477 } GtkButton; 478 479 typedef struct { 480 GtkButton button; 481 guint active : 1; 482 guint draw_indicator : 1; 483 guint inconsistent : 1; 484 } GtkToggleButton; 485 486 typedef struct _GtkAdjustment GtkAdjustment; 487 struct _GtkAdjustment 488 { 489 GtkObject parent_instance; 490 491 gdouble lower; 492 gdouble upper; 493 gdouble value; 494 gdouble step_increment; 495 gdouble page_increment; 496 gdouble page_size; 497 }; 498 499 typedef enum 500 { 501 GTK_UPDATE_CONTINUOUS, 502 GTK_UPDATE_DISCONTINUOUS, 503 GTK_UPDATE_DELAYED 504 } GtkUpdateType; 505 506 typedef struct _GtkRange GtkRange; 507 struct _GtkRange 508 { 509 GtkWidget widget; 510 GtkAdjustment *adjustment; 511 GtkUpdateType update_policy; 512 guint inverted : 1; 513 /*< protected >*/ 514 guint flippable : 1; 515 guint has_stepper_a : 1; 516 guint has_stepper_b : 1; 517 guint has_stepper_c : 1; 518 guint has_stepper_d : 1; 519 guint need_recalc : 1; 520 guint slider_size_fixed : 1; 521 gint min_slider_size; 522 GtkOrientation orientation; 523 GdkRectangle range_rect; 524 gint slider_start, slider_end; 525 gint round_digits; 526 /*< private >*/ 527 guint trough_click_forward : 1; 528 guint update_pending : 1; 529 /*GtkRangeLayout * */ void *layout; 530 /*GtkRangeStepTimer * */ void* timer; 531 gint slide_initial_slider_position; 532 gint slide_initial_coordinate; 533 guint update_timeout_id; 534 GdkWindow *event_window; 535 }; 536 537 typedef struct _GtkProgressBar GtkProgressBar; 538 539 typedef enum 540 { 541 GTK_PROGRESS_CONTINUOUS, 542 GTK_PROGRESS_DISCRETE 543 } GtkProgressBarStyle; 544 545 typedef enum 546 { 547 GTK_PROGRESS_LEFT_TO_RIGHT, 548 GTK_PROGRESS_RIGHT_TO_LEFT, 549 GTK_PROGRESS_BOTTOM_TO_TOP, 550 GTK_PROGRESS_TOP_TO_BOTTOM 551 } GtkProgressBarOrientation; 552 553 typedef struct _GtkProgress GtkProgress; 554 555 struct _GtkProgress 556 { 557 GtkWidget widget; 558 GtkAdjustment *adjustment; 559 GdkPixmap *offscreen_pixmap; 560 gchar *format; 561 gfloat x_align; 562 gfloat y_align; 563 guint show_text : 1; 564 guint activity_mode : 1; 565 guint use_text_format : 1; 566 }; 567 568 struct _GtkProgressBar 569 { 570 GtkProgress progress; 571 GtkProgressBarStyle bar_style; 572 GtkProgressBarOrientation orientation; 573 guint blocks; 574 gint in_block; 575 gint activity_pos; 576 guint activity_step; 577 guint activity_blocks; 578 gdouble pulse_fraction; 579 guint activity_dir : 1; 580 guint ellipsize : 3; 581 }; 582 583 typedef enum { 584 GTK_RESPONSE_NONE = -1, 585 GTK_RESPONSE_REJECT = -2, 586 GTK_RESPONSE_ACCEPT = -3, 587 GTK_RESPONSE_DELETE_EVENT = -4, 588 GTK_RESPONSE_OK = -5, 589 GTK_RESPONSE_CANCEL = -6, 590 GTK_RESPONSE_CLOSE = -7, 591 GTK_RESPONSE_YES = -8, 592 GTK_RESPONSE_NO = -9, 593 GTK_RESPONSE_APPLY = -10, 594 GTK_RESPONSE_HELP = -11 595 } GtkResponseType; 596 597 typedef struct _GtkWindow GtkWindow; 598 599 typedef struct _GtkFileChooser GtkFileChooser; 600 601 typedef enum { 602 GTK_FILE_CHOOSER_ACTION_OPEN, 603 GTK_FILE_CHOOSER_ACTION_SAVE, 604 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, 605 GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER 606 } GtkFileChooserAction; 607 608 typedef struct _GtkFileFilter GtkFileFilter; 609 610 typedef enum { 611 GTK_FILE_FILTER_FILENAME = 1 << 0, 612 GTK_FILE_FILTER_URI = 1 << 1, 613 GTK_FILE_FILTER_DISPLAY_NAME = 1 << 2, 614 GTK_FILE_FILTER_MIME_TYPE = 1 << 3 615 } GtkFileFilterFlags; 616 617 typedef struct { 618 GtkFileFilterFlags contains; 619 const gchar *filename; 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 660 */ 661 #define GLIB_CHECK_VERSION(major, minor, micro) \ 662 (fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL) 663 664 /* 665 * Check whether the gtk2 library is available and meets the minimum 666 * version requirement. If the library is already loaded this method has no 667 * effect and returns success. 668 * Returns FALSE on failure and TRUE on success. 669 */ 670 gboolean gtk2_check_version(); 671 672 /** 673 * Returns : 674 * NULL if the GTK+ library is compatible with the given version, or a string 675 * describing the version mismatch. 676 */ 677 gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor, 678 guint required_micro); 679 /* 680 * Load the gtk2 library. If the library is already loaded this method has no 681 * effect and returns success. 682 * Returns FALSE on failure and TRUE on success. 683 */ 684 gboolean gtk2_load(JNIEnv *env); 685 686 /* 687 * Loads fp_gtk_show_uri function pointer. This initialization is 688 * separated because the function is required only 689 * for java.awt.Desktop API. The function relies on initialization in 690 * gtk2_load, so it must be invoked only after a successful gtk2_load 691 * invocation 692 */ 693 gboolean gtk2_show_uri_load(JNIEnv *env); 694 695 /* 696 * Unload the gtk2 library. If the library is already unloaded this method has 697 * no effect and returns success. 698 * Returns FALSE on failure and TRUE on success. 699 */ 700 gboolean gtk2_unload(); 701 702 void gtk2_paint_arrow(WidgetType widget_type, GtkStateType state_type, 703 GtkShadowType shadow_type, const gchar *detail, 704 gint x, gint y, gint width, gint height, 705 GtkArrowType arrow_type, gboolean fill); 706 void gtk2_paint_box(WidgetType widget_type, GtkStateType state_type, 707 GtkShadowType shadow_type, const gchar *detail, 708 gint x, gint y, gint width, gint height, 709 gint synth_state, GtkTextDirection dir); 710 void gtk2_paint_box_gap(WidgetType widget_type, GtkStateType state_type, 711 GtkShadowType shadow_type, const gchar *detail, 712 gint x, gint y, gint width, gint height, 713 GtkPositionType gap_side, gint gap_x, gint gap_width); 714 void gtk2_paint_check(WidgetType widget_type, gint synth_state, 715 const gchar *detail, gint x, gint y, gint width, gint height); 716 void gtk2_paint_diamond(WidgetType widget_type, GtkStateType state_type, 717 GtkShadowType shadow_type, const gchar *detail, 718 gint x, gint y, gint width, gint height); 719 void gtk2_paint_expander(WidgetType widget_type, GtkStateType state_type, 720 const gchar *detail, gint x, gint y, gint width, gint height, 721 GtkExpanderStyle expander_style); 722 void gtk2_paint_extension(WidgetType widget_type, GtkStateType state_type, 723 GtkShadowType shadow_type, const gchar *detail, 724 gint x, gint y, gint width, gint height, GtkPositionType gap_side); 725 void gtk2_paint_flat_box(WidgetType widget_type, GtkStateType state_type, 726 GtkShadowType shadow_type, const gchar *detail, 727 gint x, gint y, gint width, gint height, gboolean has_focus); 728 void gtk2_paint_focus(WidgetType widget_type, GtkStateType state_type, 729 const char *detail, gint x, gint y, gint width, gint height); 730 void gtk2_paint_handle(WidgetType widget_type, GtkStateType state_type, 731 GtkShadowType shadow_type, const gchar *detail, 732 gint x, gint y, gint width, gint height, GtkOrientation orientation); 733 void gtk2_paint_hline(WidgetType widget_type, GtkStateType state_type, 734 const gchar *detail, gint x, gint y, gint width, gint height); 735 void gtk2_paint_option(WidgetType widget_type, gint synth_state, 736 const gchar *detail, gint x, gint y, gint width, gint height); 737 void gtk2_paint_shadow(WidgetType widget_type, GtkStateType state_type, 738 GtkShadowType shadow_type, const gchar *detail, 739 gint x, gint y, gint width, gint height, 740 gint synth_state, GtkTextDirection dir); 741 void gtk2_paint_slider(WidgetType widget_type, GtkStateType state_type, 742 GtkShadowType shadow_type, const gchar *detail, 743 gint x, gint y, gint width, gint height, GtkOrientation orientation); 744 void gtk2_paint_vline(WidgetType widget_type, GtkStateType state_type, 745 const gchar *detail, gint x, gint y, gint width, gint height); 746 void gtk_paint_background(WidgetType widget_type, GtkStateType state_type, 747 gint x, gint y, gint width, gint height); 748 749 void gtk2_init_painting(JNIEnv *env, gint w, gint h); 750 gint gtk2_copy_image(gint *dest, gint width, gint height); 751 752 gint gtk2_get_xthickness(JNIEnv *env, WidgetType widget_type); 753 gint gtk2_get_ythickness(JNIEnv *env, WidgetType widget_type); 754 gint gtk2_get_color_for_state(JNIEnv *env, WidgetType widget_type, 755 GtkStateType state_type, ColorType color_type); 756 jobject gtk2_get_class_value(JNIEnv *env, WidgetType widget_type, jstring key); 757 758 GdkPixbuf *gtk2_get_stock_icon(gint widget_type, const gchar *stock_id, 759 GtkIconSize size, GtkTextDirection direction, const char *detail); 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); 800 void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter, 801 GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data, 802 GDestroyNotify notify); 803 void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser, 804 GtkFileFilter *filter); 805 GType (*fp_gtk_file_chooser_get_type)(void); 806 GtkFileFilter* (*fp_gtk_file_filter_new)(void); 807 void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)( 808 GtkFileChooser *chooser, gboolean do_overwrite_confirmation); 809 void (*fp_gtk_file_chooser_set_select_multiple)( 810 GtkFileChooser *chooser, gboolean select_multiple); 811 gchar* (*fp_gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser); 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 */