1 /*
   2  * Copyright (c) 2005, 2020, 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 
  26 #ifdef HEADLESS
  27     #error This file should not be included in headless library
  28 #endif
  29 
  30 #ifndef _GTK3_INTERFACE_H
  31 #define _GTK3_INTERFACE_H
  32 
  33 #include <stdlib.h>
  34 #include <jni.h>
  35 #include <X11/X.h>
  36 #include "gtk_interface.h"
  37 
  38 #define LIGHTNESS_MULT  1.3
  39 #define DARKNESS_MULT   0.7
  40 
  41 #define G_PI    3.1415926535897932384626433832795028841971693993751
  42 
  43 typedef enum
  44 {
  45   GTK_STATE_FLAG_NORMAL       = 0,
  46   GTK_STATE_FLAG_ACTIVE       = 1 << 0,
  47   GTK_STATE_FLAG_PRELIGHT     = 1 << 1,
  48   GTK_STATE_FLAG_SELECTED     = 1 << 2,
  49   GTK_STATE_FLAG_INSENSITIVE  = 1 << 3,
  50   GTK_STATE_FLAG_INCONSISTENT = 1 << 4,
  51   GTK_STATE_FLAG_FOCUSED      = 1 << 5,
  52   GTK_STATE_FLAG_BACKDROP     = 1 << 6,
  53   GTK_STATE_FLAG_DIR_LTR      = 1 << 7,
  54   GTK_STATE_FLAG_DIR_RTL      = 1 << 8,
  55   GTK_STATE_FLAG_LINK         = 1 << 9,
  56   GTK_STATE_FLAG_VISITED      = 1 << 10,
  57   GTK_STATE_FLAG_CHECKED      = 1 << 11
  58 } GtkStateFlags;
  59 
  60 typedef enum {
  61   GTK_JUNCTION_NONE = 0,
  62   GTK_JUNCTION_CORNER_TOPLEFT = 1 << 0,
  63   GTK_JUNCTION_CORNER_TOPRIGHT = 1 << 1,
  64   GTK_JUNCTION_CORNER_BOTTOMLEFT = 1 << 2,
  65   GTK_JUNCTION_CORNER_BOTTOMRIGHT = 1 << 3,
  66   GTK_JUNCTION_TOP =
  67                    (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_TOPRIGHT),
  68   GTK_JUNCTION_BOTTOM =
  69              (GTK_JUNCTION_CORNER_BOTTOMLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT),
  70   GTK_JUNCTION_LEFT =
  71                  (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT),
  72   GTK_JUNCTION_RIGHT =
  73                (GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)
  74 } GtkJunctionSides;
  75 
  76 typedef enum {
  77   GTK_REGION_EVEN    = 1 << 0,
  78   GTK_REGION_ODD     = 1 << 1,
  79   GTK_REGION_FIRST   = 1 << 2,
  80   GTK_REGION_LAST    = 1 << 3,
  81   GTK_REGION_ONLY    = 1 << 4,
  82   GTK_REGION_SORTED  = 1 << 5
  83 } GtkRegionFlags;
  84 
  85 typedef enum
  86 {
  87   GTK_WINDOW_TOPLEVEL,
  88   GTK_WINDOW_POPUP
  89 } GtkWindowType;
  90 
  91 typedef enum
  92 {
  93   G_PARAM_READABLE            = 1 << 0,
  94   G_PARAM_WRITABLE            = 1 << 1,
  95   G_PARAM_CONSTRUCT           = 1 << 2,
  96   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
  97   G_PARAM_LAX_VALIDATION      = 1 << 4,
  98   G_PARAM_STATIC_NAME         = 1 << 5
  99 } GParamFlags;
 100 
 101 typedef enum
 102 {
 103   GTK_ICON_LOOKUP_NO_SVG           = 1 << 0,
 104   GTK_ICON_LOOKUP_FORCE_SVG        = 1 << 1,
 105   GTK_ICON_LOOKUP_USE_BUILTIN      = 1 << 2,
 106   GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
 107   GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 4
 108 } GtkIconLookupFlags;
 109 
 110 typedef enum
 111 {
 112   GTK_UPDATE_CONTINUOUS,
 113   GTK_UPDATE_DISCONTINUOUS,
 114   GTK_UPDATE_DELAYED
 115 } GtkUpdateType;
 116 
 117 typedef enum
 118 {
 119   GTK_PROGRESS_CONTINUOUS,
 120   GTK_PROGRESS_DISCRETE
 121 } GtkProgressBarStyle;
 122 
 123 typedef enum
 124 {
 125   GTK_PROGRESS_LEFT_TO_RIGHT,
 126   GTK_PROGRESS_RIGHT_TO_LEFT,
 127   GTK_PROGRESS_BOTTOM_TO_TOP,
 128   GTK_PROGRESS_TOP_TO_BOTTOM
 129 } GtkProgressBarOrientation;
 130 
 131 typedef enum {
 132     CAIRO_FORMAT_INVALID   = -1,
 133     CAIRO_FORMAT_ARGB32    = 0,
 134     CAIRO_FORMAT_RGB24     = 1,
 135     CAIRO_FORMAT_A8        = 2,
 136     CAIRO_FORMAT_A1        = 3,
 137     CAIRO_FORMAT_RGB16_565 = 4
 138 } cairo_format_t;
 139 
 140 /* We define all structure pointers to be void* */
 141 typedef void GdkPixbuf;
 142 typedef void GMainContext;
 143 typedef void GVfs;
 144 
 145 typedef void GdkColormap;
 146 typedef void GdkDrawable;
 147 typedef void GdkGC;
 148 typedef void GdkPixmap;
 149 typedef void GtkStyleContext;
 150 typedef void GtkFixed;
 151 typedef void GtkMenuItem;
 152 typedef void GtkMenuShell;
 153 typedef void GtkWidgetClass;
 154 typedef void PangoFontDescription;
 155 typedef void GtkSettings;
 156 typedef void GtkStyleProvider;
 157 typedef void cairo_pattern_t;
 158 typedef void cairo_t;
 159 typedef void cairo_surface_t;
 160 typedef void GtkScrolledWindow;
 161 typedef void GtkIconTheme;
 162 typedef void GtkWidget;
 163 typedef void GtkMisc;
 164 typedef void GtkContainer;
 165 typedef void GtkBin;
 166 typedef void GtkAdjustment;
 167 typedef void GtkRange;
 168 typedef void GtkProgressBar;
 169 typedef void GtkProgress;
 170 typedef void GtkWidgetPath;
 171 typedef void GtkPaned;
 172 
 173 /* Some real structures */
 174 typedef struct
 175 {
 176   guint32 pixel;
 177   guint16 red;
 178   guint16 green;
 179   guint16 blue;
 180 } GdkColor;
 181 
 182 typedef struct
 183 {
 184   gdouble red;
 185   gdouble green;
 186   gdouble blue;
 187   gdouble alpha;
 188 } GdkRGBA;
 189 
 190 typedef struct {
 191   gint      fd;
 192   gushort   events;
 193   gushort   revents;
 194 } GPollFD;
 195 
 196 typedef struct {
 197   gint x;
 198   gint y;
 199   gint width;
 200   gint height;
 201 } GdkRectangle;
 202 
 203 typedef struct {
 204     int x, y;
 205     int width, height;
 206 } GtkAllocation;
 207 
 208 typedef struct {
 209   gint width;
 210   gint height;
 211 } GtkRequisition;
 212 
 213 typedef struct {
 214   GtkWidgetClass *g_class;
 215 } GTypeInstance;
 216 
 217 typedef struct {
 218   gint16 left;
 219   gint16 right;
 220   gint16 top;
 221   gint16 bottom;
 222 } GtkBorder;
 223 
 224 typedef struct
 225 {
 226   GType         g_type;
 227   union {
 228     gint        v_int;
 229     guint       v_uint;
 230     glong       v_long;
 231     gulong      v_ulong;
 232     gint64      v_int64;
 233     guint64     v_uint64;
 234     gfloat      v_float;
 235     gdouble     v_double;
 236     gpointer    v_pointer;
 237   } data[2];
 238 } GValue;
 239 
 240 typedef struct {
 241   GTypeInstance  g_type_instance;
 242   const gchar   *name;
 243   GParamFlags    flags;
 244   GType    value_type;
 245   GType    owner_type;
 246 } GParamSpec;
 247 
 248 static gchar* (*fp_glib_check_version)(guint required_major,
 249                            guint required_minor, guint required_micro);
 250 
 251 /**
 252  * Returns :
 253  * NULL if the GTK+ library is compatible with the given version, or a string
 254  * describing the version mismatch.
 255  */
 256 static gchar* (*fp_gtk_check_version)(guint required_major, guint
 257                            required_minor, guint required_micro);
 258 
 259 static void (*fp_g_free)(gpointer mem);
 260 static void (*fp_g_object_unref)(gpointer object);
 261 static GdkWindow *(*fp_gdk_get_default_root_window) (void);
 262 static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window);
 263 
 264 static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 265 static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 266 static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 267 static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 268 static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 269 static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 270 static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 271 static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename,
 272                                                               GError **error);
 273 static GdkColorspace (*fp_gdk_pixbuf_get_colorspace)(const GdkPixbuf *pixbuf);
 274 
 275 static GdkPixbuf *(*fp_gdk_pixbuf_get_from_drawable)(GdkWindow *window,
 276         int src_x, int src_y, int width, int height);
 277 static GdkPixbuf *(*fp_gdk_pixbuf_scale_simple)(GdkPixbuf *src,
 278         int dest_width, int dest_heigh, GdkInterpType interp_type);
 279 
 280 
 281 static void (*fp_gtk_widget_destroy)(void *widget);
 282 static void (*fp_gtk_window_present)(GtkWindow *window);
 283 static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
 284 static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
 285 
 286 /**
 287  * Function Pointers for GtkFileChooser
 288  */
 289 static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
 290 static void (*fp_gtk_widget_hide)(void *widget);
 291 static void (*fp_gtk_main_quit)(void);
 292 static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
 293     GtkWindow *parent, GtkFileChooserAction action,
 294     const gchar *first_button_text, ...);
 295 static gboolean (*fp_gtk_file_chooser_set_current_folder)
 296                               (GtkFileChooser *chooser, const gchar *filename);
 297 static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
 298     const char *filename);
 299 static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
 300     const gchar *name);
 301 static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
 302     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
 303     GDestroyNotify notify);
 304 static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
 305     GtkFileFilter *filter);
 306 static GType (*fp_gtk_file_chooser_get_type)(void);
 307 static GtkFileFilter* (*fp_gtk_file_filter_new)(void);
 308 static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
 309     GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
 310 static void (*fp_gtk_file_chooser_set_select_multiple)(
 311     GtkFileChooser *chooser, gboolean select_multiple);
 312 static gchar* (*fp_gtk_file_chooser_get_current_folder)
 313                                                       (GtkFileChooser *chooser);
 314 static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
 315 static guint (*fp_gtk_g_slist_length)(GSList *list);
 316 static gulong (*fp_g_signal_connect_data)(gpointer instance,
 317     const gchar *detailed_signal, GCallback c_handler, gpointer data,
 318     GClosureNotify destroy_data, GConnectFlags connect_flags);
 319 static void (*fp_gtk_widget_show)(void *widget);
 320 static void (*fp_gtk_main)(void);
 321 static guint (*fp_gtk_main_level)(void);
 322 static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 323 static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
 324 
 325 static GList* (*fp_g_list_append) (GList *list, gpointer data);
 326 static void (*fp_g_list_free) (GList *list);
 327 static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
 328 
 329 static void (*fp_gdk_threads_enter)(void);
 330 static void (*fp_gdk_threads_leave)(void);
 331 
 332 static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
 333     guint32 timestamp, GError **error);
 334 
 335 // Implementation functions prototypes
 336 static void gtk3_init(GtkApi* gtk);
 337 static GValue*      (*fp_g_value_init)(GValue *value, GType g_type);
 338 static gboolean     (*fp_g_type_is_a)(GType type, GType is_a_type);
 339 static gboolean     (*fp_g_value_get_boolean)(const GValue *value);
 340 static gchar        (*fp_g_value_get_char)(const GValue *value);
 341 static guchar       (*fp_g_value_get_uchar)(const GValue *value);
 342 static gint         (*fp_g_value_get_int)(const GValue *value);
 343 static guint        (*fp_g_value_get_uint)(const GValue *value);
 344 static glong        (*fp_g_value_get_long)(const GValue *value);
 345 static gulong       (*fp_g_value_get_ulong)(const GValue *value);
 346 static gint64       (*fp_g_value_get_int64)(const GValue *value);
 347 static guint64      (*fp_g_value_get_uint64)(const GValue *value);
 348 static gfloat       (*fp_g_value_get_float)(const GValue *value);
 349 static gdouble      (*fp_g_value_get_double)(const GValue *value);
 350 static const gchar* (*fp_g_value_get_string)(const GValue *value);
 351 static gint         (*fp_g_value_get_enum)(const GValue *value);
 352 static guint        (*fp_g_value_get_flags)(const GValue *value);
 353 static GParamSpec*  (*fp_g_value_get_param)(const GValue *value);
 354 static gpointer*    (*fp_g_value_get_boxed)(const GValue *value);
 355 static gpointer*    (*fp_g_value_get_pointer)(const GValue *value);
 356 static void         (*fp_g_object_get)(gpointer object,
 357                                        const gchar* fpn, ...);
 358 static void         (*fp_g_object_set)(gpointer object,
 359                                        const gchar *first_property_name,
 360                                        ...);
 361 
 362 static gboolean (*fp_g_main_context_iteration)(GMainContext *context);
 363 static gboolean (*fp_g_str_has_prefix)(const gchar *str, const gchar *prefix);
 364 static gchar** (*fp_g_strsplit)(const gchar *string, const gchar *delimiter,
 365            gint max_tokens);
 366 static void (*fp_g_strfreev)(gchar **str_array);
 367 
 368 
 369 static cairo_surface_t* (*fp_cairo_image_surface_create)(cairo_format_t format,
 370                                int width, int height);
 371 static void (*fp_cairo_surface_destroy)(cairo_surface_t *surface);
 372 static cairo_t* (*fp_cairo_create)(cairo_surface_t *target);
 373 static void (*fp_cairo_destroy)(cairo_t *cr);
 374 static void (*fp_cairo_fill)(cairo_t *cr);
 375 static void (*fp_cairo_surface_flush)(cairo_surface_t *surface);
 376 static void (*fp_cairo_rectangle)(cairo_t *cr, double x, double y, double width,
 377                 double height);
 378 static void (*fp_cairo_set_source_rgb)(cairo_t *cr, double red, double green,
 379                 double blue);
 380 static void (*fp_cairo_set_source_rgba)(cairo_t *cr, double red, double green,
 381                 double blue, double alpha);
 382 static void (*fp_cairo_paint)(cairo_t *cr);
 383 static void (*fp_cairo_clip)(cairo_t *cr);
 384 static unsigned char* (*fp_cairo_image_surface_get_data)(
 385                                                  cairo_surface_t *surface);
 386 static int (*fp_cairo_image_surface_get_stride) (cairo_surface_t *surface);
 387 static GdkPixbuf* (*fp_gdk_pixbuf_get_from_surface)(cairo_surface_t *surface,
 388                             gint src_x, gint src_y, gint width, gint height);
 389 static GtkStateType (*fp_gtk_widget_get_state)(GtkWidget *widget);
 390 static void (*fp_gtk_widget_set_state)(GtkWidget *widget, GtkStateType state);
 391 static gboolean (*fp_gtk_widget_is_focus)(GtkWidget *widget);
 392 static void (*fp_gtk_widget_set_allocation)(GtkWidget *widget,
 393                                             const GtkAllocation *allocation);
 394 static GtkWidget* (*fp_gtk_widget_get_parent)(GtkWidget *widget);
 395 static GtkStyleContext* (*fp_gtk_widget_get_style_context)(GtkWidget *widget);
 396 static void (*fp_gtk_style_context_get_color)(GtkStyleContext *context,
 397                                            GtkStateFlags state, GdkRGBA *color);
 398 static void (*fp_gtk_style_context_get_background_color)
 399                 (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color);
 400 static void (*fp_gtk_style_context_get)(GtkStyleContext *context,
 401                                                       GtkStateFlags state, ...);
 402 static GtkStateFlags (*fp_gtk_widget_get_state_flags)(GtkWidget* widget);
 403 static void (*fp_gtk_style_context_set_state)(GtkStyleContext* style,
 404                                               GtkStateFlags flags);
 405 static void (*fp_gtk_style_context_add_class)(GtkStyleContext *context,
 406                                                  const gchar *class_name);
 407 static void (*fp_gtk_style_context_save)(GtkStyleContext *context);
 408 static void (*fp_gtk_style_context_restore)(GtkStyleContext *context);
 409 static void (*fp_gtk_render_check)(GtkStyleContext *context, cairo_t *cr,
 410                      gdouble x, gdouble y, gdouble width, gdouble height);
 411 static void (*fp_gtk_render_option)(GtkStyleContext *context, cairo_t *cr,
 412                      gdouble x, gdouble y, gdouble width, gdouble height);
 413 static void (*fp_gtk_render_extension)(GtkStyleContext *context, cairo_t *cr,
 414                      gdouble x, gdouble y, gdouble width, gdouble height,
 415                      GtkPositionType gap_side);
 416 static void (*fp_gtk_render_expander)(GtkStyleContext *context, cairo_t *cr,
 417                      gdouble x, gdouble y, gdouble width, gdouble height);
 418 static void (*fp_gtk_render_frame_gap)(GtkStyleContext *context, cairo_t *cr,
 419                      gdouble x, gdouble y, gdouble width, gdouble height,
 420                      GtkPositionType gap_side, gdouble xy0_gap,
 421                      gdouble xy1_gap);
 422 static void (*fp_gtk_render_line)(GtkStyleContext *context, cairo_t *cr,
 423                      gdouble x0, gdouble y0, gdouble x1, gdouble y1);
 424 static GdkPixbuf* (*fp_gtk_widget_render_icon_pixbuf)(GtkWidget *widget,
 425                      const gchar *stock_id, GtkIconSize size);
 426 static cairo_surface_t* (*fp_gdk_window_create_similar_image_surface)(
 427                      GdkWindow *window, cairo_format_t format, int width,
 428                      int height, int scale);
 429 static cairo_surface_t* (*fp_gdk_window_create_similar_surface)(
 430                      GdkWindow *window, cairo_format_t format,
 431                      int width, int height);
 432 static GdkWindow* (*fp_gtk_widget_get_window)(GtkWidget *widget);
 433 static GtkSettings *(*fp_gtk_settings_get_for_screen)(GdkScreen *screen);
 434 static GdkScreen *(*fp_gtk_widget_get_screen)(GtkWidget *widget);
 435 static GtkStyleProvider* (*fp_gtk_css_provider_get_named)(const gchar *name,
 436                      const gchar *variant);
 437 static void (*fp_gtk_style_context_add_provider)(GtkStyleContext *context,
 438                      GtkStyleProvider *provider, guint priority);
 439 static void (*fp_gtk_render_frame)(GtkStyleContext *context,cairo_t *cr,
 440                      gdouble x, gdouble y, gdouble width, gdouble height);
 441 static void (*fp_gtk_render_focus)(GtkStyleContext *context,cairo_t *cr,
 442                      gdouble x, gdouble y, gdouble width, gdouble height);
 443 static void (*fp_gtk_render_handle)(GtkStyleContext *context,cairo_t *cr,
 444                      gdouble x, gdouble y, gdouble width, gdouble height);
 445 static void (*fp_gtk_style_context_get_property)(GtkStyleContext *context,
 446                      const gchar *property, GtkStateFlags state, GValue *value);
 447 static void (*fp_gtk_render_activity)(GtkStyleContext *context, cairo_t *cr,
 448                      gdouble x, gdouble y, gdouble width, gdouble height);
 449 static void (*fp_gtk_render_background)(GtkStyleContext *context, cairo_t *cr,
 450                      gdouble x, gdouble y, gdouble width, gdouble height);
 451 static gboolean (*fp_gtk_style_context_has_class)(GtkStyleContext *context,
 452                      const gchar *class_name);
 453 static void transform_detail_string (const gchar *detail,
 454                      GtkStyleContext *context);
 455 void (*fp_gtk_style_context_set_junction_sides)(GtkStyleContext  *context,
 456                      GtkJunctionSides  sides);
 457 void (*fp_gtk_style_context_add_region)(GtkStyleContext *context,
 458                      const gchar *region_name, GtkRegionFlags flags);
 459 void (*fp_gtk_render_arrow)(GtkStyleContext *context, cairo_t *cr,
 460                      gdouble angle, gdouble x, gdouble y, gdouble size);
 461 void (*fp_gtk_bin_set_child)(GtkBin *bin, GtkWidget *widget);
 462 void (*fp_gtk_scrolled_window_set_shadow_type)(
 463                      GtkScrolledWindow *scrolled_window, GtkShadowType type);
 464 static void (*fp_gtk_render_slider)(GtkStyleContext *context, cairo_t *cr,
 465                      gdouble x, gdouble y, gdouble width, gdouble height,
 466                      GtkOrientation orientation);
 467 static void (*fp_gtk_style_context_get_padding)(GtkStyleContext *self,
 468                      GtkStateFlags state, GtkBorder* padding);
 469 static void (*fp_gtk_range_set_inverted)(GtkRange *range, gboolean  setting);
 470 static PangoFontDescription* (*fp_gtk_style_context_get_font)(
 471                      GtkStyleContext *context, GtkStateFlags state);
 472 static int (*fp_gtk_widget_get_allocated_width)(GtkWidget *widget);
 473 static int (*fp_gtk_widget_get_allocated_height)(GtkWidget *widget);
 474 static GtkIconTheme* (*fp_gtk_icon_theme_get_default)(void);
 475 static GdkPixbuf* (*fp_gtk_icon_theme_load_icon)(GtkIconTheme *icon_theme,
 476                      const gchar *icon_name, gint size,
 477                      GtkIconLookupFlags flags, GError **error);
 478 static void (*fp_gtk_adjustment_set_lower)(GtkAdjustment *adjustment,
 479                      gdouble lower);
 480 static void (*fp_gtk_adjustment_set_page_increment)(GtkAdjustment *adjustment,
 481                      gdouble page_increment);
 482 static void (*fp_gtk_adjustment_set_page_size)(GtkAdjustment *adjustment,
 483                      gdouble page_size);
 484 static void (*fp_gtk_adjustment_set_step_increment)(GtkAdjustment *adjustment,
 485                      gdouble step_increment);
 486 static void (*fp_gtk_adjustment_set_upper)(GtkAdjustment *adjustment,
 487                      gdouble upper);
 488 static void (*fp_gtk_adjustment_set_value)(GtkAdjustment *adjustment,
 489                      gdouble value);
 490 static GdkGC *(*fp_gdk_gc_new)(GdkDrawable*);
 491 static void (*fp_gdk_rgb_gc_set_foreground)(GdkGC*, guint32);
 492 static void (*fp_gdk_draw_rectangle)(GdkDrawable*, GdkGC*, gboolean,
 493         gint, gint, gint, gint);
 494 static GdkPixbuf *(*fp_gdk_pixbuf_new)(GdkColorspace colorspace,
 495         gboolean has_alpha, int bits_per_sample, int width, int height);
 496 static void (*fp_gdk_drawable_get_size)(GdkDrawable *drawable,
 497         gint* width, gint* height);
 498 static gboolean (*fp_gtk_init_check)(int* argc, char** argv);
 499 
 500 /* Widget creation */
 501 static GtkWidget* (*fp_gtk_arrow_new)(GtkArrowType arrow_type,
 502                                       GtkShadowType shadow_type);
 503 static GtkWidget* (*fp_gtk_button_new)();
 504 static GtkWidget* (*fp_gtk_check_button_new)();
 505 static GtkWidget* (*fp_gtk_check_menu_item_new)();
 506 static GtkWidget* (*fp_gtk_color_selection_dialog_new)(const gchar* title);
 507 static GtkWidget* (*fp_gtk_combo_box_new)();
 508 static GtkWidget* (*fp_gtk_combo_box_entry_new)();
 509 static GtkWidget* (*fp_gtk_entry_new)();
 510 static GtkWidget* (*fp_gtk_fixed_new)();
 511 static GtkWidget* (*fp_gtk_handle_box_new)();
 512 static GtkWidget* (*fp_gtk_paned_new)(GtkOrientation orientation);
 513 static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation  orientation,
 514                                        GtkAdjustment* adjustment);
 515 static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);
 516 static GtkWidget* (*fp_gtk_vscrollbar_new)(GtkAdjustment* adjustment);
 517 static GtkWidget* (*fp_gtk_hseparator_new)();
 518 static GtkWidget* (*fp_gtk_vseparator_new)();
 519 static GtkWidget* (*fp_gtk_image_new)();
 520 static GtkWidget* (*fp_gtk_label_new)(const gchar* str);
 521 static GtkWidget* (*fp_gtk_menu_new)();
 522 static GtkWidget* (*fp_gtk_menu_bar_new)();
 523 static GtkWidget* (*fp_gtk_menu_item_new)();
 524 static GtkWidget* (*fp_gtk_notebook_new)();
 525 static GtkWidget* (*fp_gtk_progress_bar_new)();
 526 static GtkWidget* (*fp_gtk_progress_bar_set_orientation)(
 527         GtkProgressBar *pbar,
 528         GtkProgressBarOrientation orientation);
 529 static GtkWidget* (*fp_gtk_radio_button_new)(GSList *group);
 530 static GtkWidget* (*fp_gtk_radio_menu_item_new)(GSList *group);
 531 static GtkWidget* (*fp_gtk_scrolled_window_new)(GtkAdjustment *hadjustment,
 532         GtkAdjustment *vadjustment);
 533 static GtkWidget* (*fp_gtk_separator_menu_item_new)();
 534 static GtkWidget* (*fp_gtk_separator_tool_item_new)();
 535 static GtkWidget* (*fp_gtk_text_view_new)();
 536 static GtkWidget* (*fp_gtk_toggle_button_new)();
 537 static GtkWidget* (*fp_gtk_toolbar_new)();
 538 static GtkWidget* (*fp_gtk_tree_view_new)();
 539 static GtkWidget* (*fp_gtk_viewport_new)(GtkAdjustment *hadjustment,
 540         GtkAdjustment *vadjustment);
 541 static GtkWidget* (*fp_gtk_window_new)(GtkWindowType type);
 542 static GtkWidget* (*fp_gtk_dialog_new)();
 543 static GtkWidget* (*fp_gtk_spin_button_new)(GtkAdjustment *adjustment,
 544         gdouble climb_rate, guint digits);
 545 static GtkWidget* (*fp_gtk_frame_new)(const gchar *label);
 546 
 547 /* Other widget operations */
 548 static GtkAdjustment* (*fp_gtk_adjustment_new)(gdouble value,
 549         gdouble lower, gdouble upper, gdouble step_increment,
 550         gdouble page_increment, gdouble page_size);
 551 static void (*fp_gtk_container_add)(GtkContainer *window, GtkWidget *widget);
 552 static void (*fp_gtk_menu_shell_append)(GtkMenuShell *menu_shell,
 553         GtkWidget *child);
 554 static void (*fp_gtk_menu_item_set_submenu)(GtkMenuItem *menu_item,
 555         GtkWidget *submenu);
 556 static void (*fp_gtk_widget_realize)(GtkWidget *widget);
 557 static GdkPixbuf* (*fp_gtk_widget_render_icon)(GtkWidget *widget,
 558         const gchar *stock_id, GtkIconSize size, const gchar *detail);
 559 static void (*fp_gtk_widget_set_name)(GtkWidget *widget, const gchar *name);
 560 static void (*fp_gtk_widget_set_parent)(GtkWidget *widget, GtkWidget *parent);
 561 static void (*fp_gtk_widget_set_direction)(GtkWidget *widget,
 562         GtkTextDirection direction);
 563 static void (*fp_gtk_widget_style_get)(GtkWidget *widget,
 564         const gchar *first_property_name, ...);
 565 static void (*fp_gtk_widget_class_install_style_property)(
 566         GtkWidgetClass* class, GParamSpec *pspec);
 567 static GParamSpec* (*fp_gtk_widget_class_find_style_property)(
 568         GtkWidgetClass* class, const gchar* property_name);
 569 static void (*fp_gtk_widget_style_get_property)(GtkWidget* widget,
 570         const gchar* property_name, GValue* value);
 571 static char* (*fp_pango_font_description_to_string)(
 572         const PangoFontDescription* fd);
 573 static GtkSettings* (*fp_gtk_settings_get_default)();
 574 static GtkSettings* (*fp_gtk_widget_get_settings)(GtkWidget *widget);
 575 static GType        (*fp_gtk_border_get_type)();
 576 static void (*fp_gtk_arrow_set)(GtkWidget* arrow,
 577                                 GtkArrowType arrow_type,
 578                                 GtkShadowType shadow_type);
 579 static void (*fp_gtk_widget_size_request)(GtkWidget *widget,
 580                                           GtkRequisition *requisition);
 581 static GtkAdjustment* (*fp_gtk_range_get_adjustment)(GtkRange* range);
 582 static GtkWidgetPath* (*fp_gtk_widget_path_copy)
 583         (const GtkWidgetPath *path);
 584 static const GtkWidgetPath* (*fp_gtk_style_context_get_path)
 585         (GtkStyleContext *context);
 586 static GtkWidgetPath* (*fp_gtk_widget_path_new) (void);
 587 static gint (*fp_gtk_widget_path_append_type)
 588         (GtkWidgetPath *path, GType type);
 589 static void (*fp_gtk_widget_path_iter_set_object_name)
 590         (GtkWidgetPath *path, gint pos, const char *name);
 591 static void (*fp_gtk_style_context_set_path)
 592         (GtkStyleContext *context, GtkWidgetPath *path);
 593 static void (*fp_gtk_widget_path_unref) (GtkWidgetPath *path);
 594 static GtkStyleContext* (*fp_gtk_style_context_new) (void);
 595 
 596 #endif /* !_GTK3_INTERFACE_H */