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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
/***************************************************************************/
/* This code is part of X-toolkit widget library called Nws */
/* Copyright (c) 1997,1998,1999 Ondrejicka Stefan */
/* (ondrej@idata.sk) */
/* Distributed under GPL 2 or later */
/***************************************************************************/
#ifndef MW_NWS_H
#define MW_NWS_H
#include <X11/Xlib.h>
#include <X11/xpm.h>
#ifndef XtRBox_type
#define XtRBox_type "Box_type"
#endif
#ifndef XtRNwsJustify
#define XtRNwsJustify "NwsJustify"
#endif
#ifndef XtRIcon
#define XtRIcon "Icon"
#endif
#ifndef XtRCheck_type
#define XtRCheck_type "Check_type"
#endif
#ifndef XtRObject_type
#define XtRObject_type "Object_type"
#endif
#ifndef XtROrientation
#define XtROrientation "Orientation"
#endif
#ifndef XtRListStruct
#define XtRListStruct "ListStruct"
#endif
#ifndef XtRButtonMode
#define XtRButtonMode "ButtonMode"
#endif
#ifndef XtRStringList
#define XtRStringList "StringList"
#endif
/* constant for box type definition */
#define XtCno_box 0
#define XtCsimple_box 1
#define XtCup_box 2
#define XtCdown_box 3
#define XtCframein_box 4
#define XtCframeout_box 5
#define XtCshadow_box 6
/* constant for justifycation definition */
#define XtCcenter 0
#define XtCright 1
#define XtCleft 2
#define XtCbottom 3
#define XtCtop 4
/* constant for check type definition */
#define XtCcheck 0
#define XtCcircle 1
#define XtCrectangle 2
#define XtCdiamond 3
#define XtCcross 4
#define XtCcircle2 5
/* constant for object type definition */
#define XtCright_arrow 0
#define XtCleft_arrow 1
#define XtCtop_arrow 2
#define XtCbottom_arrow 3
/* constant for orientation definition */
#define XtCvertical 0
#define XtChorizontal 1
/* button mode constants */
#define XtCnormalMode 0
#define XtCcyclicMode 1
#define XtCtoggleMode 2
typedef struct {
Pixmap pixmap;
Pixmap shape;
unsigned int width;
unsigned int height;
} Icon;
typedef struct {
int index;
char *label;
Icon *left_icon;
Icon *right_icon;
Boolean sensitive;
void *related_info;
} ListStruct;
#if NeedFunctionPrototypes
extern Boolean cvtStringToStringList(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToBoxType(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtBoxTypeToString(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToJustify(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToIcon(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToCheckType(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToObjectType(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToOrientation(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToListStruct(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
extern Boolean cvtStringToButtonMode(Display *,XrmValuePtr,Cardinal *,XrmValuePtr,XrmValuePtr,XtPointer *);
#else
extern Boolean cvtStringToStringList();
extern Boolean cvtStringToBoxType();
extern Boolean cvtBoxTypeToString();
extern Boolean cvtStringToJustify();
extern Boolean cvtStringToIcon();
extern Boolean cvtStringToCheckType();
extern Boolean cvtStringToObjectType();
extern Boolean cvtStringToOrientation();
extern Boolean cvtStringToListStruct();
extern Boolean cvtStringToButtonMode();
#endif
#define MwNwsDone(type, value) do {\
if (to->addr != NULL) {\
if (to->size < sizeof(type)) {\
to->size = sizeof(type);\
return False;\
}\
*(type*)(to->addr) = (value);\
} else {\
static type static_val;\
static_val = (value);\
to->addr = (XtPointer)&static_val;\
}\
to->size = sizeof(type);\
return True;\
}while (0 )
#endif
/***************************************************************************/
/* This code is part of X-toolkit widget library called Nws */
/* Copyright (c) 1997,1998,1999 Ondrejicka Stefan */
/* (ondrej@idata.sk) */
/* Distributed under GPL 2 or later */
/***************************************************************************/
#ifndef _dimdefP_H_
#define _dimdefP_H_
#if NeedFunctionPrototypes
typedef void (*set_internal_dimension_Proc) (Widget,Dimension,Dimension);
#else
typedef void (*set_internal_dimension_Proc) ();
#endif
#if NeedFunctionPrototypes
typedef void (*get_internal_dimension_Proc) (Widget,Position *,Position *,Dimension *,Dimension *);
#else
typedef void (*get_internal_dimension_Proc) ();
#endif
#if NeedFunctionPrototypes
typedef Widget (*traverse_Proc) (Widget, int ,Time *);
typedef void (*traverseTo_Proc) (Widget, Widget ,Time *);
typedef void (*traverseOut_Proc) (Widget);
typedef Widget (*traverseInside_Proc) (Widget, int ,Time *);
typedef void (*highlightBorder_Proc) (Widget);
typedef void (*unhighlightBorder_Proc) (Widget);
#else
typedef Widget (*traverse_Proc) ();
typedef void (*traverseTo_Proc) ();
typedef void (*traverseOut_Proc) ();
typedef Widget (*traverseInside_Proc) ();
typedef void (*highlightBorder_Proc) ();
typedef void (*unhighlightBorder_Proc) ();
#endif
#define XtInheritGetInternalDimension ((get_internal_dimension_Proc) _XtInherit)
#define XtInheritSetInternalDimension ((set_internal_dimension_Proc) _XtInherit)
#define XtInheritTraverse ((traverse_Proc) _XtInherit)
#define XtInheritTraverseTo ((traverseTo_Proc) _XtInherit)
#define XtInheritTraverseOut ((traverseOut_Proc) _XtInherit)
#define XtInheritTraverseInside ((traverseInside_Proc) _XtInherit)
#define XtInheritHighlightBorder ((highlightBorder_Proc) _XtInherit)
#define XtInheritUnhighlightBorder ((unhighlightBorder_Proc) _XtInherit)
#endif
/***************************************************************************/
/* This code is part of X-toolkit widget library called Nws */
/* Copyright (c) 1997,1998,1999 Ondrejicka Stefan */
/* (ondrej@idata.sk) */
/* Distributed under GPL 2 or later */
/***************************************************************************/
#ifndef _Init_h_
#define _Init_h_
extern void _InitializeWidgetSet(void);
#endif
/***************************************************************************/
/* This code is part of X-toolkit widget library called Nws */
/* Copyright (c) 1997,1998,1999 Ondrejicka Stefan */
/* (ondrej@idata.sk) */
/* Distributed under GPL 2 or later */
/***************************************************************************/
#ifndef _utils_h_
#define _utils_h_
#include <X11/Xutil.h>
extern void X_DrawSoft3DFrame(Display *, Drawable, int, int, int, int,
int, Pixel, Pixel, Pixel);
extern void X_DrawSimple3DFrame(Display * , Drawable , int , int , int ,
int , int , Pixel , Pixel );
extern void X_DrawSimpleRawFrame(Display * , Drawable , int , int , int ,
int , int , Pixel);
extern void X_DrawIcon(Display * , Drawable , Icon * , int , int );
extern void X_Draw3DArrow(Display * , Window , int , int , int , int ,
int , Pixel , Pixel , Pixel);
extern void X_Draw3DRectangle(Display * , Drawable , int , int , int ,
int , int , Pixel , Pixel , Pixel);
extern void X_Draw3DString(Display * , Drawable , XFontStruct * , int , int ,
int , String , int , Pixel , Pixel);
extern void X_DrawTextCursor(Display * , Window , int , int , int , Pixel);
extern Icon * X_XpmDataToIcon(Display * , char **);
extern void X_GetWindowRootPosition(Display * , Window , int * , int *);
extern void Xt_SetInsensitive(Widget);
extern Widget Xt_GetShell(Widget);
extern Boolean Xt_IsUp(Widget);
/* Original code */
/* makro na vypocet a alokaciu bledsej farby */
#define LightColor(intensity,fromcolor,tocolor) \
tocolor.red = (fromcolor.red + intensity) <= 65280 ? \
fromcolor.red + intensity : 65280 ; \
tocolor.green = (fromcolor.green + intensity) <= 65280 ? \
fromcolor.green + intensity : 65280 ; \
tocolor.blue = (fromcolor.blue + intensity) <= 65280 ? \
fromcolor.blue + intensity : 65280; \
if (!XAllocColor(dpy, DefaultColormap(dpy ,DefaultScreen(dpy)),&tocolor)) \
{ \
XtWarning("unable to allocate color for border"); \
tocolor.pixel=WhitePixel(dpy,DefaultScreen(dpy)); \
}
/* makro na vypocet a alokaciu tmavsej farby */
#define DarkColor(intensity,fromcolor,tocolor) \
tocolor.red = (fromcolor.red - intensity) <= 0 ? \
0 : fromcolor.red - intensity ; \
tocolor.green = (fromcolor.green - intensity) <= 0 ? \
0 : fromcolor.green - intensity ; \
tocolor.blue = (fromcolor.blue - intensity) <= 0 ? \
0 : fromcolor.blue - intensity ; \
if (!XAllocColor(dpy, DefaultColormap(dpy ,DefaultScreen(dpy)),&tocolor)) \
{ \
XtWarning("unable to allocate color for border"); \
tocolor.pixel=BlackPixel(dpy,DefaultScreen(dpy)); \
}
/* More compatible with e.g. Xaw3d */
extern Pixel AllocShadowPixel(Widget, int); /* from xcommon/Gcs.h */
#define LightColor2(widget, tocolor, contrast) \
tocolor.pixel = AllocShadowPixel(widget, 100+(contrast))
#define DarkColor2(widget, tocolor, contrast) \
tocolor.pixel = AllocShadowPixel(widget, 100-(contrast))
#endif
/***************************************************************************/
/* This code is part of X-toolkit widget library called Nws */
/* Copyright (c) 1997,1998,1999 Ondrejicka Stefan */
/* (ondrej@idata.sk) */
/* Distributed under GPL 2 or later */
/***************************************************************************/
#ifndef _misc_h_
#define _misc_h_
#define MAX_PATH_LEN 2048
#define _DCtimeout 300
#define DefaultIntensity 10000
#if NeedFunctionPrototypes
extern int cnt_lines(char *);
extern int max_line_width(char * , XFontStruct *);
extern char * get_abs_path(char *);
extern int x_atoi(char *);
#else
extern int cnt_lines();
extern int max_line_width();
extern char * get_abs_path();
extern int x_atoi();
#endif
#ifndef MW_MAX
#define MW_MAX(x,y) ((x) > (y) ? (x) : (y))
#endif
#ifndef MW_MIN
#define MW_MIN(x,y) ((x) < (y) ? (x) : (y))
#endif
#ifndef MW_BETWEEN
#define MW_BETWEEN(x,a,b) ((x)>=(a) && (x)<=(b))
#endif
#endif /* MW_NWS_H */
|