]> code.delx.au - gnu-emacs/blob - src/xwidget.h
merge from trunk
[gnu-emacs] / src / xwidget.h
1 #ifndef XWIDGET_H_INCLUDED
2 #define XWIDGET_H_INCLUDED
3
4 void x_draw_xwidget_glyph_string (struct glyph_string *s);
5 void syms_of_xwidget ();
6
7 extern Lisp_Object Qxwidget;
8
9
10 int valid_xwidget_spec_p (Lisp_Object object) ;
11
12 #include <gtk/gtk.h>
13
14
15 /*
16 each xwidget instance/model is described by this struct.
17
18 lisp pseudovector.
19
20
21 */
22 struct xwidget{
23 struct vectorlike_header header;
24 Lisp_Object plist;//auxilliary data
25 Lisp_Object type;//the widget type
26 Lisp_Object buffer; //buffer where xwidget lives
27 Lisp_Object title;//a title that is used for button labels for instance
28
29 //here ends the lisp part.
30 //"height" is the marker field
31 int height;
32 int width;
33
34 //for offscreen widgets, unused if not osr
35 GtkWidget* widget_osr;
36 GtkWidget* widgetwindow_osr;
37 /* Non-nil means kill silently if Emacs is exited. */
38 unsigned int kill_without_query : 1;
39
40 };
41
42
43 //struct for each xwidget view
44 struct xwidget_view {
45 struct vectorlike_header header;
46 Lisp_Object model;
47 Lisp_Object w;
48
49 //here ends the lisp part.
50 //"redisplayed" is the marker field
51 int redisplayed; //if touched by redisplay
52
53 int hidden;//if the "live" instance isnt drawn
54
55 GtkWidget* widget;
56 GtkWidget* widgetwindow;
57 GtkWidget* emacswindow;
58 int x; int y;
59 int clip_right; int clip_bottom; int clip_top; int clip_left;
60
61
62 long handler_id;
63 };
64
65 /* Test for xwidget pseudovector*/
66 #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
67 #define XXWIDGET(a) (eassert (XWIDGETP(a)), \
68 (struct xwidget *) XUNTAG(a, Lisp_Vectorlike))
69
70 #define CHECK_XWIDGET(x) \
71 CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)
72
73 /* Test for xwidget_view pseudovector */
74 #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
75 #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P(a)), \
76 (struct xwidget_view *) XUNTAG(a, Lisp_Vectorlike))
77
78 #define CHECK_XWIDGET_VIEW(x) \
79 CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)
80
81 struct xwidget_type
82 {
83 /* A symbol uniquely identifying the xwidget type, */
84 Lisp_Object *type;
85
86 /* Check that SPEC is a valid image specification for the given
87 image type. Value is non-zero if SPEC is valid. */
88 int (* valid_p) (Lisp_Object spec);
89
90 /* Next in list of all supported image types. */
91 struct xwidget_type *next;
92 };
93
94 static struct xwidget_type *lookup_xwidget_type (Lisp_Object symbol);
95
96 struct xwidget* xwidget_from_id(int id);
97
98 //extern int xwidget_owns_kbd;
99
100 void xwidget_start_redisplay();
101 void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix);
102
103 void xwidget_touch (struct xwidget_view *xw);
104
105 //void assert_valid_xwidget_id(int id,char *str);
106
107 struct xwidget* lookup_xwidget (Lisp_Object spec);
108 #define XG_XWIDGET "emacs_xwidget"
109 #define XG_XWIDGET_VIEW "emacs_xwidget_view"
110 void xwidget_view_delete_all_in_window( struct window *w );
111
112 void kill_buffer_xwidgets (Lisp_Object buffer);
113 #endif /* XWIDGET_H_INCLUDED */