#include <Xm/Xm.h>
#include <Xm/RowColumn.h>
#include <Dt/Dt.h>
#include "xwidget.h"

char *
cde_defined_name ( s )
char *s;
{
    static char buf[128];
    sprintf ( buf, "DtN%s", s );
    return buf;
}

int
cde_no_children ( xw, class )
    XWidget_p xw;
    WidgetClass class;
{
    return False;
}

int
cde_title_box_child ( xw, class )
    XWidget_p xw;
    WidgetClass class;
{
    int num_children;
    XtVaGetValues ( xw->widget, XmNnumChildren, &num_children, NULL );
    /*
    ** Allow select after create, or 2nd child
    ** TitleBox has a child of it's own
    */
    return (!class || num_children <= 1);
}

int cde_dialog_box_child ( xw, class )
    XWidget_p xw;
    WidgetClass class;
{
    int num_children, num_buttons;
    int i;
    Widget *children;
    XtVaGetValues ( xw->widget,
		    XmNnumChildren, &num_children,
		    XmNbuttonCount, &num_buttons,
		    NULL );
    /*
    ** Allow select after create,
    ** or 1 more child than buttons + separator
    */
    return (!class || num_children <= num_buttons + 1 );
}

int
cde_menu_button_parent ( w, class )
    Widget w;
    WidgetClass class;
{
    if ( XmIsRowColumn ( w ) )
    {
	unsigned char rctype;
	XtVaGetValues ( w, XmNrowColumnType, & rctype, NULL );
	return (rctype == XmWORK_AREA);
    }
    return 1;
}
