diff options
Diffstat (limited to 'src/xwidget.h')
| -rw-r--r-- | src/xwidget.h | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/xwidget.h b/src/xwidget.h new file mode 100644 index 00000000000..fdcf40d8cbb --- /dev/null +++ b/src/xwidget.h | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | /* Support for embedding graphical components in a buffer. | ||
| 2 | |||
| 3 | Copyright (C) 2011-2016 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU Emacs. | ||
| 6 | |||
| 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. | ||
| 11 | |||
| 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. | ||
| 16 | |||
| 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/>. */ | ||
| 19 | |||
| 20 | #ifndef XWIDGET_H_INCLUDED | ||
| 21 | #define XWIDGET_H_INCLUDED | ||
| 22 | |||
| 23 | void x_draw_xwidget_glyph_string (struct glyph_string *s); | ||
| 24 | void syms_of_xwidget (void); | ||
| 25 | |||
| 26 | //extern Lisp_Object Qxwidget; | ||
| 27 | |||
| 28 | |||
| 29 | bool valid_xwidget_spec_p (Lisp_Object object); | ||
| 30 | |||
| 31 | #include <gtk/gtk.h> | ||
| 32 | |||
| 33 | |||
| 34 | /* | ||
| 35 | each xwidget instance/model is described by this struct. | ||
| 36 | |||
| 37 | lisp pseudovector. | ||
| 38 | |||
| 39 | |||
| 40 | */ | ||
| 41 | struct xwidget | ||
| 42 | { | ||
| 43 | struct vectorlike_header header; | ||
| 44 | Lisp_Object plist; //auxilliary data | ||
| 45 | Lisp_Object type; //the widget type | ||
| 46 | Lisp_Object buffer; //buffer where xwidget lives | ||
| 47 | Lisp_Object title; //a title that is used for button labels for instance | ||
| 48 | |||
| 49 | //here ends the lisp part. | ||
| 50 | //"height" is the marker field | ||
| 51 | int height; | ||
| 52 | int width; | ||
| 53 | |||
| 54 | //for offscreen widgets, unused if not osr | ||
| 55 | GtkWidget *widget_osr; | ||
| 56 | GtkWidget *widgetwindow_osr; | ||
| 57 | //this is used if the widget (webkit) is to be wrapped in a scrolled window, | ||
| 58 | GtkWidget *widgetscrolledwindow_osr; | ||
| 59 | /* Non-nil means kill silently if Emacs is exited. */ | ||
| 60 | unsigned int kill_without_query:1; | ||
| 61 | |||
| 62 | }; | ||
| 63 | |||
| 64 | |||
| 65 | //struct for each xwidget view | ||
| 66 | struct xwidget_view | ||
| 67 | { | ||
| 68 | struct vectorlike_header header; | ||
| 69 | Lisp_Object model; | ||
| 70 | Lisp_Object w; | ||
| 71 | |||
| 72 | //here ends the lisp part. | ||
| 73 | //"redisplayed" is the marker field | ||
| 74 | int redisplayed; //if touched by redisplay | ||
| 75 | |||
| 76 | int hidden; //if the "live" instance isnt drawn | ||
| 77 | |||
| 78 | GtkWidget *widget; | ||
| 79 | GtkWidget *widgetwindow; | ||
| 80 | GtkWidget *emacswindow; | ||
| 81 | int x; | ||
| 82 | int y; | ||
| 83 | int clip_right; | ||
| 84 | int clip_bottom; | ||
| 85 | int clip_top; | ||
| 86 | int clip_left; | ||
| 87 | |||
| 88 | |||
| 89 | long handler_id; | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* Test for xwidget pseudovector*/ | ||
| 93 | #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET) | ||
| 94 | #define XXWIDGET(a) (eassert (XWIDGETP(a)), \ | ||
| 95 | (struct xwidget *) XUNTAG(a, Lisp_Vectorlike)) | ||
| 96 | |||
| 97 | #define CHECK_XWIDGET(x) \ | ||
| 98 | CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x) | ||
| 99 | |||
| 100 | /* Test for xwidget_view pseudovector */ | ||
| 101 | #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW) | ||
| 102 | #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P(a)), \ | ||
| 103 | (struct xwidget_view *) XUNTAG(a, Lisp_Vectorlike)) | ||
| 104 | |||
| 105 | #define CHECK_XWIDGET_VIEW(x) \ | ||
| 106 | CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x) | ||
| 107 | |||
| 108 | struct xwidget_type | ||
| 109 | { | ||
| 110 | /* A symbol uniquely identifying the xwidget type, */ | ||
| 111 | Lisp_Object *type; | ||
| 112 | |||
| 113 | /* Check that SPEC is a valid image specification for the given | ||
| 114 | image type. Value is non-zero if SPEC is valid. */ | ||
| 115 | int (*valid_p) (Lisp_Object spec); | ||
| 116 | |||
| 117 | /* Next in list of all supported image types. */ | ||
| 118 | struct xwidget_type *next; | ||
| 119 | }; | ||
| 120 | |||
| 121 | |||
| 122 | struct xwidget *xwidget_from_id (int id); | ||
| 123 | |||
| 124 | void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix); | ||
| 125 | |||
| 126 | struct xwidget *lookup_xwidget (Lisp_Object spec); | ||
| 127 | #define XG_XWIDGET "emacs_xwidget" | ||
| 128 | #define XG_XWIDGET_VIEW "emacs_xwidget_view" | ||
| 129 | void xwidget_view_delete_all_in_window (struct window *w); | ||
| 130 | |||
| 131 | void kill_buffer_xwidgets (Lisp_Object buffer); | ||
| 132 | #endif /* XWIDGET_H_INCLUDED */ | ||