Back to index

tetex-bin  3.0
topic-window.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 Stefan Ulrich
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00017  * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  * OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  */
00023 
00024 #ifndef TOPIC_WINDOW_H_
00025 #define TOPIC_WINDOW_H_
00026 
00027 #include "xdvi-config.h"
00028 #include "xdvi.h"
00029 #include "version.h"
00030 
00031 #include <X11/Xatom.h>
00032 #include <X11/Intrinsic.h>
00033 #include <X11/StringDefs.h>
00034 
00035 struct topic_info; /* forward declaration */
00036 
00037 struct topic_item {
00038     /* topic name */
00039     char *topic;
00040     /* longer title of topic, displayed as heading in the right window */
00041     char *title;
00042     /* the widget (subwindow of the right window) associated with the topic */
00043     Widget widget;
00044 };
00045 
00046 struct topic_info {
00047     /* the toplevel shell */
00048     Widget shell;
00049     /* the topics list */
00050     Widget topics_list;
00051     /* the right form, parent of the dummy form which
00052        contains the right topic-specific window */
00053     Widget right_form;
00054     /* the topic label in right window */
00055     Widget topic_label;
00056     /* the currently selected widget */
00057     Widget curr_selected;
00058     /* callbacks for OK button (may be NULL); it's invoked from within
00059        the `real' widget callback and is passed a pointer to this(!) struct topic_info */
00060     void (*ok_callback)(XtPointer arg);
00061     /* like ok_callback, for the Cancel button */
00062     void (*cancel_callback)(XtPointer arg);
00063     /* list of topic_items */
00064     struct topic_item *items;
00065     size_t items_size;
00066     /* additional data the callback may need ... */
00067     void *data;
00068 };
00069 
00070 extern Widget create_topic_window(Widget parent,
00071                               const char *window_title,
00072                               const char *widget_name,
00073                               struct topic_info *info,
00074                               void (*init_items_func)(struct topic_info *info),
00075                               /* OK button label (can be NULL) */
00076                               const char *ok_label,
00077                               /* Cancel button label (can be NULL) */
00078                               const char *cancel_label);
00079 extern void select_topic(struct topic_info *info, size_t idx);
00080 #endif /* TOPIC_WINDOW_H_ */