Subject: * lisp/progmodes/prolog.el: Improve handling of if/then/else
[emacs.git] / src / gtkutil.h
blob34338db58fb04400324023897aef829da818abf8
1 /* Definitions and headers for GTK widgets.
3 Copyright (C) 2003-2015 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef GTKUTIL_H
21 #define GTKUTIL_H
24 #ifdef USE_GTK
26 #include <gtk/gtk.h>
27 #include "../lwlib/lwlib-widget.h"
28 #include "frame.h"
29 #include "xterm.h"
31 /* Minimum and maximum values used for GTK scroll bars */
33 #define XG_SB_MIN 1
34 #define XG_SB_MAX 10000000
35 #define XG_SB_RANGE (XG_SB_MAX-XG_SB_MIN)
36 #define YG_SB_MIN 1
37 #define YG_SB_MAX 10000000
38 #define YG_SB_RANGE (YG_SB_MAX-YG_SB_MIN)
40 /* Key for data that is valid for menus and scroll bars in a frame */
41 #define XG_FRAME_DATA "emacs_frame"
43 /* Key for data that menu items hold. */
44 #define XG_ITEM_DATA "emacs_menuitem"
46 /* This is a list node in a generic list implementation. */
47 typedef struct xg_list_node_
49 struct xg_list_node_ *prev;
50 struct xg_list_node_ *next;
51 } xg_list_node;
53 /* This structure is the callback data that is shared for menu items.
54 We need to keep it separate from the frame structure due to
55 detachable menus. The data in the frame structure is only valid while
56 the menu is popped up. This structure is kept around as long as
57 the menu is. */
58 typedef struct xg_menu_cb_data_
60 xg_list_node ptrs;
62 struct frame *f;
63 Lisp_Object menu_bar_vector;
64 int menu_bar_items_used;
65 GCallback highlight_cb;
66 int ref_count;
67 } xg_menu_cb_data;
69 /* This structure holds callback information for each individual menu item. */
70 typedef struct xg_menu_item_cb_data_
72 xg_list_node ptrs;
74 gulong select_id;
75 Lisp_Object help;
76 gpointer call_data;
77 xg_menu_cb_data *cl_data;
79 } xg_menu_item_cb_data;
81 extern bool xg_uses_old_file_dialog (void);
83 extern char *xg_get_file_name (struct frame *f,
84 char *prompt,
85 char *default_filename,
86 bool mustmatch_p,
87 bool only_dir_p);
89 extern Lisp_Object xg_get_font (struct frame *f, const char *);
91 extern GtkWidget *xg_create_widget (const char *type,
92 const char *name,
93 struct frame *f,
94 struct _widget_value *val,
95 GCallback select_cb,
96 GCallback deactivate_cb,
97 GCallback highlight_cb);
99 extern void xg_modify_menubar_widgets (GtkWidget *menubar,
100 struct frame *f,
101 struct _widget_value *val,
102 bool deep_p,
103 GCallback select_cb,
104 GCallback deactivate_cb,
105 GCallback highlight_cb);
107 extern void xg_update_frame_menubar (struct frame *f);
109 extern bool xg_event_is_for_menubar (struct frame *, const XEvent *);
111 extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
113 extern void xg_create_scroll_bar (struct frame *f,
114 struct scroll_bar *bar,
115 GCallback scroll_callback,
116 GCallback end_callback,
117 const char *scroll_bar_name);
118 extern void xg_create_horizontal_scroll_bar (struct frame *f,
119 struct scroll_bar *bar,
120 GCallback scroll_callback,
121 GCallback end_callback,
122 const char *scroll_bar_name);
123 extern void xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id);
125 extern void xg_update_scrollbar_pos (struct frame *f,
126 ptrdiff_t scrollbar_id,
127 int top,
128 int left,
129 int width,
130 int height);
131 extern void xg_update_horizontal_scrollbar_pos (struct frame *f,
132 ptrdiff_t scrollbar_id,
133 int top,
134 int left,
135 int width,
136 int height);
138 extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
139 int portion,
140 int position,
141 int whole);
142 extern void xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
143 int portion,
144 int position,
145 int whole);
146 extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent *);
147 extern int xg_get_default_scrollbar_width (void);
148 extern int xg_get_default_scrollbar_height (void);
150 extern void update_frame_tool_bar (struct frame *f);
151 extern void free_frame_tool_bar (struct frame *f);
152 extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
154 extern void xg_clear_under_internal_border (struct frame *f);
155 extern void xg_frame_resized (struct frame *f,
156 int pixelwidth,
157 int pixelheight);
158 extern void xg_frame_set_char_size (struct frame *f, int width, int height);
159 extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
161 extern void xg_display_open (char *display_name, Display **dpy);
162 extern void xg_display_close (Display *dpy);
163 extern GdkCursor * xg_create_default_cursor (Display *dpy);
165 extern bool xg_create_frame_widgets (struct frame *f);
166 extern void xg_free_frame_widgets (struct frame *f);
167 extern void xg_set_background_color (struct frame *f, unsigned long bg);
168 extern bool xg_check_special_colors (struct frame *f,
169 const char *color_name,
170 XColor *color);
172 extern void xg_set_frame_icon (struct frame *f,
173 Pixmap icon_pixmap,
174 Pixmap icon_mask);
176 extern bool xg_prepare_tooltip (struct frame *f,
177 Lisp_Object string,
178 int *width,
179 int *height);
180 extern void xg_show_tooltip (struct frame *f, int root_x, int root_y);
181 extern bool xg_hide_tooltip (struct frame *f);
183 #ifdef USE_CAIRO
184 extern void xg_page_setup_dialog (void);
185 extern Lisp_Object xg_get_page_setup (void);
186 extern void xg_print_frames_dialog (Lisp_Object);
187 #endif
189 /* Mark all callback data that are Lisp_object:s during GC. */
190 extern void xg_mark_data (void);
192 /* Initialize GTK specific parts. */
193 extern void xg_initialize (void);
195 /* Setting scrollbar values invokes the callback. Use this variable
196 to indicate that the callback should do nothing. */
197 extern bool xg_ignore_gtk_scrollbar;
199 #endif /* USE_GTK */
200 #endif /* GTKUTIL_H */