comparison src/gui.h @ 398:74fd4e045ea6 r21-2-29

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