Move src/objects.c to src/ui
[sxemacs] / src / ui / gui.h
1 /* Generic GUI code. (menubars, scrollbars, toolbars, dialogs)
2    Copyright (C) 1995 Board of Trustees, University of Illinois.
3    Copyright (C) 1995, 1996 Ben Wing.
4    Copyright (C) 1995 Sun Microsystems, Inc.
5
6 This file is part of SXEmacs
7
8 SXEmacs is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 SXEmacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
20
21
22 /* Synched up with: Not in FSF. */
23
24 /* Written by kkm on 12/24/97 */
25
26 #ifndef INCLUDED_gui_h_
27 #define INCLUDED_gui_h_
28
29 int separator_string_p(const Bufbyte * s);
30 void get_gui_callback(Lisp_Object, Lisp_Object *, Lisp_Object *);
31 int gui_item_equal_sans_selected(Lisp_Object obj1, Lisp_Object obj2, int depth);
32
33 extern int popup_up_p;
34
35 /************************************************************************/
36 /*                      Image Instance Object                           */
37 /************************************************************************/
38
39 /* This structure describes gui button,
40    menu item or submenu properties */
41 struct Lisp_Gui_Item {
42         struct lcrecord_header header;
43         Lisp_Object name;       /* String */
44         Lisp_Object callback;   /* Symbol or form */
45         Lisp_Object callback_ex;        /* Form taking context arguments */
46         Lisp_Object suffix;     /* String */
47         Lisp_Object active;     /* Form */
48         Lisp_Object included;   /* Form */
49         Lisp_Object config;     /* Anything EQable */
50         Lisp_Object filter;     /* Form */
51         Lisp_Object style;      /* Symbol */
52         Lisp_Object selected;   /* Form */
53         Lisp_Object keys;       /* String */
54         Lisp_Object accelerator;        /* Char or Symbol  */
55         Lisp_Object value;      /* Anything you like */
56 };
57
58 DECLARE_LRECORD(gui_item, Lisp_Gui_Item);
59 #define XGUI_ITEM(x) XRECORD (x, gui_item, Lisp_Gui_Item)
60 #define XSETGUI_ITEM(x, p) XSETRECORD (x, p, gui_item)
61 #define GUI_ITEMP(x) RECORDP (x, gui_item)
62 #define CHECK_GUI_ITEM(x) CHECK_RECORD (x, gui_item)
63 #define CONCHECK_GUI_ITEM(x) CONCHECK_RECORD (x, gui_item)
64
65 int update_gui_item_keywords(Lisp_Object gui_item, Lisp_Object item);
66 Lisp_Object copy_gui_item(Lisp_Object gui_item);
67 Lisp_Object widget_gui_parse_item_keywords(Lisp_Object item);
68 int gui_item_add_keyval_pair(Lisp_Object gui_item,
69                              Lisp_Object key, Lisp_Object val,
70                              Error_behavior errb);
71 Lisp_Object gui_parse_item_keywords(Lisp_Object item);
72 Lisp_Object gui_parse_item_keywords_no_errors(Lisp_Object item);
73 void gui_add_item_keywords_to_plist(Lisp_Object plist, Lisp_Object gui_item);
74 int gui_item_active_p(Lisp_Object);
75 int gui_item_selected_p(Lisp_Object);
76 Lisp_Object gui_item_list_find_selected(Lisp_Object gui_item_list);
77 int gui_item_included_p(Lisp_Object, Lisp_Object into);
78 Lisp_Object gui_item_accelerator(Lisp_Object gui_item);
79 Lisp_Object gui_name_accelerator(Lisp_Object name);
80 int gui_item_id_hash(Lisp_Object, Lisp_Object gui_item, int);
81 unsigned int gui_item_display_flush_left(Lisp_Object pgui_item,
82                                          char *buf, Bytecount buf_len);
83 unsigned int gui_item_display_flush_right(Lisp_Object gui_item,
84                                           char *buf, Bytecount buf_len);
85
86 Lisp_Object allocate_gui_item(void);
87 void gui_item_init(Lisp_Object gui_item);
88 Lisp_Object parse_gui_item_tree_children(Lisp_Object list);
89 Lisp_Object copy_gui_item_tree(Lisp_Object arg);
90
91 extern Lisp_Object Qmenu_no_selection_hook, Qdelete_dialog_box_hook;
92
93 /* this is mswindows biased but reasonably safe I think */
94 #define GUI_ITEM_ID_SLOTS 8
95 #define GUI_ITEM_ID_MIN(s) (s * 0x2000)
96 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s))
97 #define GUI_ITEM_ID_BITS(x,s) (((x) & 0x1FFF) + GUI_ITEM_ID_MIN (s))
98
99 #define MAX_MENUITEM_LENGTH 128
100
101 #endif                          /* INCLUDED_gui_h_ */