Debian Codegraph @

texk/xdvik/gui/topic-window.h

raw
1 /*
2 * Copyright (c) 2004 Stefan Ulrich
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 */
23
24 #ifndef TOPIC_WINDOW_H_
25 #define TOPIC_WINDOW_H_
26
27 #include "xdvi.h"
28 #include "version.h"
29
30 #include <X11/Xatom.h>
31 #include <X11/Intrinsic.h>
32 #include <X11/StringDefs.h>
33
34 struct topic_info; /* forward declaration */
35
36 struct topic_item {
37 /* topic name */
38 char *topic;
39 /* longer title of topic, displayed as heading in the right window */
40 char *title;
41 /* the widget (subwindow of the right window) associated with the topic */
42 Widget widget;
43 };
44
45 struct topic_info {
46 /* the toplevel shell */
47 Widget shell;
48 /* the topics list */
49 Widget topics_list;
50 /* the right form, parent of the dummy form which
51 contains the right topic-specific window */
52 Widget right_form;
53 /* the topic label in right window */
54 Widget topic_label;
55 /* the currently selected widget */
56 Widget curr_selected;
57 /* callbacks for OK button (may be NULL); it's invoked from within
58 the `real' widget callback and is passed a pointer to this(!) struct topic_info */
59 void (*ok_callback)(XtPointer arg);
60 /* like ok_callback, for the Cancel button */
61 void (*cancel_callback)(XtPointer arg);
62 /* list of topic_items */
63 struct topic_item *items;
64 size_t items_size;
65 /* additional data the callback may need ... */
66 void *data;
67 };
68
69 extern Widget create_topic_window(Widget parent,
70 const char *window_title,
71 const char *widget_name,
72 struct topic_info *info,
73 void (*init_items_func)(struct topic_info *info),
74 /* OK button label (can be NULL) */
75 const char *ok_label,
76 /* Cancel button label (can be NULL) */
77 const char *cancel_label);
78 extern void select_topic(struct topic_info *info, size_t idx);
79 #endif /* TOPIC_WINDOW_H_ */