1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef GTKUTIL_H
21 #define GTKUTIL_H
22
23
24 #ifdef USE_GTK
25
26 #include <gtk/gtk.h>
27 #include "../lwlib/lwlib-widget.h"
28 #ifdef HAVE_PGTK
29 #include "pgtkterm.h"
30 #define EVENT GdkEvent
31 #else
32 #include "xterm.h"
33 #define EVENT XEvent
34 #endif
35
36
37
38 #define XG_SB_MIN 1
39 #define XG_SB_MAX 10000000
40 #define XG_SB_RANGE (XG_SB_MAX-XG_SB_MIN)
41 #define YG_SB_MIN 1
42 #define YG_SB_MAX 10000000
43 #define YG_SB_RANGE (YG_SB_MAX-YG_SB_MIN)
44
45
46 #define XG_FRAME_DATA "emacs_frame"
47
48
49 #define XG_ITEM_DATA "emacs_menuitem"
50
51
52 typedef struct xg_list_node_
53 {
54 struct xg_list_node_ *prev;
55 struct xg_list_node_ *next;
56 } xg_list_node;
57
58
59
60
61
62
63 typedef struct xg_menu_cb_data_
64 {
65 xg_list_node ptrs;
66
67 struct frame *f;
68 Lisp_Object menu_bar_vector;
69 int menu_bar_items_used;
70 GCallback highlight_cb;
71 int ref_count;
72 } xg_menu_cb_data;
73
74
75 typedef struct xg_menu_item_cb_data_
76 {
77 xg_list_node ptrs;
78
79 gulong select_id;
80 Lisp_Object help;
81 gpointer call_data;
82 xg_menu_cb_data *cl_data;
83
84 } xg_menu_item_cb_data;
85
86 extern bool xg_uses_old_file_dialog (void);
87
88 extern char *xg_get_file_name (struct frame *f,
89 char *prompt,
90 char *default_filename,
91 bool mustmatch_p,
92 bool only_dir_p);
93
94 extern Lisp_Object xg_get_font (struct frame *f, const char *);
95
96 extern GtkWidget *xg_create_widget (const char *type,
97 const char *name,
98 struct frame *f,
99 struct _widget_value *val,
100 GCallback select_cb,
101 GCallback deactivate_cb,
102 GCallback highlight_cb);
103
104 extern void xg_modify_menubar_widgets (GtkWidget *menubar,
105 struct frame *f,
106 struct _widget_value *val,
107 bool deep_p,
108 GCallback select_cb,
109 GCallback deactivate_cb,
110 GCallback highlight_cb);
111
112 extern void xg_update_frame_menubar (struct frame *f);
113
114 extern bool xg_event_is_for_menubar (struct frame *, const EVENT *);
115
116 extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
117
118 extern void xg_create_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_create_horizontal_scroll_bar (struct frame *f,
124 struct scroll_bar *bar,
125 GCallback scroll_callback,
126 GCallback end_callback,
127 const char *scroll_bar_name);
128 extern void xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id);
129
130 extern void xg_update_scrollbar_pos (struct frame *f,
131 ptrdiff_t scrollbar_id,
132 int top,
133 int left,
134 int width,
135 int height);
136 extern void xg_update_horizontal_scrollbar_pos (struct frame *f,
137 ptrdiff_t scrollbar_id,
138 int top,
139 int left,
140 int width,
141 int height);
142
143 extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
144 int portion,
145 int position,
146 int whole);
147 extern void xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
148 int portion,
149 int position,
150 int whole);
151 extern bool xg_event_is_for_scrollbar (struct frame *, const EVENT *,
152 bool for_valuator);
153 extern int xg_get_default_scrollbar_width (struct frame *f);
154 extern int xg_get_default_scrollbar_height (struct frame *f);
155
156 extern void xg_wm_set_size_hint (struct frame *, long int, bool);
157
158 extern void update_frame_tool_bar (struct frame *f);
159 extern void free_frame_tool_bar (struct frame *f);
160 extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
161
162 extern void xg_frame_resized (struct frame *f,
163 int pixelwidth,
164 int pixelheight);
165 extern void xg_frame_set_char_size (struct frame *f, int width, int height);
166 extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
167
168 extern int xg_get_scale (struct frame *f);
169 #ifndef HAVE_PGTK
170 extern void xg_display_open (char *display_name, Display **dpy);
171 extern void xg_display_close (Display *dpy);
172 extern GdkCursor * xg_create_default_cursor (Display *dpy);
173 #else
174 extern void xg_display_open (char *display_name, GdkDisplay **dpy);
175 extern void xg_display_close (GdkDisplay *gdpy);
176 extern GdkCursor * xg_create_default_cursor (GdkDisplay *gdpy);
177 #endif
178
179 extern bool xg_create_frame_widgets (struct frame *f);
180 extern void xg_free_frame_widgets (struct frame *f);
181 extern void xg_set_background_color (struct frame *f, unsigned long bg);
182 extern bool xg_check_special_colors (struct frame *f,
183 const char *color_name,
184 Emacs_Color *color);
185 #ifdef HAVE_PGTK
186 extern void xg_create_frame_outer_widgets (struct frame *f);
187 #endif
188
189 #ifndef HAVE_PGTK
190 extern void xg_set_frame_icon (struct frame *f,
191 Pixmap icon_pixmap,
192 Pixmap icon_mask);
193 #endif
194
195 extern void xg_set_undecorated (struct frame *f, Lisp_Object undecorated);
196 extern void xg_frame_restack (struct frame *f1, struct frame *f2, bool above);
197 extern void xg_set_skip_taskbar (struct frame *f, Lisp_Object skip_taskbar);
198 extern void xg_set_no_focus_on_map (struct frame *f, Lisp_Object no_focus_on_map);
199 extern void xg_set_no_accept_focus (struct frame *f, Lisp_Object no_accept_focus);
200 extern void xg_set_override_redirect (struct frame *f, Lisp_Object override_redirect);
201
202 extern bool xg_prepare_tooltip (struct frame *f,
203 Lisp_Object string,
204 int *width,
205 int *height);
206 #ifndef HAVE_PGTK
207 extern void xg_show_tooltip (struct frame *f, int root_x, int root_y);
208 #else
209 extern void xg_show_tooltip (struct frame *f, Lisp_Object string);
210 #endif
211 extern bool xg_hide_tooltip (struct frame *f);
212
213 #ifdef USE_CAIRO
214 extern void xg_page_setup_dialog (void);
215 extern Lisp_Object xg_get_page_setup (void);
216 extern void xg_print_frames_dialog (Lisp_Object);
217 #endif
218
219 #if defined HAVE_GTK3 && defined HAVE_XINPUT2
220 extern bool xg_is_menu_window (Display *dpy, Window);
221 #endif
222
223 #ifndef HAVE_PGTK
224 extern bool xg_filter_key (struct frame *frame, XEvent *xkey);
225 #endif
226
227
228 extern void xg_mark_data (void);
229
230
231 extern void xg_initialize (void);
232
233
234
235 extern bool xg_ignore_gtk_scrollbar;
236
237 extern bool xg_gtk_initialized;
238
239 #endif
240 #endif