Back to index

tetex-bin  3.0
message-window.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2002-2004 the xdvik development team
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 #ifndef MESSAGE_WINDOW_H_
00024 #define MESSAGE_WINDOW_H_
00025 
00026 #define Xdvi_MESSAGE_DIALOG_NAME   "dialog"
00027 #define Xdvi_MESSAGE_SHELL_NAME           "message_popup"
00028 
00029 
00030 /*
00031  * Callback before the message window is closed. It is passed
00032  * the message window widget ID, and the next XtPointer argument
00033  * in the message dialog calls.
00034  */
00035 typedef void (*pre_message_cbT)(Widget w, XtPointer arg);
00036 /*
00037  * Additional callbacks passed in as argument. It is passed
00038  * the next XtPointer argument in the message dialog calls.
00039  */
00040 typedef void (*message_cbT)(XtPointer arg);
00041 
00042 /* preferred size of dialogs, only used for Xaw ... not really hints, but
00043    hard-coded values ;-) */
00044 typedef enum popupMessageSizeHintT_ { SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE } popupMessageSizeHintT;
00045 typedef enum popupMessageT_ { MSG_QUESTION, MSG_HELP, MSG_INFO, MSG_WARN, MSG_ERR } popupMessageT;
00046 
00047 extern Widget popup_message(Widget parent,
00048                          popupMessageT type,
00049                          const char *helptext,
00050                          const char *format, ...);
00051 
00052 extern Widget popup_message_sized(Widget parent,
00053                               popupMessageT type,
00054                               popupMessageSizeHintT size,
00055                               const char *helptext,
00056                               const char *format, ...);
00057 
00058 extern Widget positioned_popup_message(Widget parent,
00059                                    popupMessageT type,
00060                                    int x, int y,
00061                                    const char *helptext, const char *format, ...);
00062 
00063 extern Widget choice_dialog(Widget parent,
00064                          popupMessageT type,
00065                          const char *helptext,
00066 #ifndef MOTIF
00067                          const char *ret_action_str,
00068 #endif
00069                          pre_message_cbT pre_cb, XtPointer arg,
00070                          const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
00071                          const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
00072                          const char *format, ...);
00073 
00074 #if MOTIF
00075 /* 3 buttons currently only implemented for Motif */
00076 extern Widget choice3_dialog(Widget parent,
00077                           popupMessageT type,
00078                           const char *helptext,
00079                           pre_message_cbT pre_cb, XtPointer arg,
00080                           const char *yes_label, message_cbT yes_cb, XtPointer yes_args,
00081                           const char *no_label, message_cbT no_cb, XtPointer no_args,
00082                           const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
00083                           const char *format, ...);
00084 #endif
00085 
00086 extern Widget choice_dialog_sized(Widget parent,
00087                               popupMessageT type,
00088                               popupMessageSizeHintT size,
00089                               const char *helptext,
00090 #ifndef MOTIF
00091                               const char *ret_action_str,
00092 #endif
00093                               pre_message_cbT pre_cb, XtPointer arg,
00094                               const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
00095                               const char *cancel_label,  message_cbT cancel_cb, XtPointer cancel_args,
00096                               const char *format, ...);
00097 
00098 extern Widget positioned_choice_dialog(Widget parent,
00099                                    popupMessageT type,
00100                                    int x_pos, int y_pos,
00101                                    const char *helptext,
00102 #ifndef MOTIF
00103                                    const char *ret_action_str,
00104 #endif
00105                                    pre_message_cbT pre_cb, XtPointer arg,
00106                                    const char *ok_label, message_cbT ok_cb, XtPointer ok_args,
00107                                    const char *cancel_label, message_cbT cancel_cb, XtPointer cancel_args,
00108                                    const char *format, ...);
00109 extern void warn_overstrike(void);
00110 extern Boolean raise_message_windows(void);
00111 extern Boolean is_message_window(Widget w);
00112 extern Boolean kill_message_window(Widget w);
00113 
00114 /* XawtextScrollWhenNeeded has been ditched in Xaw7
00115    (e.g. Xfree >= 4.x); from the man page:
00116    
00117    The value XawtextScrollWhenNeeded (and whenNeeded, recognized by
00118    the converter), is accepted for backwards compatibilty with
00119    resource specifications written for the Xaw6 Text widget, but
00120    ignored (effectively treated as XawtextScrollNever).
00121 
00122    So we're forced to use `scrollAlways' here.
00123 */
00124 #define XAW_SCROLL_ALWAYS XawtextScrollAlways
00125 
00126 /* the reconfig stuff has been fixed
00127    in XFree 4.1.0, vendor release 6510 (Slackware 8.0) */
00128 #define BROKEN_RECONFIG ((                       \
00129        (strstr(ServerVendor(DISP), "XFree") != NULL)    \
00130        && VendorRelease(DISP) >= 4000                   \
00131        && VendorRelease(DISP) < 4002                    \
00132        ))
00133 
00134 #endif /* MESSAGE_WINDOW_H_ */