comparison src/gui.h @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents b8cc9ab3f761
children e804706bfb8c
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
22 22
23 /* Synched up with: Not in FSF. */ 23 /* Synched up with: Not in FSF. */
24 24
25 /* Written by kkm on 12/24/97 */ 25 /* Written by kkm on 12/24/97 */
26 26
27 #ifndef INCLUDED_gui_h_ 27 #ifndef _XEMACS_GUI_H_
28 #define INCLUDED_gui_h_ 28 #define _XEMACS_GUI_H_
29 29
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 /* This structure describes gui button, 35 /* This structure describes gui button,
40 menu item or submenu properties */ 36 menu item or submenu properties */
41 struct Lisp_Gui_Item 37 struct gui_item
42 { 38 {
43 struct lcrecord_header header;
44 Lisp_Object name; /* String */ 39 Lisp_Object name; /* String */
45 Lisp_Object callback; /* Symbol or form */ 40 Lisp_Object callback; /* Symbol or form */
46 Lisp_Object callback_ex; /* Form taking context arguments */
47 Lisp_Object suffix; /* String */ 41 Lisp_Object suffix; /* String */
48 Lisp_Object active; /* Form */ 42 Lisp_Object active; /* Form */
49 Lisp_Object included; /* Form */ 43 Lisp_Object included; /* Form */
50 Lisp_Object config; /* Anything EQable */ 44 Lisp_Object config; /* Anything EQable */
51 Lisp_Object filter; /* Form */ 45 Lisp_Object filter; /* Form */
52 Lisp_Object style; /* Symbol */ 46 Lisp_Object style; /* Symbol */
53 Lisp_Object selected; /* Form */ 47 Lisp_Object selected; /* Form */
54 Lisp_Object keys; /* String */ 48 Lisp_Object keys; /* String */
55 Lisp_Object accelerator; /* Char or Symbol */
56 Lisp_Object value; /* Anything you like */
57 }; 49 };
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)
58 53
59 DECLARE_LRECORD (gui_item, Lisp_Gui_Item); 54 /*
60 #define XGUI_ITEM(x) XRECORD (x, gui_item, Lisp_Gui_Item) 55 * gui_item is a struct containing a bunch of Lisp_Object
61 #define XSETGUI_ITEM(x, p) XSETRECORD (x, p, gui_item) 56 * members. We need to GC-protect all the member slots.
62 #define GUI_ITEMP(x) RECORDP (x, gui_item) 57 * Rather than build a long chain of individual gcpro structs
63 #define CHECK_GUI_ITEM(x) CHECK_RECORD (x, gui_item) 58 * that protect the slots individually, we protect all the
64 #define CONCHECK_GUI_ITEM(x) CONCHECK_RECORD (x, gui_item) 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);
65 68
66 extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included; 69 extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included;
67 extern Lisp_Object Q_keys, Q_selected, Q_suffix, Qradio, Qtoggle; 70 extern Lisp_Object Q_keys, Q_selected, Q_suffix, Qradio, Qtoggle;
68 extern Lisp_Object Q_key_sequence, Q_label, Q_callback, Q_callback_ex, Q_value; 71 extern Lisp_Object Q_key_sequence, Q_label, Q_callback;
69 72
70 void gui_item_add_keyval_pair (Lisp_Object, 73 void gui_item_init (struct gui_item *pgui_item);
74 void gui_item_add_keyval_pair (struct gui_item *pgui_item,
71 Lisp_Object key, Lisp_Object val, 75 Lisp_Object key, Lisp_Object val,
72 Error_behavior errb); 76 Error_behavior errb);
73 Lisp_Object gui_parse_item_keywords (Lisp_Object item); 77 void gui_parse_item_keywords (Lisp_Object item, struct gui_item *pgui_item);
74 Lisp_Object gui_parse_item_keywords_no_errors (Lisp_Object item); 78 void gui_parse_item_keywords_no_errors (Lisp_Object item, struct gui_item *pgui_item);
75 void gui_add_item_keywords_to_plist (Lisp_Object plist, Lisp_Object gui_item); 79 int gui_item_active_p (CONST struct gui_item *pgui_item);
76 int gui_item_active_p (Lisp_Object); 80 int gui_item_selected_p (CONST struct gui_item *pgui_item);
77 int gui_item_selected_p (Lisp_Object); 81 int gui_item_included_p (CONST struct gui_item *pgui_item, Lisp_Object into);
78 int gui_item_included_p (Lisp_Object, Lisp_Object into); 82 int gui_item_hash (Lisp_Object, struct gui_item*, int);
79 Lisp_Object gui_item_accelerator (Lisp_Object gui_item); 83 Lisp_Object mark_gui_item (struct gui_item* p, void (*markobj) (Lisp_Object));
80 Lisp_Object gui_name_accelerator (Lisp_Object name); 84 unsigned int gui_item_display_flush_left (CONST struct gui_item *pgui_item,
81 int gui_item_id_hash (Lisp_Object, Lisp_Object gui_item, int);
82 unsigned int gui_item_display_flush_left (Lisp_Object pgui_item,
83 char* buf, Bytecount buf_len); 85 char* buf, Bytecount buf_len);
84 unsigned int gui_item_display_flush_right (Lisp_Object gui_item, 86 unsigned int gui_item_display_flush_right (CONST struct gui_item *pgui_item,
85 char* buf, Bytecount buf_len); 87 char* buf, Bytecount buf_len);
86
87 Lisp_Object allocate_gui_item (void);
88 void gui_item_init (Lisp_Object gui_item);
89 Lisp_Object parse_gui_item_tree_children (Lisp_Object list);
90 Lisp_Object copy_gui_item_tree (Lisp_Object arg);
91 88
92 /* this is mswindows biased but reasonably safe I think */ 89 /* this is mswindows biased but reasonably safe I think */
93 #define GUI_ITEM_ID_SLOTS 8 90 #define GUI_ITEM_ID_SLOTS 8
94 #define GUI_ITEM_ID_MIN(s) (s * 0x2000) 91 #define GUI_ITEM_ID_MIN(s) (s * 0x2000)
95 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s)) 92 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s))
96 #define GUI_ITEM_ID_BITS(x,s) (((x) & 0x1FFF) + GUI_ITEM_ID_MIN (s)) 93 #define GUI_ITEM_ID_BITS(x,s) (((x) & 0x1FFF) + GUI_ITEM_ID_MIN (s))
97 94
98 #define MAX_MENUITEM_LENGTH 128 95 #endif /* _XEMACS_GUI_H_ */
99
100 #endif /* INCLUDED_gui_h_ */