#include <stdarg.h>
#include "messageb.h"

#define MAXMESSAGE 100

@implementation WDCMessageDialogBox

- initWithName:(char*)aName managedBy:anObject
{
  [self setWidget:XmCreateMessageDialog([anObject getWidget],
					aName, 
					[self getArgList], 
					[self getNumArgs])];
  [self setParentObject:anObject];
  return self;
}


- (WidgetClass)getWidgetClass
{
  // a temporal solution.
  return xmMessageBoxWidgetClass;
}

- setAction
{
  return self;
}


- setCallData:(XtPointer)aCall_data
{
  XmAnyCallbackStruct *aCall_data_ptr
    =(XmAnyCallbackStruct*)aCall_data;
  _call_data.reason=aCall_data_ptr->reason;
  _call_data.event=aCall_data_ptr->event;
  return self;
}


- setMessage:(char*)message, ...
{
  va_list alist;
  char str[MAXMESSAGE];
  XmString t;
  va_start(alist, message);
  vsprintf(str, message, alist);
  va_end(alist);
  t=XmStringCreateSimple(str);
  [self setArg:XmNmessageString to:t];
  XmStringFree(t);
  return self;
}

@end

@implementation WDCHelpMessageBox


- initWithName:(char*)aName managedBy: anObject
{
  [super initWithName:aName managedBy:anObject];
  XtUnmanageChild(XmMessageBoxGetChild([self getWidget], 
				       XmDIALOG_CANCEL_BUTTON));
  XtUnmanageChild(XmMessageBoxGetChild([self getWidget], 
				       XmDIALOG_HELP_BUTTON));
  return self;
}

- managedBy: anObject
{
  return [self initWithName:"Help" managedBy:anObject];
}


@end
  
		 



