Beispiel #1
0
void create_split_dialog(Widget parent)
{
    XmString message;
    Widget temp_widget = parent;

    /* Ensure the parent of the dialog is a shell widget */
    while ( !XtIsShell(temp_widget) ) {
	temp_widget = XtParent(temp_widget);
    }
    message = XmStringLtoRCreate(SPLIT_MESSAGE, XmSTRING_DEFAULT_CHARSET);
    argcount = 0;
    XtSetArg(args[argcount], XmNselectionLabelString, message); argcount++;
    split_dialog = XmCreatePromptDialog(temp_widget, "split dialog",
				args, argcount);
    /* Remove the help button from the dialog */
    temp_widget = XmSelectionBoxGetChild(split_dialog, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild(temp_widget);
    /* Add the actions to the buttons */
    XtAddCallback(split_dialog, XmNokCallback,
		(XtCallbackProc) start_split, (XtPointer) NULL);
    XtAddCallback(split_dialog, XmNokCallback,
		(XtCallbackProc) activate_merge_dialog, (XtPointer) NULL);
    XmStringFree(message);
    create_merge_dialog(main_window);
}
Beispiel #2
0
void
pushed(Widget pb, XtPointer foo, XtPointer bar)
{
  static Widget dialog;
  XmString t = XmStringCreateSimple("Enter New Button Name:");
  extern void read_name(Widget, XtPointer, XtPointer);
  extern void toggle_callback(Widget, XtPointer, XtPointer);
  Arg args[3];

  XtSetArg(args[0], XmNselectionLabelString, t);
  XtSetArg(args[1], XmNautoUnmanage, False);
  XtSetArg(args[2], XmNuserData, 0);
  dialog = XmCreatePromptDialog(XtParent(pb), "notice", args, 3);
  XmStringFree(t);

  XtAddCallback(dialog, XmNokCallback, read_name, NULL);
  XtAddCallback(dialog, XmNcancelCallback, (XtCallbackProc)XtDestroyWidget,
		NULL);

  XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));

  {
    XmString btn1 = XmStringCreateSimple("Change Name");
    XmString btn2 = XmStringCreateSimple("Change Color");
    Widget toggle_box =
      XmVaCreateSimpleRadioBox(dialog, "radio_box", 0, toggle_callback,
			       XmVaRADIOBUTTON, btn1, 0, NULL, NULL,
			       XmVaRADIOBUTTON, btn2, 0, NULL, NULL,
			       NULL);
    XtManageChild(toggle_box);
  }

  XtManageChild(dialog);
  XtPopup(XtParent(dialog), XtGrabNone);
}
static XmString motFileDlgPrompt(Widget parent, const char* message)
{
  Widget promptbox;
  Arg args[2];
  ImotPromt prompt;
  XmString title;

  XtSetArg(args[0], XmNautoUnmanage, False);
  XtSetArg(args[1], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);
  promptbox = XmCreatePromptDialog(parent, "filedlg_prompt", args, 2);
  iupmotSetString(promptbox, XmNselectionLabelString, message);
  XtVaGetValues(parent, XmNdialogTitle, &title, NULL);
  XtVaSetValues(promptbox, XmNdialogTitle, title, NULL);

  prompt.ret_code = 0;
  prompt.xm_dir = NULL;

  XtAddCallback(promptbox, XmNokCallback, (XtCallbackProc)motFileDlgPromptCallback, (XtPointer)&prompt);
  XtAddCallback(promptbox, XmNcancelCallback, (XtCallbackProc)motFileDlgPromptCallback, (XtPointer)&prompt);
  XtUnmanageChild(XmSelectionBoxGetChild(promptbox, XmDIALOG_HELP_BUTTON));
  XtManageChild(promptbox);

  while (prompt.ret_code == 0)
    XtAppProcessEvent(iupmot_appcontext, XtIMAll);

  XtUnmanageChild(promptbox);

  return prompt.xm_dir;
}
Beispiel #4
0
/* Procedure to create de dialog. */
void create_sigma_dialog(Widget parent){
  
  XmString message;
  Widget temp_widget = parent;

  /* Ensure the parent of the dialog is a shell widget */
  while ( !XtIsShell(temp_widget) ) {
    temp_widget = XtParent(temp_widget);
  }

  message = XmStringLtoRCreate(SIGMA_MESSAGE, XmSTRING_DEFAULT_CHARSET);

  argcount = 0;
  XtSetArg(args[argcount], XmNselectionLabelString, message); argcount++;
  sigma_dialog = XmCreatePromptDialog(temp_widget, "gaussian dialog",
					args, argcount);

  /* Remove the help button from the dialog */
  temp_widget = XmSelectionBoxGetChild(sigma_dialog, XmDIALOG_HELP_BUTTON);
  XtUnmanageChild(temp_widget);

  /* Add the actions to the buttons */
  XtAddCallback(sigma_dialog, XmNokCallback,
		(XtCallbackProc) ok_sigmabutton_callback, (XtPointer) NULL);
  XtAddCallback(sigma_dialog, XmNcancelCallback,
		(XtCallbackProc) cancel_sigmabutton_callback, (XtPointer) NULL);

  XmStringFree(message);

}/*end create_sigma_dialog*/
Beispiel #5
0
Widget PromptDialogManager::createDialog ( Widget parent )
{
  Widget dialog = XmCreatePromptDialog ( parent, _name, NULL, 0);
    
  XtVaSetValues ( dialog,
		  XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
		  NULL );
  
  return dialog;
}
Beispiel #6
0
/* add another entry of site specific data by entering its site id */
void site_edit_add_callback(Widget w, XtPointer client_data, XtPointer call_data)
{
    Widget d;
    XmString xmstr;

    d = XmCreatePromptDialog(w, "sid_add", NULL, 0);
    XtVaSetValues(XtParent(d), XmNtitle, "Add Site ID", NULL);
    xmstr = XmStringCreateLtoR("Site ID to add:", XmFONTLIST_DEFAULT_TAG);
    XtVaSetValues(d, XmNselectionLabelString, xmstr, 
             XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, NULL);
    XtAddCallback(d, XmNcancelCallback, site_edit_add_cancel_callback, NULL);
    XtAddCallback(d, XmNokCallback, site_edit_add_ok_callback, NULL);
    XmStringFree(xmstr);

    XtManageChild(d);
}
Beispiel #7
0
static void PlotCommandCB(Widget, XtPointer client_data, XtPointer)
{
    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;

    if (plot->command_dialog == 0)
    {
	Arg args[10];
	Cardinal arg = 0;
	Widget dialog = 
	    verify(XmCreatePromptDialog(plot->shell,
					XMST("plot_command_dialog"),
					args, arg));
	Delay::register_shell(dialog);
	plot->command_dialog = dialog;

	Widget apply = XmSelectionBoxGetChild(dialog, XmDIALOG_APPLY_BUTTON);
	XtManageChild(apply);
    
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_OK_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_SELECTION_LABEL));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_TEXT));

	XtAddCallback(dialog, XmNapplyCallback,
		      ApplyPlotCommandCB, XtPointer(client_data));
	XtAddCallback(dialog, XmNhelpCallback,
		      ImmediateHelpCB, XtPointer(client_data));

	arg = 0;
	Widget command = 
	    verify(XmCreateCommand(dialog, XMST("plot_command"), args, arg));
	plot->command = command;
	XtManageChild(command);

	XtAddCallback(command, XmNcommandEnteredCallback, 
		      DoPlotCommandCB, XtPointer(client_data));
	XtAddCallback(command, XmNcommandChangedCallback, 
		      EnableApplyCB, XtPointer(apply));
	set_sensitive(apply, false);
    }

    manage_and_raise(plot->command_dialog);
}
void TicTacToeCB(Widget, XtPointer, XtPointer)
{
    static Widget dialog = 0;
    if (dialog == 0)
    {
	Arg args[10];
	int arg = 0;

	XtSetArg(args[arg], XmNautoUnmanage, False); arg++;
	dialog = verify(XmCreatePromptDialog(find_shell(),
					     XMST("tictactoe"), args, arg));
	Delay::register_shell(dialog);

	if (lesstif_version <= 79)
	    XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
						   XmDIALOG_APPLY_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_HELP_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_TEXT));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_SELECTION_LABEL));

	XtAddCallback(dialog, XmNhelpCallback, ImmediateHelpCB, XtPointer(0));
	XtAddCallback(dialog, XmNokCallback, ResetTicTacToeCB, XtPointer(0));
	XtAddCallback(dialog, XmNcancelCallback, UnmanageThisCB, 
		      XtPointer(dialog));

	create_tictactoe(dialog);
    }

    ResetTicTacToeCB(0, 0, 0);
    manage_and_raise(dialog);
}
Beispiel #9
0
Widget
XFE_Dialog::createDialogChromeWidget(Widget   parent,    
									 char    *name,
									 Boolean  ok,
									 Boolean  cancel,
									 Boolean  help,
									 Boolean  apply,
									 Boolean  separator,
									 Boolean  modal)
{
	Visual   *v = 0;
	Colormap  cmap = 0;
	Cardinal  depth = 0;
	Arg       av[20];
	int       ac;
	Widget chrome;

	XtVaGetValues (parent, 
				   XtNvisual, &v, 
				   XtNcolormap, &cmap,
				   XtNdepth, &depth,
				   0);

	ac = 0;
	XtSetArg (av[ac], XmNvisual, v); ac++;
	XtSetArg (av[ac], XmNdepth, depth); ac++;
	XtSetArg (av[ac], XmNcolormap, cmap); ac++;
	XtSetArg (av[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg (av[ac], XmNtransientFor, parent); ac++;
	if (modal) {
		XtSetArg (av[ac], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ac++;
	}
	XtSetArg (av[ac], XmNdialogType, XmDIALOG_QUESTION); ac++;
	XtSetArg (av[ac], XmNdeleteResponse, XmDESTROY); ac++;
	XtSetArg (av[ac], XmNautoUnmanage, False); ac++;
	XtSetArg (av[ac], XmNnoResize, True); ac++;

	chrome = XmCreatePromptDialog (parent, name, av, ac);

	if (!separator)
		fe_UnmanageChild_safe(XmSelectionBoxGetChild(chrome,
													 XmDIALOG_SEPARATOR));

	fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome, 
												   XmDIALOG_TEXT));

	fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome,
												   XmDIALOG_SELECTION_LABEL));

	if (!ok)
		fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome, 
													   XmDIALOG_OK_BUTTON));
	else
		m_okButton = XmSelectionBoxGetChild(chrome, XmDIALOG_OK_BUTTON);

	if (!cancel)
		fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome,
													   XmDIALOG_CANCEL_BUTTON));
	else
		m_cancelButton = XmSelectionBoxGetChild(chrome, XmDIALOG_CANCEL_BUTTON);

	fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome, XmDIALOG_HELP_BUTTON));

	if (help) {
		// TODO: Enable help later
		fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome, XmDIALOG_HELP_BUTTON));
		// m_helpButton = XmSelectionBoxGetChild(chrome, XmDIALOG_HELP_BUTTON);
	}
	else
		fe_UnmanageChild_safe (XmSelectionBoxGetChild (chrome, XmDIALOG_HELP_BUTTON));

	if (apply) {
		m_applyButton = XmSelectionBoxGetChild(chrome, XmDIALOG_APPLY_BUTTON);
		XtManageChild(m_applyButton);
	}

	return chrome;
}
Beispiel #10
0
Widget XmCreatePromptDialog_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreatePromptDialog(parent, name, arglist, argcount);}
Beispiel #11
0
void getStartupPrefs(Widget mainWin)
{
    Widget       prefForm;
    Widget       portLabel;
    Widget       child;
    XmString     labelString;
    Arg          args[4];
    int          argcount;
    FILE         *confFile;
    char         serverPortNum[6];
    char    	 *confFilePath;


    argcount = 0;
    labelString = XM_STRING_CREATE("Startup Prefs");
    XtSetArg(args[argcount], XmNdialogTitle, labelString);
    argcount++;
    XtSetArg(args[argcount], XmNautoUnmanage, True);
    argcount++;
    startPrefDiag = XmCreatePromptDialog(mainWin, "startup_prefs", args, argcount);
    XmStringFree(labelString);

    /* Now get rid of the things we don't want */
    child = XmSelectionBoxGetChild(startPrefDiag, XmDIALOG_SELECTION_LABEL);
    XtUnmanageChild(child);
    child = XmSelectionBoxGetChild(startPrefDiag, XmDIALOG_TEXT);
    XtUnmanageChild(child);

    prefForm = XtVaCreateWidget("form", xmFormWidgetClass, startPrefDiag,
                                XmNfractionBase, 18, NULL);

    labelString = XM_STRING_CREATE("Name:");
    XtVaCreateManagedWidget("name_label",
                            xmLabelWidgetClass, prefForm,
                            XmNlabelString, labelString,
                            XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0,
                            XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0,
                            NULL);
    XmStringFree(labelString);

    labelString = XM_STRING_CREATE("Nick:");
    XtVaCreateManagedWidget("nick_label",
                            xmLabelWidgetClass, prefForm,
                            XmNlabelString, labelString,
                            XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6,
                            XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0,
                            NULL);
    XmStringFree(labelString);

    labelString = XM_STRING_CREATE("Server:");
    XtVaCreateManagedWidget("server_label",
                            xmLabelWidgetClass, prefForm,
                            XmNlabelString, labelString,
                            XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12,
                            XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0,
                            NULL);
    XmStringFree(labelString);


    nameTextForm = XtVaCreateManagedWidget("name_form",
                                           xmTextFieldWidgetClass, prefForm,
                                           XmNmaxLength, MAX_NAME_LEN,
                                           XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0,
                                           XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4,
                                           XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18,
                                           NULL);

    nickTextForm = XtVaCreateManagedWidget("nick_form",
                                           xmTextFieldWidgetClass, prefForm,
                                           XmNmaxLength, MAX_NICK_LEN,
                                           XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6,
                                           XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4,
                                           XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18,
                                           NULL);

    portTextForm = XtVaCreateManagedWidget("port_form",
                                           xmTextFieldWidgetClass, prefForm,
                                           XmNmaxLength, 5,
                                           XmNcolumns, 5,
                                           XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12,
                                           XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18,
                                           NULL);

    labelString = XM_STRING_CREATE("Port: ");
    portLabel = XtVaCreateManagedWidget("port_label",
                                        xmLabelWidgetClass, prefForm,
                                        XmNlabelString, labelString,
                                        XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12,
                                        XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, portTextForm,
                                        NULL);
    XmStringFree(labelString);

    serverTextForm = XtVaCreateManagedWidget("server_form",
                     xmTextFieldWidgetClass, prefForm,
                     XmNmaxLength, MAX_SERVERNAME_LEN,
                     XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12,
                     XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4,
                     XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, portLabel,
                     NULL);


    XtAddCallback(startPrefDiag, XmNokCallback, okButtStartupCbk, NULL);
    XtAddCallback(startPrefDiag, XmNhelpCallback, helpButtStartupCbk, NULL);

    XtManageChild(prefForm);

    XtManageChild(startPrefDiag);

    /* read configuration file */
    if (confFilePath = getPreferencesFilePath())
    {
        confFile = fopen (confFilePath, "r");
        if (confFile)
        {
            char buff[FILE_BUFF_SIZE];
            char *pos;

            fgets(buff, FILE_BUFF_SIZE, confFile);
            if (buff[strlen(buff)-1] == '\n')
                buff[strlen(buff)-1] = '\0';
            if(!strncmp(buff, "DefaultNick", strlen("DefaultNick")))
                if (pos = strchr(buff, ' '))
                    strcpy(sysState.myNick, pos+1);
            fgets(buff, FILE_BUFF_SIZE, confFile);
            if (buff[strlen(buff)-1] == '\n')
                buff[strlen(buff)-1] = '\0';
            if(!strncmp(buff, "DefaultName", strlen("DefaultName")))
                if (pos = strchr(buff, ' '))
                    strcpy(sysState.myName, pos+1);
            fgets(buff, FILE_BUFF_SIZE, confFile);
            if (buff[strlen(buff)-1] == '\n')
                buff[strlen(buff)-1] = '\0';
            if(!strncmp(buff, "DefaultServer", strlen("DefaultServer")))
                if (pos = strchr(buff, ' '))
                    strcpy(sysState.serverName, pos+1);
            fgets(buff, FILE_BUFF_SIZE, confFile);
            if (buff[strlen(buff)-1] == '\n')
                buff[strlen(buff)-1] = '\0';
            if(!strncmp(buff, "DefaultPortNum", strlen("DefaultPortNum")))
                if (pos = strchr(buff, ' '))
                    strcpy(serverPortNum, pos+1);
            fclose(confFile);
        } else
        {
            printf("config file not found.\n");
            strcpy(sysState.myNick, "nebula_user");
            strcpy(sysState.myName, "Nebula User");
            strcpy(sysState.serverName, "irc.freenode.org");
            strcpy(serverPortNum, "6666");
        }
        free(confFilePath);
    }
    XmTextSetString(nickTextForm, sysState.myNick);
    XmTextSetString(nameTextForm, sysState.myName);
    XmTextSetString(serverTextForm, sysState.serverName);
    XmTextSetString(portTextForm, serverPortNum);
}
Beispiel #12
0
int WNavMotif::prompt_dialog( char *title, char *text, char **value)
{
    Widget 	dialog;
    XmString	text_str;
    XmString	title_str;
    Arg		args[10];
    int		i;
    XEvent 	Event;

    text_str = XmStringCreateLocalized( wnav_dialog_convert_text(text));
    title_str = XmStringCreateLocalized( title);
    i = 0;
    XtSetArg( args[i], XmNselectionLabelString, text_str);
    i++;
    XtSetArg( args[i], XmNdialogTitle, title_str);
    i++;
    if ( dialog_width && dialog_height)
    {
        XtSetArg( args[i], XmNwidth, dialog_width);
        i++;
        XtSetArg( args[i], XmNheight, dialog_height);
        i++;
        XtSetArg( args[i], XmNx, dialog_x);
        i++;
        XtSetArg( args[i], XmNy, dialog_y);
        i++;
    }
//  XtSetArg( args[i], XmNautoUnmanage, False); i++;

    dialog = XmCreatePromptDialog( parent_wid, (char*) "Info", args, i);
    XmStringFree( text_str);
    XmStringFree( title_str);

    XtUnmanageChild( XmSelectionBoxGetChild( dialog, XmDIALOG_HELP_BUTTON));

    XtAddCallback( dialog, XmNokCallback, wnav_message_dialog_read, this);
    XtAddCallback( dialog, XmNcancelCallback, wnav_message_dialog_cancel, this);

    // Connect the window manager close-button to exit
    flow_AddCloseVMProtocolCb( XtParent(dialog),
                               (XtCallbackProc)wnav_message_dialog_cancel, this);

    XtManageChild( dialog);
    XtPopup( XtParent(dialog), XtGrabNone);

    dialog_ok = 0;
    dialog_cancel = 0;
    dialog_help = 0;

    for (;;)
    {
        XtAppNextEvent( XtWidgetToApplicationContext( dialog), &Event);
        XtDispatchEvent( &Event);
        if ( dialog_ok)
        {
            *value = dialog_value;
            XtDestroyWidget( dialog);
            return 1;
        }
        if ( dialog_cancel)
        {
            strcpy( dialog_value, "");
            *value = dialog_value;
            XtDestroyWidget( dialog);
            return 0;
        }
    }
}
Beispiel #13
0
void
color_init(struct ida_image *img)
{
    Widget menu,push,rc;
    struct ida_coledit *me;
    Arg args[2];

    me = malloc(sizeof(*me));
    memset(me,0,sizeof(*me));
    color_calchist(img,me);

    /* dialog shell */
    me->dlg = XmCreatePromptDialog(app_shell,"color",NULL,0);
    XmdRegisterEditres(XtParent(me->dlg));
    XtUnmanageChild(XmSelectionBoxGetChild(me->dlg,XmDIALOG_SELECTION_LABEL));
    XtUnmanageChild(XmSelectionBoxGetChild(me->dlg,XmDIALOG_HELP_BUTTON));
    XtUnmanageChild(XmSelectionBoxGetChild(me->dlg,XmDIALOG_TEXT));
    me->form = XtVaCreateManagedWidget("form",xmFormWidgetClass,
				       me->dlg,NULL);
    XtAddCallback(XtParent(me->dlg),XmNdestroyCallback,color_destroy,me);
    XtAddCallback(me->dlg,XmNokCallback,color_button_cb,me);
    XtAddCallback(me->dlg,XmNcancelCallback,color_button_cb,me);

    /* histograms */
    XtVaCreateManagedWidget("hist",xmLabelWidgetClass,
			    me->form,NULL);
    color_createhist(me->form,"red",  x11_red,  &me->red);
    color_createhist(me->form,"green",x11_green,&me->green);
    color_createhist(me->form,"blue", x11_blue, &me->blue);
    me->red.up = me;
    me->green.up = me;
    me->blue.up = me;
    XtVaCreateManagedWidget("map",xmLabelWidgetClass,
			    me->form,NULL);

    /* control */
    me->toggle = XtVaCreateManagedWidget("lock",xmToggleButtonWidgetClass,
					 me->form,NULL);
    XtAddCallback(me->toggle,XmNvalueChangedCallback,color_lock,me);
    menu = XmCreatePulldownMenu(me->form,"valsM",NULL,0);
    XtSetArg(args[0],XmNsubMenuId,menu);
    me->vals = XmCreateOptionMenu(me->form,"vals",args,1);
    XtManageChild(me->vals);
    push = XtVaCreateManagedWidget("red",xmPushButtonWidgetClass,menu,NULL);
    XtAddCallback(push,XmNactivateCallback,color_vals,&me->red);
    push = XtVaCreateManagedWidget("green",xmPushButtonWidgetClass,menu,NULL);
    XtAddCallback(push,XmNactivateCallback,color_vals,&me->green);
    push = XtVaCreateManagedWidget("blue",xmPushButtonWidgetClass,menu,NULL);
    XtAddCallback(push,XmNactivateCallback,color_vals,&me->blue);

    /* in range */
    rc = XtVaCreateManagedWidget("in",xmRowColumnWidgetClass,me->form,NULL);
    XtVaCreateManagedWidget("label",xmLabelWidgetClass,rc,NULL);
    me->l = XtVaCreateManagedWidget("left",xmTextWidgetClass,rc,NULL);
    XtAddCallback(me->l,XmNvalueChangedCallback,color_text,me);
    me->r = XtVaCreateManagedWidget("right",xmTextWidgetClass,rc,NULL);
    XtAddCallback(me->r,XmNvalueChangedCallback,color_text,me);

    /* out range */
    rc = XtVaCreateManagedWidget("out",xmRowColumnWidgetClass,me->form,NULL);
    XtVaCreateManagedWidget("label",xmLabelWidgetClass,rc,NULL);
    me->b = XtVaCreateManagedWidget("bottom",xmTextWidgetClass,rc,NULL);
    XtAddCallback(me->b,XmNvalueChangedCallback,color_text,me);
    me->t = XtVaCreateManagedWidget("top",xmTextWidgetClass,rc,NULL);
    XtAddCallback(me->t,XmNvalueChangedCallback,color_text,me);

    /* gamma */
    rc = XtVaCreateManagedWidget("gamma",xmRowColumnWidgetClass,me->form,NULL);
    XtVaCreateManagedWidget("label",xmLabelWidgetClass,rc,NULL);
    me->g = XtVaCreateManagedWidget("gamma",xmTextWidgetClass,rc,NULL);
    XtAddCallback(me->g,XmNvalueChangedCallback,color_text,me);

    /* testing stuff */
    rc = XtVaCreateManagedWidget("pick",xmRowColumnWidgetClass,me->form,NULL);
    push = XtVaCreateManagedWidget("white",xmPushButtonWidgetClass,rc,NULL);
    XtAddCallback(push,XmNactivateCallback,color_pick,me);
    
    XtManageChild(me->dlg);

    me->cur = &me->red;
    color_update(me,me->cur,2);
    XmToggleButtonSetState(me->toggle,True,True);
}
Beispiel #14
0
void gdbExamineCB(Widget w, XtPointer, XtPointer)
{
    static Widget dialog = 0;
    if (dialog == 0)
    {
	Arg args[10];
	Cardinal arg = 0;
	XtSetArg(args[arg], XmNautoUnmanage, False); arg++;
	dialog = verify(XmCreatePromptDialog(find_shell(w),
					     XMST("examine_dialog"),
					     args, arg));
	Delay::register_shell(dialog);

	XtManageChild(XmSelectionBoxGetChild(dialog,
					     XmDIALOG_APPLY_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_SELECTION_LABEL));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_TEXT));

	arg = 0;
	XtSetArg(args[arg], XmNorientation, XmHORIZONTAL); arg++;
	XtSetArg(args[arg], XmNborderWidth,  0); arg++;
	XtSetArg(args[arg], XmNentryBorder,  0); arg++;
	XtSetArg(args[arg], XmNspacing,      0); arg++;
	XtSetArg(args[arg], XmNmarginWidth,  0); arg++;
	XtSetArg(args[arg], XmNmarginHeight, 0); arg++;
	Widget panel = MMcreateButtonPanel(dialog, "panel", examine_menu, 
					   args, arg);
	(void) panel;
	MMaddCallbacks(examine_menu);
	MMaddHelpCallback(examine_menu, ImmediateHelpCB);

	manage_child(unsigned_char_w,  gdb->type() == GDB);
	manage_child(binary_w,         gdb->type() == GDB);
	manage_child(address_format_w, gdb->type() == GDB);
	manage_child(wide_char_w,      gdb->type() == DBX);
	manage_child(wide_string_w,    gdb->type() == DBX);
	manage_child(long_w,           gdb->type() == DBX);

	// Initialize: use `o' and `b' as default menu items
	XtCallActionProc(octal_w, "ArmAndActivate", 
			 (XEvent *)0, (String *)0, 0);
	XtCallActionProc(byte_w, "ArmAndActivate", 
			 (XEvent *)0, (String *)0, 0);

	tie_combo_box_to_history(address_w, arg_history_filter);

	XtAddCallback(dialog, XmNokCallback,
		      PrintExaminedCB, XtPointer(0));
	XtAddCallback(dialog, XmNapplyCallback, 
		      DisplayExaminedCB, XtPointer(0));
	XtAddCallback(dialog, XmNcancelCallback, 
		      UnmanageThisCB, XtPointer(dialog));
	XtAddCallback(dialog, XmNhelpCallback,
		      ImmediateHelpCB, XtPointer(0));
    }

    string arg = source_arg->get_string();
    if (!is_file_pos(arg) && !arg.empty())
	XmTextFieldSetString(address_w, XMST(arg.chars()));

    manage_and_raise(dialog);
}