summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/gui/message-window.h
blob: 7e38197abbc85fdc2cea4643e9c91a2d093f2969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * Copyright (c) 2002-2004 the xdvik development team
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef MESSAGE_WINDOW_H_
#define MESSAGE_WINDOW_H_

#define Xdvi_MESSAGE_DIALOG_NAME	"dialog"
#define Xdvi_MESSAGE_SHELL_NAME		"message_popup"


/*
 * Callback before the message window is closed. It is passed
 * the message window widget ID, and the next XtPointer argument
 * in the message dialog calls.
 */
typedef void (*pre_message_cbT)(Widget w, XtPointer arg);
/*
 * Additional callbacks passed in as argument. It is passed
 * the next XtPointer argument in the message dialog calls.
 */
typedef void (*message_cbT)(XtPointer arg);

/* preferred size of dialogs, only used for Xaw ... not really hints, but
   hard-coded values ;-) */
typedef enum popupMessageSizeHintT_ { SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE } popupMessageSizeHintT;
typedef enum popupMessageT_ { MSG_QUESTION, MSG_HELP, MSG_INFO, MSG_WARN, MSG_ERR } popupMessageT;

extern Widget popup_message(Widget parent,
			    popupMessageT type,
			    const char *helptext,
			    const char *format, ...);

extern Widget popup_message_sized(Widget parent,
				  popupMessageT type,
				  popupMessageSizeHintT size,
				  const char *helptext,
				  const char *format, ...);

extern Widget positioned_popup_message(Widget parent,
				       popupMessageT type,
				       int x, int y,
				       const char *helptext, const char *format, ...);

extern Widget choice_dialog(Widget parent,
			    popupMessageT type,
			    const char *helptext,
#ifndef MOTIF
			    const char *ret_action_str,
#endif
			    pre_message_cbT pre_cb, XtPointer arg,
			    const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
			    const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
			    const char *format, ...);

#if MOTIF
/* 3 buttons currently only implemented for Motif */
extern Widget choice3_dialog(Widget parent,
			     popupMessageT type,
			     const char *helptext,
			     pre_message_cbT pre_cb, XtPointer arg,
			     const char *yes_label, message_cbT yes_cb, XtPointer yes_args,
			     const char *no_label, message_cbT no_cb, XtPointer no_args,
			     const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
			     const char *format, ...);
#endif

extern Widget choice_dialog_sized(Widget parent,
				  popupMessageT type,
				  popupMessageSizeHintT size,
				  const char *helptext,
#ifndef MOTIF
				  const char *ret_action_str,
#endif
				  pre_message_cbT pre_cb, XtPointer arg,
				  const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
				  const char *cancel_label,  message_cbT cancel_cb, XtPointer cancel_args,
				  const char *format, ...);

extern Widget positioned_choice_dialog(Widget parent,
				       popupMessageT type,
				       int x_pos, int y_pos,
				       const char *helptext,
#ifndef MOTIF
				       const char *ret_action_str,
#endif
				       pre_message_cbT pre_cb, XtPointer arg,
				       const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
				       const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
				       const char *format, ...);
extern void warn_overstrike(void);
extern Boolean raise_message_windows(void);
extern Boolean is_message_window(Widget w);
extern Boolean kill_message_window(Widget w);

/* XawtextScrollWhenNeeded has been ditched in Xaw7
   (e.g. Xfree >= 4.x); from the man page:
   
   The value XawtextScrollWhenNeeded (and whenNeeded, recognized by
   the converter), is accepted for backwards compatibilty with
   resource specifications written for the Xaw6 Text widget, but
   ignored (effectively treated as XawtextScrollNever).

   So we're forced to use `scrollAlways' here.
*/
#define XAW_SCROLL_ALWAYS XawtextScrollAlways

/* the reconfig stuff has been fixed
   in XFree 4.1.0, vendor release 6510 (Slackware 8.0) */
#define BROKEN_RECONFIG ((				\
	(strstr(ServerVendor(DISP), "XFree") != NULL)	\
	&& VendorRelease(DISP) >= 4000			\
	&& VendorRelease(DISP) < 4002			\
	))

#endif /* MESSAGE_WINDOW_H_ */