/*
 *      XCountdown - X version of the popular Channel 4 quiz show
 *
 * This software comes with NO warranty whatsoever. I therefore take no
 * responsibility for any damages, losses or problems caused through use
 * or misuse of this program.
 *
 * I hereby grant permission for this program to be freely copied and
 * distributed by any means, provided no charge is made for it.
 *
 * Matthew Chapman, csuoq@csv.warwick.ac.uk
 *    Oct 1995.
 */

/* "about" module */

#include "xcountdown.h"
#include "globals.h"

#include "about.h"

static Pixmap logo_xpm[NP];

void ToggleAbout(int dnum, Boolean on)
{
    if (on)
	XtVaSetValues(tmaind[dnum],XtNbackgroundPixmap,(XtArgVal)logo_xpm[dnum],
		      XtNmappedWhenManaged,False,NULL);
    else
	XtVaSetValues(tmaind[dnum],XtNbackgroundPixmap,(XtArgVal)bg_xpm[dnum],
		      XtNmappedWhenManaged,True,NULL);
}

void GetClick(Widget w)
{
    int dnum;

    for (dnum=0;topl[dnum]!=w; dnum++)
	;

    ToggleAbout(dnum,False);
    XtRemoveEventHandler(topl[dnum],ButtonPressMask,False,(XtEventHandler)GetClick,NULL);
    AboutDown(topl[dnum]);
}

Boolean LoadAboutXPM(int dnum)
{
    return(load_file_pixmap(ABOUTXPMFILE,&logo_xpm[dnum],topl[dnum],
			    pseudo_cmap[dnum]));
}

void SetAboutXPM(Widget w,int dnum)
{
    XtVaSetValues(w,XtNbackgroundPixmap,(XtArgVal)logo_xpm[dnum],NULL);
}

void AboutPopup(int dnum)
{
    ToggleAbout(dnum,True);
    XtAddEventHandler(topl[dnum],ButtonPressMask,False,(XtEventHandler)
		      GetClick,NULL);
}
