/* Definitions and headers for GTK widgets.Copyright (C) 2003-2011 Free Software Foundation, Inc.This file is part of GNU Emacs.GNU Emacs is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.GNU Emacs is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */#ifndef GTKUTIL_H#define GTKUTIL_H#ifdef USE_GTK#include <gtk/gtk.h>#include "frame.h"/* Minimum and maximum values used for GTK scroll bars */#define XG_SB_MIN 1#define XG_SB_MAX 10000000#define XG_SB_RANGE (XG_SB_MAX-XG_SB_MIN)/* Key for data that is valid for menus and scroll bars in a frame */#define XG_FRAME_DATA "emacs_frame"/* Key for data that menu items hold. */#define XG_ITEM_DATA "emacs_menuitem"/* This is a list node in a generic list implementation. */typedefstructxg_list_node_{structxg_list_node_*prev;structxg_list_node_*next;}xg_list_node;/* This structure is the callback data that is shared for menu items. We need to keep it separate from the frame structure due to detachable menus. The data in the frame structure is only valid while the menu is popped up. This structure is kept around as long as the menu is. */typedefstructxg_menu_cb_data_{xg_list_nodeptrs;FRAME_PTRf;Lisp_Objectmenu_bar_vector;intmenu_bar_items_used;GCallbackhighlight_cb;intref_count;}xg_menu_cb_data;/* This structure holds callback information for each individual menu item. */typedefstructxg_menu_item_cb_data_{xg_list_nodeptrs;gulongselect_id;Lisp_Objecthelp;gpointercall_data;xg_menu_cb_data*cl_data;}xg_menu_item_cb_data;#ifdef HAVE_GTK_FILE_SELECTION_NEWexternintuse_old_gtk_file_dialog;#endifstruct_widget_value;externstruct_widget_value*malloc_widget_value(void);externvoidfree_widget_value(struct_widget_value*);externintxg_uses_old_file_dialog(void);externchar*xg_get_file_name(FRAME_PTRf,char*prompt,char*default_filename,intmustmatch_p,intonly_dir_p);externchar*xg_get_font_name(FRAME_PTRf,constchar*);externGtkWidget*xg_create_widget(constchar*type,constchar*name,FRAME_PTRf,struct_widget_value*val,GCallbackselect_cb,GCallbackdeactivate_cb,GCallbackhighlight_cb);externvoidxg_modify_menubar_widgets(GtkWidget*menubar,FRAME_PTRf,struct_widget_value*val,intdeep_p,GCallbackselect_cb,GCallbackdeactivate_cb,GCallbackhighlight_cb);externintxg_update_frame_menubar(FRAME_PTRf);externintxg_event_is_for_menubar(FRAME_PTRf,XEvent*event);externintxg_have_tear_offs(void);externptrdiff_txg_get_scroll_id_for_window(Display*dpy,Windowwid);externvoidxg_create_scroll_bar(FRAME_PTRf,structscroll_bar*bar,GCallbackscroll_callback,GCallbackend_callback,constchar*scroll_bar_name);externvoidxg_remove_scroll_bar(FRAME_PTRf,ptrdiff_tscrollbar_id);externvoidxg_update_scrollbar_pos(FRAME_PTRf,ptrdiff_tscrollbar_id,inttop,intleft,intwidth,intheight);externvoidxg_set_toolkit_scroll_bar_thumb(structscroll_bar*bar,intportion,intposition,intwhole);externintxg_event_is_for_scrollbar(FRAME_PTRf,XEvent*event);externintxg_get_default_scrollbar_width(void);externvoidupdate_frame_tool_bar(FRAME_PTRf);externvoidfree_frame_tool_bar(FRAME_PTRf);externintxg_change_toolbar_position(FRAME_PTRf,Lisp_Objectpos);externvoidxg_frame_resized(FRAME_PTRf,intpixelwidth,intpixelheight);externvoidxg_frame_set_char_size(FRAME_PTRf,intcols,introws);externGtkWidget*xg_win_to_widget(Display*dpy,Windowwdesc);externvoidxg_display_open(char*display_name,Display**dpy);externvoidxg_display_close(Display*dpy);externGdkCursor*xg_create_default_cursor(Display*dpy);externintxg_create_frame_widgets(FRAME_PTRf);externvoidxg_free_frame_widgets(FRAME_PTRf);externvoidx_wm_set_size_hint(FRAME_PTRf,longflags,intuser_position);externvoidxg_set_background_color(FRAME_PTRf,unsignedlongbg);externintxg_check_special_colors(structframe*f,constchar*color_name,XColor*color);externvoidxg_set_frame_icon(FRAME_PTRf,Pixmapicon_pixmap,Pixmapicon_mask);externintxg_prepare_tooltip(FRAME_PTRf,Lisp_Objectstring,int*width,int*height);externvoidxg_show_tooltip(FRAME_PTRf,introot_x,introot_y);externintxg_hide_tooltip(FRAME_PTRf);/* Mark all callback data that are Lisp_object:s during GC. */externvoidxg_mark_data(void);/* Initialize GTK specific parts. */externvoidxg_initialize(void);/* Setting scrollbar values invokes the callback. Use this variable to indicate that the callback should do nothing. */externintxg_ignore_gtk_scrollbar;#endif /* USE_GTK */#endif /* GTKUTIL_H */