* simple.el (list-processes): Doc fix.
[bpt/emacs.git] / src / gtkutil.h
CommitLineData
f392e843 1/* Definitions and headers for GTK widgets.
95df8112 2
acaf905b 3Copyright (C) 2003-2012 Free Software Foundation, Inc.
f392e843
JD
4
5This file is part of GNU Emacs.
6
b9b1cc14 7GNU Emacs is free software: you can redistribute it and/or modify
f392e843 8it under the terms of the GNU General Public License as published by
b9b1cc14
GM
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
f392e843
JD
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
b9b1cc14 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
f392e843
JD
19
20#ifndef GTKUTIL_H
21#define GTKUTIL_H
22
23
24#ifdef USE_GTK
25
26#include <gtk/gtk.h>
27#include "frame.h"
28
29/* Minimum and maximum values used for GTK scroll bars */
30
7863d625 31#define XG_SB_MIN 1
f392e843 32#define XG_SB_MAX 10000000
7863d625 33#define XG_SB_RANGE (XG_SB_MAX-XG_SB_MIN)
f392e843 34
e5f0bc9a 35/* Key for data that is valid for menus and scroll bars in a frame */
f392e843
JD
36#define XG_FRAME_DATA "emacs_frame"
37
f392e843
JD
38/* Key for data that menu items hold. */
39#define XG_ITEM_DATA "emacs_menuitem"
40
f392e843
JD
41/* This is a list node in a generic list implementation. */
42typedef struct xg_list_node_
43{
44 struct xg_list_node_ *prev;
45 struct xg_list_node_ *next;
46} xg_list_node;
47
48/* This structure is the callback data that is shared for menu items.
49 We need to keep it separate from the frame structure due to
50 detachable menus. The data in the frame structure is only valid while
51 the menu is popped up. This structure is kept around as long as
52 the menu is. */
53typedef struct xg_menu_cb_data_
54{
55 xg_list_node ptrs;
177c0ea7 56
f392e843
JD
57 FRAME_PTR f;
58 Lisp_Object menu_bar_vector;
59 int menu_bar_items_used;
60 GCallback highlight_cb;
61 int ref_count;
62} xg_menu_cb_data;
63
64/* This structure holds callback information for each individual menu item. */
65typedef struct xg_menu_item_cb_data_
66{
67 xg_list_node ptrs;
68
f392e843
JD
69 gulong select_id;
70 Lisp_Object help;
71 gpointer call_data;
72 xg_menu_cb_data *cl_data;
177c0ea7 73
f392e843
JD
74} xg_menu_item_cb_data;
75
42ca4633 76struct _widget_value;
0a4f23f3 77
42ca4633
J
78extern struct _widget_value *malloc_widget_value (void);
79extern void free_widget_value (struct _widget_value *);
383e0970 80
7a6136fd 81extern int xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
383e0970
J
82
83extern char *xg_get_file_name (FRAME_PTR f,
84 char *prompt,
85 char *default_filename,
86 int mustmatch_p,
87 int only_dir_p);
88
8ea90aa3 89extern char *xg_get_font_name (FRAME_PTR f, const char *);
383e0970 90
675e2c69
DN
91extern GtkWidget *xg_create_widget (const char *type,
92 const char *name,
383e0970 93 FRAME_PTR f,
42ca4633 94 struct _widget_value *val,
383e0970
J
95 GCallback select_cb,
96 GCallback deactivate_cb,
e4769531 97 GCallback highlight_cb);
383e0970
J
98
99extern void xg_modify_menubar_widgets (GtkWidget *menubar,
100 FRAME_PTR f,
42ca4633 101 struct _widget_value *val,
383e0970
J
102 int deep_p,
103 GCallback select_cb,
104 GCallback deactivate_cb,
e4769531 105 GCallback highlight_cb);
383e0970
J
106
107extern int xg_update_frame_menubar (FRAME_PTR f);
108
fea9cabd
CY
109extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
110
383e0970
J
111extern int xg_have_tear_offs (void);
112
0eb0f318 113extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
383e0970
J
114
115extern void xg_create_scroll_bar (FRAME_PTR f,
116 struct scroll_bar *bar,
117 GCallback scroll_callback,
118 GCallback end_callback,
675e2c69 119 const char *scroll_bar_name);
0eb0f318 120extern void xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id);
383e0970
J
121
122extern void xg_update_scrollbar_pos (FRAME_PTR f,
0eb0f318 123 ptrdiff_t scrollbar_id,
383e0970
J
124 int top,
125 int left,
126 int width,
127 int height);
128
129extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
130 int portion,
131 int position,
132 int whole);
133extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
c195f2de 134extern int xg_get_default_scrollbar_width (void);
383e0970
J
135
136extern void update_frame_tool_bar (FRAME_PTR f);
137extern void free_frame_tool_bar (FRAME_PTR f);
bfeabdc3 138extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos);
383e0970
J
139
140extern void xg_frame_resized (FRAME_PTR f,
141 int pixelwidth,
142 int pixelheight);
143extern void xg_frame_set_char_size (FRAME_PTR f, int cols, int rows);
144extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
145
146extern void xg_display_open (char *display_name, Display **dpy);
147extern void xg_display_close (Display *dpy);
148extern GdkCursor * xg_create_default_cursor (Display *dpy);
149
150extern int xg_create_frame_widgets (FRAME_PTR f);
aa1859f5 151extern void xg_free_frame_widgets (FRAME_PTR f);
383e0970
J
152extern void x_wm_set_size_hint (FRAME_PTR f,
153 long flags,
154 int user_position);
155extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
3a46642b
J
156extern int xg_check_special_colors (struct frame *f,
157 const char *color_name,
158 XColor *color);
383e0970
J
159
160extern void xg_set_frame_icon (FRAME_PTR f,
161 Pixmap icon_pixmap,
162 Pixmap icon_mask);
5d91377a 163
aa1859f5
J
164extern int xg_prepare_tooltip (FRAME_PTR f,
165 Lisp_Object string,
166 int *width,
167 int *height);
168extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y);
169extern int xg_hide_tooltip (FRAME_PTR f);
170
171
f392e843 172/* Mark all callback data that are Lisp_object:s during GC. */
383e0970 173extern void xg_mark_data (void);
f392e843
JD
174
175/* Initialize GTK specific parts. */
383e0970 176extern void xg_initialize (void);
f392e843
JD
177
178/* Setting scrollbar values invokes the callback. Use this variable
179 to indicate that the callback should do nothing. */
180extern int xg_ignore_gtk_scrollbar;
181
f392e843
JD
182#endif /* USE_GTK */
183#endif /* GTKUTIL_H */