1 /* 2 * xutil.h 3 * 4 * Utilities for detailing with X 5 * 6 * (C) 1997 Randall Hopper 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 2. 12 * Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 */ 29 30 #ifndef __XUTIL_H 31 #define __XUTIL_H 32 33 #include <X11/Intrinsic.h> 34 #include "tvtypes.h" 35 #include "tvutil.h" 36 37 typedef enum { 38 TV_DIALOG_TYPE_OK, 39 TV_DIALOG_TYPE_CANCEL, 40 TV_DIALOG_TYPE_YES_NO, 41 TV_DIALOG_TYPE_NOBUTTONS 42 } TV_DIALOG_TYPE; 43 44 #define TV_DIALOG_YES 1 45 #define TV_DIALOG_NO 0 46 47 typedef void XUTIL_RUNCMD_DONECB( TV_BOOL aborted, int status, void *cb_data ); 48 /* aborted - O: T = user aborted (i.e. dismissed dialog) */ 49 /* F = cmd completed (dialog still mapped) */ 50 /* status - O: exit status of process */ 51 52 typedef TV_BOOL XUTIL_RUNCMD_CANCELCB( void *cb_data ); 53 /* Returns: T = abort command; F = continue execution */ 54 55 56 extern char G_transl_ovr_ascii_text[]; 57 extern char G_transl_ovr_ascii_text_1line[]; 58 59 60 #ifdef __cplusplus 61 extern "C" { 62 #endif 63 64 void XUTILAugmentXEnv( char *argv0 ); 65 66 TV_BOOL XUTILBitmapLoad( char *bitmap_file, 67 Widget wgt, 68 Pixmap *pixmap ); 69 70 TV_BOOL XUTILPixmapLoad( char *pixmap_file, 71 Widget wgt, 72 Pixel fg_color, 73 Pixel bg_color, 74 Pixmap *pixmap, 75 Pixmap *pixmap_mask ); 76 77 void XUTILXawScrollbarSetThumb( Widget w, float top, float shown ); 78 79 void XUTILGetVisualBpp( Display *display, 80 XVisualInfo *vi, 81 TV_INT32 *Bpp_pixmap, 82 TV_INT32 *Bpp_fbuffer ); 83 84 void XUTILGetVisualSwaps( Display *display, XVisualInfo *vi, 85 TV_BOOL *swap_bytes, TV_BOOL *swap_shorts ); 86 87 void XUTILGetPixelConvInfo( TV_UINT32 src_rel_mask[3], 88 TV_UINT32 dst_rel_mask[3], 89 TV_INT32 shift [3], 90 TV_UINT32 mask [3] ); 91 92 void XUTILDialogSmartPosition( Widget main_wgt, 93 Widget dialog_wgt ); 94 95 Widget XUTILDialogBuild( Widget toplevel, 96 char title[], char msg[], TV_DIALOG_TYPE type ); 97 98 TV_INT32 XUTILDialogPause( Widget toplevel, 99 char title[], char msg[], TV_DIALOG_TYPE type ); 100 101 void XUTILRunCmdAllowCancel( 102 XtAppContext app_context, 103 char *cmd[], 104 TVUTIL_PIPE_END end[3], 105 XUTIL_RUNCMD_CANCELCB *cancel_test, 106 void *cancel_cb_data, 107 XUTIL_RUNCMD_DONECB *done_cb, 108 void *done_cb_data ); 109 110 Bool XUTILIsWellFormedXLFDFont( char *name ); 111 Bool XUTILIsScalableFont ( char *name ); 112 113 XFontStruct *XUTILLoadQueryScalableFont( 114 Display *dpy, 115 int screen, 116 char *name, 117 int size, 118 char *new_name, 119 int new_name_size ); 120 121 XFontStruct *XUTILLoadPixelSizeFont( 122 Display *dpy, 123 char *name, 124 int pixel_size, 125 char *new_name, 126 int new_name_size ); 127 128 void XUTILRegisterWMDelete( 129 Widget shell_wgt ); 130 131 void XUTILXtPopup( Widget popup_shell, XtGrabKind grab_kind, 132 Widget toplevel ); 133 134 TV_BOOL XUTILXServerIsLocal( Display *display ); 135 136 void XUTILDetermineFrameBufferVisual( Display *display, 137 int screen, 138 XVisualInfo **fb_visual ); 139 140 #ifdef __cplusplus 141 } /* Close 'extern "C"' */ 142 #endif 143 144 #endif 145