comparison src/gui.h @ 418:e804706bfb8c r21-2-17

Import from CVS: tag r21-2-17
author cvs
date Mon, 13 Aug 2007 11:23:13 +0200
parents 697ef44129c6
children 41dbb7a9d5f2
comparison
equal deleted inserted replaced
417:43a18b32d56e 418:e804706bfb8c
30 int separator_string_p (CONST char *s); 30 int separator_string_p (CONST char *s);
31 void get_gui_callback (Lisp_Object, Lisp_Object *, Lisp_Object *); 31 void get_gui_callback (Lisp_Object, Lisp_Object *, Lisp_Object *);
32 32
33 extern int popup_up_p; 33 extern int popup_up_p;
34 34
35 /************************************************************************/
36 /* Image Instance Object */
37 /************************************************************************/
38
39 DECLARE_LRECORD (gui_item, struct Lisp_Gui_Item);
40 #define XGUI_ITEM(x) \
41 XRECORD (x, gui_item, struct Lisp_Gui_Item)
42 #define XSETGUI_ITEM(x, p) XSETRECORD (x, p, gui_item)
43 #define GUI_ITEMP(x) RECORDP (x, gui_item)
44 #define GC_GUI_ITEMP(x) GC_RECORDP (x, gui_item)
45 #define CHECK_GUI_ITEM(x) CHECK_RECORD (x, gui_item)
46 #define CONCHECK_GUI_ITEM(x) CONCHECK_RECORD (x, gui_item)
47
35 /* This structure describes gui button, 48 /* This structure describes gui button,
36 menu item or submenu properties */ 49 menu item or submenu properties */
37 struct gui_item 50 struct Lisp_Gui_Item
38 { 51 {
52 struct lcrecord_header header;
39 Lisp_Object name; /* String */ 53 Lisp_Object name; /* String */
40 Lisp_Object callback; /* Symbol or form */ 54 Lisp_Object callback; /* Symbol or form */
41 Lisp_Object suffix; /* String */ 55 Lisp_Object suffix; /* String */
42 Lisp_Object active; /* Form */ 56 Lisp_Object active; /* Form */
43 Lisp_Object included; /* Form */ 57 Lisp_Object included; /* Form */
45 Lisp_Object filter; /* Form */ 59 Lisp_Object filter; /* Form */
46 Lisp_Object style; /* Symbol */ 60 Lisp_Object style; /* Symbol */
47 Lisp_Object selected; /* Form */ 61 Lisp_Object selected; /* Form */
48 Lisp_Object keys; /* String */ 62 Lisp_Object keys; /* String */
49 }; 63 };
50 #define GUI_ITEM_LAST_GCPROED keys
51 #define GUI_ITEM_GCPRO_COUNT \
52 (slot_offset(struct gui_item, GUI_ITEM_LAST_GCPROED) / sizeof(Lisp_Object) + 1)
53
54 /*
55 * gui_item is a struct containing a bunch of Lisp_Object
56 * members. We need to GC-protect all the member slots.
57 * Rather than build a long chain of individual gcpro structs
58 * that protect the slots individually, we protect all the
59 * member slots by pretending the struct is an array. ANSI C
60 * requires this hack to work, ugly though it is.
61 */
62 #define GCPRO_GUI_ITEM(pgui_item) \
63 do { \
64 Lisp_Object *gui_item_array = (Lisp_Object *) pgui_item; \
65 GCPRO1 (gui_item_array[0]); \
66 gcpro1.nvars = GUI_ITEM_GCPRO_COUNT; \
67 } while (0);
68 64
69 extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included; 65 extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included;
70 extern Lisp_Object Q_keys, Q_selected, Q_suffix, Qradio, Qtoggle; 66 extern Lisp_Object Q_keys, Q_selected, Q_suffix, Qradio, Qtoggle;
71 extern Lisp_Object Q_key_sequence, Q_label, Q_callback; 67 extern Lisp_Object Q_key_sequence, Q_label, Q_callback;
72 68
73 void gui_item_init (struct gui_item *pgui_item); 69 void gui_item_add_keyval_pair (Lisp_Object,
74 void gui_item_add_keyval_pair (struct gui_item *pgui_item,
75 Lisp_Object key, Lisp_Object val, 70 Lisp_Object key, Lisp_Object val,
76 Error_behavior errb); 71 Error_behavior errb);
77 void gui_parse_item_keywords (Lisp_Object item, struct gui_item *pgui_item); 72 Lisp_Object gui_parse_item_keywords (Lisp_Object item);
78 void gui_parse_item_keywords_no_errors (Lisp_Object item, struct gui_item *pgui_item); 73 Lisp_Object gui_parse_item_keywords_no_errors (Lisp_Object item);
79 int gui_item_active_p (CONST struct gui_item *pgui_item); 74 int gui_item_active_p (Lisp_Object);
80 int gui_item_selected_p (CONST struct gui_item *pgui_item); 75 int gui_item_selected_p (Lisp_Object);
81 int gui_item_included_p (CONST struct gui_item *pgui_item, Lisp_Object into); 76 int gui_item_included_p (Lisp_Object, Lisp_Object into);
82 int gui_item_hash (Lisp_Object, struct gui_item*, int); 77 int gui_item_id_hash (Lisp_Object, Lisp_Object gui_item, int);
83 Lisp_Object mark_gui_item (struct gui_item* p, void (*markobj) (Lisp_Object)); 78 unsigned int gui_item_display_flush_left (Lisp_Object pgui_item,
84 unsigned int gui_item_display_flush_left (CONST struct gui_item *pgui_item,
85 char* buf, Bytecount buf_len); 79 char* buf, Bytecount buf_len);
86 unsigned int gui_item_display_flush_right (CONST struct gui_item *pgui_item, 80 unsigned int gui_item_display_flush_right (Lisp_Object gui_item,
87 char* buf, Bytecount buf_len); 81 char* buf, Bytecount buf_len);
82
83 Lisp_Object allocate_gui_item ();
84 void gui_item_init (Lisp_Object gui_item);
88 85
89 /* this is mswindows biased but reasonably safe I think */ 86 /* this is mswindows biased but reasonably safe I think */
90 #define GUI_ITEM_ID_SLOTS 8 87 #define GUI_ITEM_ID_SLOTS 8
91 #define GUI_ITEM_ID_MIN(s) (s * 0x2000) 88 #define GUI_ITEM_ID_MIN(s) (s * 0x2000)
92 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s)) 89 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s))