Fix description of 'C-z' in User manual
[emacs.git] / src / xwidget.h
blob8fc382188f482a9119cbb3802135d6bb2238ff46
1 /* Support for embedding graphical components in a buffer.
3 Copyright (C) 2011-2016 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 (at
10 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 XWIDGET_H_INCLUDED
21 #define XWIDGET_H_INCLUDED
23 #include "lisp.h"
25 struct glyph_matrix;
26 struct glyph_string;
27 struct xwidget;
28 struct xwidget_view;
29 struct window;
31 #ifdef HAVE_XWIDGETS
32 # include <gtk/gtk.h>
34 struct xwidget
36 struct vectorlike_header header;
38 /* Auxiliary data. */
39 Lisp_Object plist;
41 /* The widget type. */
42 Lisp_Object type;
44 /* The buffer where the xwidget lives. */
45 Lisp_Object buffer;
47 /* A title used for button labels, for instance. */
48 Lisp_Object title;
50 /* Here ends the Lisp part. "height" is the marker field. */
52 int height;
53 int width;
55 /* For offscreen widgets, unused if not osr. */
56 GtkWidget *widget_osr;
57 GtkWidget *widgetwindow_osr;
59 /* Used if the widget (webkit) is to be wrapped in a scrolled window. */
60 GtkWidget *widgetscrolledwindow_osr;
62 /* Kill silently if Emacs is exited. */
63 bool_bf kill_without_query : 1;
66 struct xwidget_view
68 struct vectorlike_header header;
69 Lisp_Object model;
70 Lisp_Object w;
72 /* Here ends the lisp part. "redisplayed" is the marker field. */
74 /* If touched by redisplay. */
75 bool redisplayed;
77 /* The "live" instance isn't drawn. */
78 bool hidden;
80 GtkWidget *widget;
81 GtkWidget *widgetwindow;
82 GtkWidget *emacswindow;
83 int x;
84 int y;
85 int clip_right;
86 int clip_bottom;
87 int clip_top;
88 int clip_left;
90 long handler_id;
92 #endif
94 /* Test for xwidget pseudovector. */
95 #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
96 #define XXWIDGET(a) (eassert (XWIDGETP (a)), \
97 (struct xwidget *) XUNTAG (a, Lisp_Vectorlike))
99 #define CHECK_XWIDGET(x) \
100 CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)
102 /* Test for xwidget_view pseudovector. */
103 #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
104 #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \
105 (struct xwidget_view *) XUNTAG (a, Lisp_Vectorlike))
107 #define CHECK_XWIDGET_VIEW(x) \
108 CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)
110 #define XG_XWIDGET "emacs_xwidget"
111 #define XG_XWIDGET_VIEW "emacs_xwidget_view"
113 #ifdef HAVE_XWIDGETS
114 void syms_of_xwidget (void);
115 bool valid_xwidget_spec_p (Lisp_Object);
116 void xwidget_view_delete_all_in_window (struct window *);
117 void x_draw_xwidget_glyph_string (struct glyph_string *);
118 struct xwidget *lookup_xwidget (Lisp_Object spec);
119 void xwidget_end_redisplay (struct window *, struct glyph_matrix *);
120 void kill_buffer_xwidgets (Lisp_Object);
121 #else
122 INLINE_HEADER_BEGIN
123 INLINE void syms_of_xwidget (void) {}
124 INLINE bool valid_xwidget_spec_p (Lisp_Object obj) { return false; }
125 INLINE void xwidget_view_delete_all_in_window (struct window *w) {}
126 INLINE void x_draw_xwidget_glyph_string (struct glyph_string *s) { eassume (0); }
127 INLINE struct xwidget *lookup_xwidget (Lisp_Object obj) { eassume (0); }
128 INLINE void xwidget_end_redisplay (struct window *w, struct glyph_matrix *m) {}
129 INLINE void kill_buffer_xwidgets (Lisp_Object buf) {}
130 INLINE_HEADER_END
131 #endif
133 #endif /* XWIDGET_H_INCLUDED */