upstream
[emacs.git] / src / xwidget.h
blobe5cfe6de9028258e0f7cb35b5a971bad2e7d3686
1 #ifndef XWIDGET_H_INCLUDED
2 #define XWIDGET_H_INCLUDED
4 void x_draw_xwidget_glyph_string (struct glyph_string *s);
5 void syms_of_xwidget ();
7 extern Lisp_Object Qxwidget;
10 int valid_xwidget_p (Lisp_Object object) ;
12 #include <gtk/gtk.h>
16 each xwidget instance/model is described by this struct.
18 lisp pseudovector.
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
29 //here ends the lisp part.
30 //"height" is the marker field
31 int height;
32 int width;
34 //for offscreen widgets, unused if not osr
35 GtkWidget* widget_osr;
36 GtkContainer* widgetwindow_osr;
38 //TODO these are WIP
45 //struct for each xwidget view
46 struct xwidget_view{
47 struct vectorlike_header header;
48 struct xwidget* model; //TODO should be lisp
51 //here ends the lisp part.
52 //"redisplayed" is the marker field
53 int redisplayed; //if touched by redisplay
56 struct window *w; //TODO should be lisp
58 int hidden;//if the "live" instance isnt drawn
60 int initialized;
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;
69 long handler_id;
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))
80 struct xwidget_type
82 /* A symbol uniquely identifying the xwidget type, */
83 Lisp_Object *type;
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);
89 /* Next in list of all supported image types. */
90 struct xwidget_type *next;
93 static struct xwidget_type *lookup_xwidget_type (Lisp_Object symbol);
95 struct xwidget* xwidget_from_id(int id);
97 //extern int xwidget_owns_kbd;
99 void xwidget_start_redisplay();
100 void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix);
102 void xwidget_touch (struct xwidget_view *xw);
104 //void assert_valid_xwidget_id(int id,char *str);
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