]> code.delx.au - gnu-emacs/blob - src/xwidget.h
upstream
[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_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 GtkContainer* widgetwindow_osr;
37
38 //TODO these are WIP
39
40
41
42 };
43
44
45 //struct for each xwidget view
46 struct xwidget_view{
47 struct vectorlike_header header;
48 struct xwidget* model; //TODO should be lisp
49
50
51 //here ends the lisp part.
52 //"redisplayed" is the marker field
53 int redisplayed; //if touched by redisplay
54
55
56 struct window *w; //TODO should be lisp
57
58 int hidden;//if the "live" instance isnt drawn
59
60 int initialized;
61
62 GtkWidget* widget;
63 GtkContainer* widgetwindow;
64 GtkContainer* emacswindow;
65 int x; int y;
66 int clip_right; int clip_bottom; int clip_top; int clip_left;
67
68
69 long handler_id;
70 };
71
72
73 /* Test for xwidget (xwidget . spec) (car must be the symbol xwidget)*/
74 #define XWIDGETP(x) (CONSP (x) && EQ (XCAR (x), Qxwidget))
75 /* Test for xwidget pseudovector*/
76 #define XXWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
77 #define XXWIDGET(a) (eassert (XWIDGETP(a)),(struct xwidget *) XPNTR(a))
78
79
80 struct xwidget_type
81 {
82 /* A symbol uniquely identifying the xwidget type, */
83 Lisp_Object *type;
84
85 /* Check that SPEC is a valid image specification for the given
86 image type. Value is non-zero if SPEC is valid. */
87 int (* valid_p) (Lisp_Object spec);
88
89 /* Next in list of all supported image types. */
90 struct xwidget_type *next;
91 };
92
93 static struct xwidget_type *lookup_xwidget_type (Lisp_Object symbol);
94
95 struct xwidget* xwidget_from_id(int id);
96
97 //extern int xwidget_owns_kbd;
98
99 void xwidget_start_redisplay();
100 void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix);
101
102 void xwidget_touch (struct xwidget_view *xw);
103
104 //void assert_valid_xwidget_id(int id,char *str);
105
106 struct xwidget* lookup_xwidget (Lisp_Object spec);
107 #define XG_XWIDGET "emacs_xwidget"
108 #define XG_XWIDGET_VIEW "emacs_xwidget_view"
109 void xwidget_view_delete_all_in_window( struct window *w );
110 #endif