/*
** Generated by X-Designer
*/

/*
** X-Designer-generated prelude.
** Do not edit lines before "End of X-Designer generated prelude"
** Lines beginning ** X-Designer Stub indicate a stub
** which will not be output on re-generation
*/

/*
**LIBS: -lXm -lXt -lX11
*/

#include <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <Xm/TextF.h>

#include "TextColors.h"

/* End of X-Designer generated prelude */

/*
** The following routines return the Pixels associated
** with the normal and special foreground/backgrounds.
*/

#ifndef   _NO_PROTO
extern Pixel xdGetTextNormalForegroundColorObject(void) ;
extern Pixel xdGetTextNormalBackgroundColorObject(void) ;
extern Pixel xdGetTextInsertBackgroundColorObject(void) ;
extern Pixel xdGetTextInsertForegroundColorObject(void) ;
#else  /* _NO_PROTO */
extern Pixel xdGetTextNormalForegroundColorObject() ;
extern Pixel xdGetTextNormalBackgroundColorObject() ;
extern Pixel xdGetTextInsertBackgroundColorObject() ;
extern Pixel xdGetTextInsertForegroundColorObject() ;
#endif /* _NO_PROTO */

/*
** Motif 1.2/2.1 compatability issue
*/

#ifndef   XmUNSPECIFIED_PIXEL
#define   XmUNSPECIFIED_PIXEL      ((Pixel) (~0))
#endif /* XmUNSPECIFIED_PIXEL */

/*
** X-Designer Stub set_text_colors
*/

#ifndef   _NO_PROTO
static void set_text_colors(Widget text, Pixel new_fg, Pixel new_bg)
#else  /* _NO_PROTO */
static void set_text_colors(text, new_fg, new_bg)
	Widget text ;
	Pixel  new_fg ;
	Pixel  new_bg ;
#endif /* _NO_PROTO */
{
	Pixel    current_fg = XmUNSPECIFIED_PIXEL ;
	Pixel    current_bg = XmUNSPECIFIED_PIXEL ;
	Arg      argv[2] ;
	Cardinal argc = 0 ;

	if (new_fg != XmUNSPECIFIED_PIXEL) { 
		XtSetArg (argv[argc], XmNforeground, &current_fg) ; argc++ ; 
	}

	if (new_bg != XmUNSPECIFIED_PIXEL) { 
		XtSetArg (argv[argc], XmNbackground, &current_bg) ; argc++ ; 
	}

	if (argc > 0) { 
		XtGetValues (text, argv, argc) ; 
		
		argc = 0 ;
		
		if ((new_fg != XmUNSPECIFIED_PIXEL) && (new_fg != current_fg)) { 
			XtSetArg (argv[argc], XmNforeground, new_fg) ; argc++ ; 
		}
		if ((new_bg != XmUNSPECIFIED_PIXEL) && (new_bg != current_bg)) { 
			XtSetArg (argv[argc], XmNbackground, new_bg) ; argc++ ; 
		}
		
		if (argc > 0) {
			XtSetValues (text, argv, argc) ; 
		}
	}
}

/*
** X-Designer Stub text_modify_verify
*/

#ifndef   _NO_PROTO
void text_modify_verify(Widget w, XtPointer client_data, XtPointer xt_call_data)
#else  /* _NO_PROTO */
void text_modify_verify(w, client_data, call_data)
	Widget    w ;
	XtPointer client_data ;
	XmTextVerifyCallbackStruct * call_data ;
#endif /* _NO_PROTO */
{
#ifndef   _NO_PROTO
	XmTextVerifyCallbackStruct *call_data = (XmTextVerifyCallbackStruct *) xt_call_data ;
#endif /* _NO_PROTO */

	set_text_colors(w, 
			xdGetTextInsertForegroundColorObject(),
			xdGetTextInsertBackgroundColorObject()) ;
}

/*
** X-Designer Stub text_activate
*/

#ifndef   _NO_PROTO
void text_activate(Widget w, XtPointer client_data, XtPointer xt_call_data)
#else  /* _NO_PROTO */
void text_activate(w, client_data, call_data)
	Widget    w ;
	XtPointer client_data ;
	XmAnyCallbackStruct * call_data ;
#endif /* _NO_PROTO */
{
#ifndef   _NO_PROTO
	XmAnyCallbackStruct *call_data = (XmAnyCallbackStruct *) xt_call_data ;
#endif /* _NO_PROTO */
	
	set_text_colors(w, 
			xdGetTextNormalForegroundColorObject(),
			xdGetTextNormalBackgroundColorObject()) ;
}

/*
** X-Designer Stub text_losing_focus
*/

#ifndef   _NO_PROTO
void text_losing_focus(Widget w, XtPointer client_data, XtPointer xt_call_data)
#else  /* _NO_PROTO */
void text_losing_focus(w, client_data, call_data)
	Widget    w ;
	XtPointer client_data ;
	XmTextVerifyCallbackStruct * call_data ;
#endif /* _NO_PROTO */
{
#ifndef   _NO_PROTO
	XmTextVerifyCallbackStruct *call_data = (XmTextVerifyCallbackStruct *) xt_call_data ;
#endif /* _NO_PROTO */
	
	set_text_colors(w, 
			xdGetTextNormalForegroundColorObject(),
			xdGetTextNormalBackgroundColorObject()) ;
}

/*
** X-Designer Stub exit_callback
*/

#ifndef   _NO_PROTO
void exit_callback(Widget w, XtPointer client_data, XtPointer xt_call_data)
#else  /* _NO_PROTO */
void exit_callback(w, client_data, call_data)
	Widget    w ;
	XtPointer client_data ;
	XmPushButtonCallbackStruct * call_data ;
#endif /* _NO_PROTO */
{
#ifndef   _NO_PROTO
	XmPushButtonCallbackStruct *call_data = (XmPushButtonCallbackStruct *) xt_call_data ;
#endif /* _NO_PROTO */

	exit(0) ;
}

