/***************************** LICENSE START ***********************************

 Copyright 2012 ECMWF and INPE. This software is distributed under the terms
 of the Apache License version 2.0. In applying this license, ECMWF does not
 waive the privileges and immunities granted to it by virtue of its status as
 an Intergovernmental Organization or submit itself to any jurisdiction.

 ***************************** LICENSE END *************************************/

/*
** Generated by X-Designer
*/
/*
**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/DialogS.h>
#include <Xm/MessageB.h>
#include <Xm/LabelG.h>
#include <Xm/PushBG.h>
#include <Xm/SeparatoG.h>


#include "UIConfirm.h"

UIConfirm_p UIConfirm = (UIConfirm_p) NULL;



void UIConfirm_c::create (Widget parent, char *widget_name)
{
	Widget children[6];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget button20 = (Widget)NULL;
	Widget button21 = (Widget)NULL;
	Widget button22 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "Confirm";

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNtransient, TRUE); ac++;
	UIConfirm = XmCreateDialogShell ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIConfirm;
	XtSetArg(al[ac], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); ac++;
	XtSetArg(al[ac], XmNdialogType, XmDIALOG_QUESTION); ac++;
	XtSetArg(al[ac], XmNmessageAlignment, XmALIGNMENT_CENTER); ac++;
	XtSetArg(al[ac], XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON); ac++;
	form_ = XmCreateMessageBox ( UIConfirm, "form_", al, ac );
	ac = 0;
	button20 = XmMessageBoxGetChild ( form_, XmDIALOG_CANCEL_BUTTON );
	button21 = XmMessageBoxGetChild ( form_, XmDIALOG_HELP_BUTTON );
	label_ = XmMessageBoxGetChild ( form_, XmDIALOG_MESSAGE_LABEL );
	button22 = XmMessageBoxGetChild ( form_, XmDIALOG_OK_BUTTON );
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	XtSetValues ( button21,al, ac );
	ac = 0;
	XtAddCallback (form_, XmNokCallback, okCB, (XtPointer) this);
	XtAddCallback (form_, XmNcancelCallback, cancelCB, (XtPointer) this);
	XtAddCallback (form_, XmNhelpCallback, helpCB, (XtPointer) this);
}

void UIConfirm_c::helpCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIConfirm_p instance = (UIConfirm_p) client_data;
	instance->helpCB ( widget, call_data );
}

void UIConfirm_c::cancelCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIConfirm_p instance = (UIConfirm_p) client_data;
	instance->cancelCB ( widget, call_data );
}

void UIConfirm_c::okCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIConfirm_p instance = (UIConfirm_p) client_data;
	instance->okCB ( widget, call_data );
}

