/* **********************************************************************
 * *                                                                    *
 * *   Button-Text widget                                               *
 * *                                                                    *
 * **********************************************************************
 * File: iris/xsig/xsbtntxtwgt.c
 *
 *                    COPYRIGHT (c) 1992, 1999  BY
 *          SIGMET INCORPORATED, WESTFORD MASSACHUSETTS, U.S.A.
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */

/***************************************************************************
 XsBTNTXT Widget, Button-Text Widget 

       A XsBTNTXT widget is created by calling:

 The first argument is the parent widget.  The second argument is the name
 of the child widget to be created. The passed in callback function is
 registered in the widget's private memory. When one of the exiting events
 occurs, the callback is invoked.

******************************************************************************/
#include <stdio.h>
#include <Xm/PushB.h>
#include <Xm/Label.h>
#include <Xm/TextF.h>

#include "sigtypes.h"
#include "xsig_lib.h"

/* Local Callbacks */
static void xsbtntxt_btn_cbf( Widget, XsBTNTXT*, XmAnyCallbackStruct* cbd_a );
static void xsbtntxt_txt_cbf( Widget, XsBTNTXT*, XmAnyCallbackStruct* cbd_a );

XsBTNTXT* XsCreateBTNTXT
(Widget pwgt_a,
 char* snam_a,
 Xs2ArgCallbackProc cbf_a )
{
  XsBTNTXT* xwgt;

  xwgt = XtNew( XsBTNTXT );
  xwgt->lab = XmCreateLabel( pwgt_a, pstrcat(snam_a,"lab"), NULL, 0 );
  xwgt->btn = XmCreatePushButton( pwgt_a, pstrcat(snam_a,"btn"), NULL, 0 );
  xwgt->txt = XmCreateTextField ( pwgt_a, pstrcat(snam_a,"txt"), NULL, 0 );
  XtAddCallback( xwgt->btn, XmNactivateCallback,  
                 ( XtCallbackProc) xsbtntxt_btn_cbf, xwgt );
  XtAddCallback( xwgt->txt, XmNactivateCallback, 
                ( XtCallbackProc ) xsbtntxt_txt_cbf, xwgt );
  XtAddCallback( xwgt->txt, XmNlosingFocusCallback,
                ( XtCallbackProc )xsbtntxt_txt_cbf, xwgt );

  xwgt->cbf_a = cbf_a;

  return xwgt;
}

static void xsbtntxt_btn_cbf(Widget wgt_a,XsBTNTXT* xwgt_a,XmAnyCallbackStruct* cbd_a)
{
  (xwgt_a->cbf_a)( wgt_a, (char *)"btn" );
}

static void xsbtntxt_txt_cbf(Widget wgt_a,XsBTNTXT* xwgt_a,XmAnyCallbackStruct* cbd_a)
{
  (xwgt_a->cbf_a)( wgt_a, (char *)"txt" );
}


