Exemple #1
0
static void
initialize(Widget request, Widget new_w,
	   ArgList args, Cardinal *num_args)
{
    DEBUGOUT(_LtDebug(__FILE__, new_w, "Initialize\n"));

    if (Com_PromptString(new_w) == (XmString)XmUNSPECIFIED)
    {
	XmString xms;

	xms = XmStringCreateLocalized(">");
	XtVaSetValues( SB_SelectionLabel(new_w), XmNlabelString, xms, NULL);
	XmStringFree(xms);
	Com_PromptString(new_w) = NULL;
    }
#if 0
    /* rws 2 Oct 1998
       These are just re-named SelectionBox resources so SelectionBox
       will take care of them.
     */
    if (Com_PromptString(new_w) == (XmString)XmUNSPECIFIED)
    {
	Com_PromptString(new_w) = XmStringCreateLocalized(">");
    }
    else if (Com_PromptString(new_w) != NULL)
    {
	Com_PromptString(new_w) = XmStringCopy(Com_PromptString(new_w));
    }

    if (Com_Command(new_w) == (XmString)XmUNSPECIFIED)
    {
	Com_Command(new_w) = XmStringCreateLocalized(">");
    }
    else if (Com_Command(new_w) != NULL)
    {
	Com_Command(new_w) = XmStringCopy(Com_Command(new_w));
    }
#endif

    XtAddCallback(SB_Text(new_w), XmNactivateCallback,
		  _XmCommandCallback, C_ACT);
    XtAddCallback(SB_List(new_w), XmNsingleSelectionCallback,
		  _XmCommandCallback, C_LIST_SELECT);
    XtAddCallback(SB_List(new_w), XmNdefaultActionCallback,
		  _XmCommandCallback, C_LIST_DOUBLE);

    Com_Error(new_w) = False;
}
Exemple #2
0
Widget
XmCommandGetChild(Widget w, unsigned char child)
{
    switch (child)
    {
    case XmDIALOG_COMMAND_TEXT:
	return SB_Text(w);

    case XmDIALOG_HISTORY_LIST:
	return SB_List(w);

    case XmDIALOG_PROMPT_LABEL:
	return SB_SelectionLabel(w);
    }

    return NULL;
}
Exemple #3
0
/*ARGSUSED*/
static void 
Initialize(
        Widget rw,		/* unused */
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args )	/* unused */
{
    XmCommandWidget new_w = (XmCommandWidget) nw ;
    int max;
    Arg             argv[5] ;
    Cardinal        argc ;
/****************/
    
    /*	Here we have now to take care of XmUNSPECIFIED (CR 4856).
     */  
    if (new_w->selection_box.selection_label_string == 
	(XmString) XmUNSPECIFIED) {
	XmString local_xmstring ;

	local_xmstring = XmStringCreate(">", XmFONTLIST_DEFAULT_TAG);
	argc = 0 ;
	XtSetArg( argv[argc], XmNlabelString, local_xmstring) ; ++argc ;
	XtSetValues( SB_SelectionLabel( new_w), argv, argc) ;
	XmStringFree(local_xmstring);

	new_w->selection_box.selection_label_string = NULL ;
    }
	   
    /* mustMatch does not apply to command... (it is always false) */
    if (new_w->selection_box.must_match != False) { 
        new_w->selection_box.must_match = False; 
        XmeWarning( (Widget) new_w, WARNING5);
    }

    /* check for and change max history items (remove items if needed) */
    if (new_w->command.history_max_items < 1) {
        new_w->command.history_max_items = 100;
        XmeWarning( (Widget) new_w, WARNING6);
    }
    argc = 0 ;
    XtSetArg( argv[argc], XmNitemCount, &max) ; ++argc ;
    XtGetValues( SB_List( new_w), argv, argc) ;

    if (new_w->command.history_max_items < max)
    {
        while (max > new_w->command.history_max_items) {
            XmListDeletePos (new_w->selection_box.list, 1);
            if (new_w->selection_box.list_selected_item_position > 0)
                new_w->selection_box.list_selected_item_position--;
            max--;
        }
    }
    if (new_w->selection_box.dialog_type != XmDIALOG_COMMAND)
    {   
        new_w->selection_box.dialog_type = XmDIALOG_COMMAND ;
        XmeWarning( (Widget) new_w, WARNING1);
        } 
    XtAddCallback (new_w->selection_box.text, XmNvalueChangedCallback, 
                                              CommandCallback, (XtPointer) new_w);
    new_w->command.error = FALSE;

    return ;
}