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