Esempio n. 1
0
Widget CreateErrorDialog(Widget widgetParent)
{
   int i, lng;
   Widget error, bouton;
   XmString label;
   Arg args[8];

   lng = c_getulng();

   i = 0;
   label = XmStringCreateLtoR(labelQuitter[lng], XmSTRING_DEFAULT_CHARSET);
   XtSetArg(args[i], XmNokLabelString, label); i++;
   error = (Widget)XmCreateErrorDialog(widgetParent, "popup", args, i);
   XtSetArg(args[i], XmNinitialResourcesPersistent, False); i++;
   CheckColormap(error);

   bouton = (Widget)XmMessageBoxGetChild(error, XmDIALOG_CANCEL_BUTTON);
   XtUnmanageChild(bouton);

   bouton = (Widget)XmMessageBoxGetChild(error, XmDIALOG_HELP_BUTTON);
   XtUnmanageChild(bouton);

   XtAddCallback(error, XmNokCallback, (XtCallbackProc) ErrorQuit, NULL);

   return error;

   }
Esempio n. 2
0
Widget
err_dialog(Widget widget, char *s)
{
	static Widget dialog;
	XmString t;

	/*@ -mustfreefresh +charint -usedef -statictrans -immediatetrans -onlytrans @*/
	if (!dialog) {
		Arg args[5];
		int n = 0;
		XmString ok = XmStringCreateLocalized("OK");
		XtSetArg(args[n], XmNautoUnmanage, False); n++;
		XtSetArg(args[n], XmNcancelLabelString, ok); n++;
		dialog = XmCreateInformationDialog(widget, "notice", 
						   args, (Cardinal)n);
		XtAddCallback(dialog, XmNcancelCallback, dlg_callback, NULL);
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
		    XmDIALOG_OK_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
		    XmDIALOG_HELP_BUTTON));
	}
	t = XmStringCreateLocalized(s);
	XtVaSetValues(dialog,
	    XmNmessageString,	t,
	    XmNdialogStyle,	XmDIALOG_FULL_APPLICATION_MODAL,
	    NULL);
	XmStringFree(t);
	XtManageChild(dialog);
	XtPopup(XtParent(dialog), XtGrabNone);
	return dialog;
	/*@ +mustfreefresh -charint +usedef +statictrans +immediatetrans  +onlytrans @*/
}
Esempio n. 3
0
void helpButtPrefCbk()
{
    XmString theXmString, theXmString2;
    Arg      args[8];
    int      argcount;
    Widget   remove;
    Widget   startupPrefsHelpDlgBox;

    argcount = 0;
    theXmString = XM_STRING_CREATE("Help");
    XtSetArg(args[argcount], XmNdialogTitle, theXmString);
    argcount++;
    theXmString2 = XM_STRING_GEN_COMP("This panel sets the startup preferences.\n\
Ok will save them to the user\'s defaults.\n\n\
Set nickname and name you want to use.\nEnter the server you want to connect to.");
    XtSetArg(args[argcount], XmNmessageString, theXmString2);
    argcount++;
    XtSetArg(args[argcount], XmNautoUnmanage, True);
    argcount++;
    startupPrefsHelpDlgBox = XmCreateInformationDialog(startPrefDiag, "help", args, argcount);
    XmStringFree(theXmString);
    XmStringFree(theXmString2);

    /* Now get rid of the things we don't want */
    remove = XmMessageBoxGetChild(startupPrefsHelpDlgBox, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild(remove);
    remove = XmMessageBoxGetChild(startupPrefsHelpDlgBox, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild(remove);
    XtManageChild(startupPrefsHelpDlgBox);
}
Esempio n. 4
0
Widget post_dialog( Widget parent, int dialog_type, const char * msg) {

    Widget dialog;
    XmString text;

    dialog = XmCreateMessageDialog( parent, "dialog", NULL, 0);
    text = XmStringCreateLocalized( (char *)msg);
    XtVaSetValues( dialog,
                   XmNdialogType, dialog_type,
                   XmNmessageString, text,
                   NULL);
            XmStringFree( text);

            // Remove the Cancel Button from the dialog.
            XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON));

            // Grey out the Help Button
            XtSetSensitive( XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON), False);

            // Destroy the widget when the user clicks OK.
            XtAddCallback( dialog, XmNokCallback, DestroyWidget_cb, (XtPointer)NULL);

            XtManageChild( dialog);

            return dialog;
}
Esempio n. 5
0
void UIMessage(char *message) {
    static int answer;
    Widget dShell;
    static Widget dialogWidget = NULL;
    XmString messageString;

    messageString = XmStringCreate(message, UICharSetNormal);
    if (dialogWidget == NULL) {
        dShell = XtVaCreatePopupShell("UIQuestionDialogShell", xmDialogShellWidgetClass, UITopLevel(),
                                      XmNallowShellResize, true,
                                      XmNtransient, true,
                                      XmNkeyboardFocusPolicy, XmEXPLICIT,
                                      NULL);
        dialogWidget = XtVaCreateManagedWidget("UIWarningDialog", xmMessageBoxWidgetClass, dShell,
                                               XmNnoResize, true,
                                               XmNautoUnmanage, false,
                                               XmNdialogTitle, XmStringCreate((char *) "Warning", UICharSetNormal),
                                               XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
                                               XmNokLabelString, XmStringCreate((char *) "Accept", UICharSetNormal),
                                               XmNdialogType, XmDIALOG_WARNING,
                                               NULL);
        XtAddCallback(dialogWidget, XmNokCallback, (XtCallbackProc) UIAuxSetBooleanTrueCBK, &answer);
        XtAddCallback(dialogWidget, XmNokCallback, (XtCallbackProc) UILoopStopCBK, 0);
        XtUnmanageChild(XmMessageBoxGetChild(dialogWidget, XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(dialogWidget, XmDIALOG_HELP_BUTTON));
    }
    messageString = XmStringCreate(message, UICharSetNormal);
    XtVaSetValues(dialogWidget, XmNmessageString, messageString, NULL);
    XtManageChild(dialogWidget);

    while (UILoop());
    XtUnmanageChild(dialogWidget);
    XmStringFree(messageString);
}
Esempio n. 6
0
static bool refresh_tip_dialog(Widget w)
{
    MString tip = get_tip_of_the_day(w, app_data.startup_tip_count);
    if (!is_tip(tip))
    {
	// Restart from first tip
	app_data.startup_tip_count = 0;
	tip = get_tip_of_the_day(w, app_data.startup_tip_count);
    }
    if (!is_tip(tip))
	return false;

    XtVaSetValues(w, XmNmessageString, tip.xmstring(), XtPointer(0));

    MString next_tip = get_tip_of_the_day(w, app_data.startup_tip_count + 1);
    MString prev_tip = get_tip_of_the_day(w, app_data.startup_tip_count - 1);

    set_sensitive(XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON),
		  is_tip(prev_tip));
    set_sensitive(XmMessageBoxGetChild(w, XmDIALOG_HELP_BUTTON),
		  is_tip(next_tip));

    string title = DDD_NAME " Tip of the Day #" + 
	itostring(app_data.startup_tip_count);
    XtVaSetValues(XtParent(w), XmNtitle, title.chars(), XtPointer(0));

    return true;
}
Esempio n. 7
0
File: mtfgui.c Progetto: juddy/edcde
static void
XlfdCB()
{
  Widget	dialog;
  Arg		args[5];
  char		mess[1024];
  int		n;
  XmString	cs, cs1, cs2;

  sprintf(mess, "%s : %s", resource.file_name, fullpath);
  cs = XmStringCreateLocalized(mess);
  cs1 = XmStringSeparatorCreate();
  cs2 = XmStringConcat(cs, cs1);
  XmStringFree(cs);
  XmStringFree(cs1);
  sprintf(mess, "%s : %s", resource.xlfd_name, fullFontData.xlfdname);
  cs1 = XmStringCreateLocalized(mess);
  cs = XmStringConcat(cs2, cs1);
  XmStringFree(cs1);
  XmStringFree(cs2);
  n = 0;
  XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++;
  XtSetArg (args[n], XmNmessageString, cs); n++;
  XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
  dialog = XmCreateInformationDialog (toplevel, "Xlfd_name", args, n);
  XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
  XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
  XtManageChild (dialog);
  XmStringFree(cs);
}
Esempio n. 8
0
File: help.c Progetto: Rollmops/via
void ShowVersionDialog (View view)
{
    Widget dialog;
    Arg al[] = { { XmNmessageString },
		 { XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL } };

    #define programVersion          \
        "vxview version " ## Version ## ", compiled " ## __DATE__ ## "\n\n" \
        "Laboratory for Computational Intelligence\n" \
	"University of British Columbia"

    /* Create a dialog displaying the message: */
    al[0].value = (XtArgVal) XmStringCreateLtoR ((char *) "bla",
						 XmSTRING_DEFAULT_CHARSET);
    dialog = XmCreateInformationDialog (view->view_shell, "version",
					al, XtNumber (al));
    XmStringFree ((XmString) al[0].value);
    XtVaSetValues (XtParent (dialog),
		   XmNdeleteResponse, XmDESTROY, (char *) NULL);
    XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON));
    XtAddCallback (dialog, XmNokCallback,
		   (XtCallbackProc) XtDestroyWidget, NULL);
    XtManageChild (dialog);

    #undef programVersion
}
Esempio n. 9
0
int
XmLMessageBox(Widget w,
	      char *string,
	      Boolean okOnly)
	{
	int status = 0;
	Widget dialog, shell;
	Arg args[3];
	XtAppContext context;
	XmString str, titleStr;
	String shellTitle;
	Atom WM_DELETE_WINDOW;

	str = XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET);
	XtSetArg(args[0], XmNmessageString, str);
	XtSetArg(args[1], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL);
	shell = XmLShellOfWidget(w);
	if (shell)
		XtVaGetValues(shell, XmNtitle, &shellTitle, NULL);
	if (shell && shellTitle)
		titleStr = XmStringCreateLtoR(shellTitle,
			XmSTRING_DEFAULT_CHARSET);
	else
		titleStr = XmStringCreateSimple("Notice");
	XtSetArg(args[2], XmNdialogTitle, titleStr);
	if (okOnly == True)
		dialog = XmCreateMessageDialog(XtParent(w), "popup", args, 3);
	else
		dialog = XmCreateQuestionDialog(XtParent(w), "popup", args, 3);
	WM_DELETE_WINDOW = XmInternAtom(XtDisplay(w), "WM_DELETE_WINDOW",
		False);
	XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, XmLMessageBoxWMDelete,
		(caddr_t)&status);
	XmStringFree(str);
	XmStringFree(titleStr);
	XtAddCallback(dialog, XmNokCallback, XmLMessageBoxResponse,
		(XtPointer)&status);
	if (okOnly == True)
		{
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
			XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
			XmDIALOG_HELP_BUTTON));
		}
	else
		{
		XtAddCallback(dialog, XmNcancelCallback, XmLMessageBoxResponse,
			(XtPointer)&status);
		XtAddCallback(dialog, XmNhelpCallback, XmLMessageBoxResponse,
			(XtPointer)&status);
		}
	XtManageChild(dialog);

	context = XtWidgetToApplicationContext(w);
	while (!status ||  XtAppPending(context))
		XtAppProcessEvent(context, XtIMAll);
	XtDestroyWidget(dialog);
	return status;
	}
Esempio n. 10
0
void
AutoGoManual( void )
{
    static Boolean 	first_time = True;
    int    	   	n;
    Arg		   	args[10];
    XmString		tcs;
    static Widget	Dialog;
    int			save_x, save_y;

    save_x = xisSavePointerX;
    save_y = xisSavePointerY;
    xisSavePointer();

    if (first_time) {

	tcs = XmStringCreateLtoR(ManString, XmSTRING_DEFAULT_CHARSET);

    	n = 0;
	XtSetArg(args[n], XmNx, 500);					n++;
	XtSetArg(args[n], XmNy, 0);					n++;
    	XtSetArg(args[n], XmNmessageString, tcs);			n++;
    	XtSetArg(args[n], XmNbackground, GetColor("#d0d0d8"));		n++;
	XtSetArg(args[n], XmNautoUnmanage, True);			n++;
	XtSetArg(args[n], XmNdefaultPosition, False);			n++;
	XtSetArg(args[n], XmNshadowThickness, 10);			n++;
	XtSetArg(args[n], XmNmarginWidth, 15);				n++;
	XtSetArg(args[n], XmNmarginHeight, 15);                     	n++;
	Dialog = XmCreateInformationDialog(Shell1, "Dialog", args, n);

	XtAddCallback(Dialog, XmNokCallback, UnPostDialogCB, NULL);

	n = 0;
	XtSetArg(args[n], XmNsensitive, False);				n++;
	XtSetValues(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON),
		    args, n);

	XmStringFree(tcs);

	first_time = False;
    }

    XtManageChild(Dialog);

    XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_CANCEL_BUTTON));

    while (AutoManualMode == True)
	xisSynchronize();

    xisProcessObjects();
    xisUpdateObjectAttributes();

    xisRestorePointer();
    xisSavePointerX = save_x;
    xisSavePointerY = save_y;


}
Esempio n. 11
0
void WNavMotif::message_dialog( char *title, char *text)
{
    Widget 	dialog;
    XmString	text_str;
    XmString	title_str;
    Arg		args[9];
    int		i;
    XEvent 	Event;

    text_str = XmStringCreateLocalized( wnav_dialog_convert_text(text));
    title_str = XmStringCreateLocalized( title);
    i = 0;
    XtSetArg( args[i], XmNmessageString, text_str);
    i++;
    XtSetArg( args[i], XmNdialogTitle, title_str);
    i++;
    XtSetArg( args[i], XmNdialogType, XmDIALOG_MESSAGE);
    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++;
    }

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

    XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON));
    XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON));

    XtAddCallback( dialog, XmNokCallback, wnav_message_dialog_ok, this);

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

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

    dialog_ok = 0;

    for (;;)
    {
        XtAppNextEvent( XtWidgetToApplicationContext( dialog), &Event);
        XtDispatchEvent( &Event);
        if ( dialog_ok)
            return;
    }
}
Esempio n. 12
0
void
help_cb(Widget widget, XtPointer client_data, XtPointer call_data)
{
	static Widget help, about;
	Widget *dialog;
	uintptr_t item_no = (uintptr_t)client_data;

	/*@ -usedef -immediatetrans -onlytrans -mustfreefresh -type +charint -ptrcompare @*/
	if (item_no == 0 && !help) {
		Arg args[5];
		int n = 0;
		XmString msg = XmStringCreateLtoR(
		    "XGps displays live data from a GPS unit controlled by\n"
		    "a running gpsd daemon.\n\n"
		    "The list of satellites and their position on the sky\n"
		    "are displayed and the most important live data is\n"
		    "shown in text fields below the skyview.\n",
		    XmFONTLIST_DEFAULT_TAG);
		XtSetArg(args[n], XmNmessageString, msg); n++;
		help = XmCreateInformationDialog(toplevel, "help_dialog",
						 args, (Cardinal)n);
		XtUnmanageChild(XmMessageBoxGetChild(help,
		    XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(help,
		    XmDIALOG_HELP_BUTTON));
	}

	if (item_no == 1 && !about) {
		Arg args[5];
		int n = 0;
		XmString msg = XmStringCreateLtoR(
		    "XGps 3.1.2\n\n"
		    "Copyright (c) 2007 by Marc Balmer <*****@*****.**>\n"
		    "Copyright (c) 2006 by Eric S. Raymond\n"
		    "\nUse at your own risk.\n\n",
		    XmFONTLIST_DEFAULT_TAG);
		XtSetArg(args[n], XmNmessageString, msg);
		n++;
		about = XmCreateInformationDialog(toplevel, "about_dialog",
						  args, (Cardinal)n);
		XtUnmanageChild(XmMessageBoxGetChild(about,
		    XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(about,
		    XmDIALOG_HELP_BUTTON));
	}
	/*@ +usedef +immediatetrans +onlytrans +mustfreefresh +type -charint +ptrcompare @*/

	if (item_no == 0)
		dialog = &help;
	else
		dialog = &about;

	XtManageChild(*dialog);
	/*@i1@*/XtPopup(XtParent(*dialog), XtGrabNone);
}
Esempio n. 13
0
/******************************************************
  createDialog
******************************************************/
void createDialog(Widget parent,int dialogType,char *message1,char *message2)
{
	XmString        str,str1,str2,str3,string,string2;
	Widget   dialog = 0;

	dialog = XmCreateMessageDialog(parent, "Dialog", NULL, 0);
	XtUnmanageChild(XmMessageBoxGetChild(dialog,XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(dialog,XmDIALOG_HELP_BUTTON));
	XtSetSensitive(XmMessageBoxGetChild(dialog,XmDIALOG_HELP_BUTTON),FALSE);
	XtAddCallback(dialog,XmNokCallback,killDialog,NULL);

	switch(dialogType) {
	case XmDIALOG_WARNING:
		str=XmStringCreateLtoR("WarningDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	case XmDIALOG_ERROR:
		str=XmStringCreateLtoR("ErrorDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	case XmDIALOG_INFORMATION:
		str=XmStringCreateLtoR("InformationDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	case XmDIALOG_MESSAGE:
		str=XmStringCreateLtoR("MessageDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	case XmDIALOG_QUESTION:
		str=XmStringCreateLtoR("QuestionDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	case XmDIALOG_WORKING:
		str=XmStringCreateLtoR("WorkDialog",XmSTRING_DEFAULT_CHARSET);
		break;
	default:
		str=XmStringCreateLtoR("Dialog",XmSTRING_DEFAULT_CHARSET);
		break;
	}

	str1 = XmStringCreateLtoR(message1,XmFONTLIST_DEFAULT_TAG);
	str2 = XmStringCreateLtoR(message2,XmFONTLIST_DEFAULT_TAG);
	string = XmStringConcat(str1,str2);

	str3 = XmStringCreateLtoR("ALH ",XmFONTLIST_DEFAULT_TAG);
	string2 = XmStringConcat(str3,str);

	XtVaSetValues(dialog,
	    XmNdialogType,  dialogType,
	    XmNdialogTitle, string2,
	    XmNmessageString, string,
	    (XtPointer)NULL);
	XmStringFree(str);
	XmStringFree(str1);
	XmStringFree(str2);
	XmStringFree(string);

	XtManageChild(dialog);
	XFlush(display);
}
Esempio n. 14
0
static XEN g_find_dialog_widgets(void)
{
  if (edit_find_dialog)
    return(XEN_CONS(XEN_WRAP_WIDGET(edit_find_dialog),
	     XEN_CONS(XEN_WRAP_WIDGET(edit_find_text),
  	       XEN_CONS(XEN_WRAP_WIDGET(findnextB),
		 XEN_CONS(XEN_WRAP_WIDGET(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_CANCEL_BUTTON)), /* find previous */
		   XEN_CONS(XEN_WRAP_WIDGET(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_OK_BUTTON)),   /* cancel */
		     XEN_EMPTY_LIST))))));
  return(XEN_EMPTY_LIST);
}
Esempio n. 15
0
void display_question_message (Widget parent, char *message,
                               char *button1, XtCallbackProc cb_button1,
                               char *button2, XtCallbackProc cb_button2,
                               char *button3, XtCallbackProc cb_button3)
{
  Widget tmpw;

  QuestionDialog = XmCreateQuestionDialog(parent, "questionDialog", NULL, 0);

  tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_OK_BUTTON);
  if (button1) {
     XtVaSetValues(tmpw,
                   RES_CONVERT( XmNlabelString, button1),
                   NULL);
     XtAddCallback( QuestionDialog, XmNokCallback,
             (XtCallbackProc) cb_button1,
             (XtPointer) NULL );
  } else {
     XtUnmanageChild (tmpw);
  }

  tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_CANCEL_BUTTON);
  if (button2) {
     XtVaSetValues(tmpw,
                   RES_CONVERT( XmNlabelString, button2),
                   NULL);
     XtAddCallback( QuestionDialog, XmNcancelCallback,
             (XtCallbackProc) cb_button2,
             (XtPointer) NULL );
  } else {
     XtUnmanageChild (tmpw);
  }

  tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_HELP_BUTTON);
  if (button3) {
     XtVaSetValues(tmpw,
                   RES_CONVERT( XmNlabelString, button3),
                   NULL);
     XtAddCallback( QuestionDialog, XmNhelpCallback,
             (XtCallbackProc) cb_button3,
             (XtPointer) NULL );
  } else {
     XtUnmanageChild (tmpw);
  }

  XtVaSetValues (QuestionDialog,
                 RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 51, "Create Action - Question")),
                 RES_CONVERT(XmNmessageString, message),
                 NULL);

  XtManageChild (QuestionDialog);
  return;
}
Esempio n. 16
0
void WUtedGtk::questionbox( char *question_title,
			 char	  *question_text,
			 void	  (* yes_procedure) (WUted *),
			 void	  (* no_procedure) (WUted *),
			 void	  (* cancel_procedure) (WUted *), 
			 pwr_tBoolean cancel) 
{
#if 0
  Arg		args[5];
  int 		i;
  XmString	cstr;
  XmString	cstr2;
  XmString	help_label;
  GtkWidget		help_button;
  GtkWidget		yes_button;

  cstr = XmStringCreateLtoR( question_text, "ISO8859-1");
  cstr2 = XmStringCreateLtoR( question_title, "ISO8859-1");
  help_button = XmMessageBoxGetChild(widgets.questionbox, 
				     XmDIALOG_HELP_BUTTON);
  yes_button = XmMessageBoxGetChild( widgets.questionbox, 
				     XmDIALOG_OK_BUTTON);
  
  if (cancel)
    help_label = XmStringCreateLtoR("Cancel", "ISO8859-1");
  else
    help_label = XmStringCreateLtoR("Help", "ISO8859-1");

  i=0;
  XtSetArg(args[i], XmNhelpLabelString, help_label); i++;
  XtSetArg(args[i], XmNmessageString, cstr); i++;
  XtSetArg (args[i], XmNdialogTitle, cstr2); i++;
  XtSetValues( widgets.questionbox, args,i);                    
  
  if (cancel)
    XtVaSetValues(help_button, XmNsensitive, 1, NULL);
  else
    XtVaSetValues(help_button, XmNsensitive, 0, NULL);

  XtManageChild( widgets.questionbox);

  XmStringFree( cstr);
  XmStringFree( cstr2);
  XmStringFree(help_label);

  /* Store the yes and no functions in the context */
  questionbox_yes = yes_procedure;        
  questionbox_no = no_procedure;
  questionbox_cancel = cancel_procedure;

  XmProcessTraversal(yes_button, XmTRAVERSE_CURRENT);
#endif
}
Esempio n. 17
0
static void Error_popup( char *msg_buf )
{
    Widget dialog;
    Widget temp_widget;
    Widget ok_button;
    XmString ok;
    XmString msg;

    ok = XmStringCreateLocalized( "OK" );

    msg = XmStringCreateLtoR( msg_buf, XmFONTLIST_DEFAULT_TAG );

    dialog = XmCreateInformationDialog( Top_widget, "error", NULL, 0 );

    /* Get rid of Cancel and Help buttons on popup. */

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON );
    XtUnmanageChild( temp_widget );

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON );
    XtUnmanageChild( temp_widget );

    /* Set properties of OK button. */

    ok_button = XmMessageBoxGetChild( dialog, XmDIALOG_OK_BUTTON );

    XtVaSetValues( ok_button,
                   XmNforeground, hci_get_read_color( BUTTON_FOREGROUND ),
                   XmNbackground, hci_get_read_color( BUTTON_BACKGROUND ),
                   NULL );

    /* Set properties of popup. */

    XtVaSetValues (dialog,
                   XmNmessageString, msg,
                   XmNokLabelString, ok,
                   XmNbackground, hci_get_read_color( WARNING_COLOR ),
                   XmNforeground, hci_get_read_color( TEXT_FOREGROUND ),
                   XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL,
                   XmNdeleteResponse, XmDESTROY,
                   NULL);

    /* Free allocated space. */

    XmStringFree( ok );
    XmStringFree( msg );

    /* Do this to make popup appear. */

    XtManageChild( dialog );
    XtPopup( Top_widget, XtGrabNone );
}
Esempio n. 18
0
void CtrlBox(int argc,  char **argv) {
	XtAppContext app;
       	Widget 	toplevel, box, temp;
       	Widget   buttons[10];
       	int  	nbuttons;
        char*	exitPoint = names[EXIT_PROGRAM];
	if (argc > 1) {
		argv[0] = "Remote";
		if (argc > 2) exitPoint = "Back to PC desktop    ";
	}
	else argv[0] = "Local";
       	argc = 1;

       	toplevel =  XtVaAppInitialize(&app,"CtrlBox",NULL, 0, &argc, argv, NULL, NULL);

       	box = XtVaCreateManagedWidget("box",xmRowColumnWidgetClass, toplevel, NULL);

       	nbuttons = 0;
       	while(names[nbuttons] != 0) {
		if (nbuttons == EXIT_PROGRAM )
		buttons[nbuttons] = XtVaCreateManagedWidget(exitPoint,
                        xmPushButtonWidgetClass, box, NULL, 0);
		else
		buttons[nbuttons] = XtVaCreateManagedWidget(names[nbuttons],
			xmPushButtonWidgetClass, box, NULL, 0);
		XtAddCallback(buttons[nbuttons],XmNactivateCallback, callback,
			&values[nbuttons]);
	    nbuttons++;
	}

	// Create a popup error message dialog; no cancel, no help button 
	errorDialog = XmCreateErrorDialog(box, "errorDialog", NULL, 0);
	temp = XmMessageBoxGetChild(errorDialog, XmDIALOG_CANCEL_BUTTON);
	XtUnmanageChild(temp);
	temp = XmMessageBoxGetChild(errorDialog, XmDIALOG_HELP_BUTTON);
	XtUnmanageChild(temp);

	// Create a popup dialog to get the filename; no help button 
	fileDialog = XmCreateFileSelectionDialog(box, "fileDialog", NULL, 0);
	XtVaSetValues(fileDialog, XmNwidth, 400, NULL);
  	temp = XmFileSelectionBoxGetChild(fileDialog, XmDIALOG_HELP_BUTTON);
  	XtUnmanageChild(temp);

  	XtAddCallback(fileDialog, XmNokCallback, OpenFile, NULL);
	XtAddCallback(fileDialog, XmNcancelCallback, Cancel, NULL);

	XtManageChildren(buttons,nbuttons);
	XtRealizeWidget(toplevel);
        XMoveWindow (XtDisplay(toplevel), XtWindow(toplevel), 0, 0);
	XWarpPointer(XtDisplay(box), None, XtWindow(box), 0, 0, 0, 0, 400, 300);
	XtAppMainLoop(app);
}
Esempio n. 19
0
void MessageBox::show(std::string name, std::string message, std::string title, int messageBoxType)
{
  Arg args[4];
  Widget widget;

  XtSetArg(args[0], XmNmessageString, (XmStringCreateLtoR((char*)message.c_str(), XmSTRING_DEFAULT_CHARSET)));
  XtSetArg(args[1], XmNtitleString, (XmStringCreateLtoR((char*)title.c_str(), XmSTRING_DEFAULT_CHARSET)));
  XtSetArg(args[2], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);
  XtSetArg(args[3], XmNtitle, title.c_str());
  widget = XmCreateErrorDialog(Application::getWidget(), (char*)name.c_str(), args, 4);
  XtUnmanageChild(XmMessageBoxGetChild(widget, XmDIALOG_HELP_BUTTON));
  XtUnmanageChild(XmMessageBoxGetChild(widget, XmDIALOG_CANCEL_BUTTON));
  XtManageChild(widget);
  XtRealizeWidget(widget);
}
Esempio n. 20
0
void CoWowMotif::DisplayQuestion( void *ctx, const char *title, const char *text,
				  void (* questionbox_ok) ( void *, void *),
				  void (* questionbox_cancel) ( void *, void *),
				  void *data)
{
    Arg	    arg[10];
    Widget  question_widget, w;
    XmString CStr2, TitleStr, okstr, cancelstr;
    wow_t_question_cb *cbdata;
    XmFontList fontlist;
    XFontStruct *font;
    XmFontListEntry fontentry;

    // Set default fontlist
    font = XLoadQueryFont( XtDisplay(m_parent),
	      "-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1");
    fontentry = XmFontListEntryCreate( (char*) "tag1", XmFONT_IS_FONT, font);
    fontlist = XmFontListAppendEntry( NULL, fontentry);
    XtFree( (char *)fontentry);

    CStr2 = XmStringCreateLtoR( (char*) text, XmSTRING_DEFAULT_CHARSET);
    TitleStr = XmStringCreateLtoR( (char*) title, XmSTRING_DEFAULT_CHARSET);    
    okstr = XmStringCreateLtoR( (char*) " Yes ", XmSTRING_DEFAULT_CHARSET );    
    cancelstr = XmStringCreateLtoR( (char*) " No  ", XmSTRING_DEFAULT_CHARSET );    
    XtSetArg(arg[0],XmNheight,75);
    XtSetArg(arg[1],XmNwidth,200);
    XtSetArg(arg[2],XmNmessageString, CStr2);
    XtSetArg(arg[3],XmNx,400);
    XtSetArg(arg[4],XmNy,300);
    XtSetArg(arg[5],XmNdialogTitle,TitleStr);
    XtSetArg(arg[6], XmNokLabelString, okstr);
    XtSetArg(arg[7], XmNcancelLabelString, cancelstr);
    XtSetArg(arg[8], XmNbuttonFontList, fontlist);
    XtSetArg(arg[9], XmNlabelFontList, fontlist);

    cbdata = (wow_t_question_cb *) XtCalloc( 1, sizeof(*cbdata));
    cbdata->questionbox_ok = questionbox_ok;
    cbdata->questionbox_cancel = questionbox_cancel;
    cbdata->questionbox_help = 0;
    cbdata->ctx = ctx;
    cbdata->data = data;

    question_widget = XmCreateQuestionDialog( m_parent,(char*) "questionDialog",arg,10);
    XtAddCallback( question_widget, XmNokCallback,
		(XtCallbackProc) question_ok_cb, cbdata);
    XtAddCallback( question_widget, XmNcancelCallback, 
		(XtCallbackProc) question_cancel_cb, cbdata);

    XmStringFree( CStr2);
    XmStringFree( TitleStr);
    XmStringFree( okstr);
    XmStringFree( cancelstr);
    XmFontListFree( fontlist);
    
    XtManageChild( question_widget);	       
    
    w = XmMessageBoxGetChild( question_widget, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild(w);    

}
Esempio n. 21
0
static int motFileDlgAskUser(Widget parent, const char* message)
{
  Widget questionbox;
  Arg args[3];
  int ret_code = 0;
  XmString title;

  XtSetArg(args[0], XmNautoUnmanage, False);
  XtSetArg(args[1], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);
  XtSetArg(args[2], XmNnoResize, True);
  questionbox = XmCreateQuestionDialog(parent, "filedlg_question", args, 3);
  iupmotSetString(questionbox, XmNmessageString, message);
  XtVaGetValues(parent, XmNdialogTitle, &title, NULL);
  XtVaSetValues(questionbox, XmNdialogTitle, title, NULL);

  XtAddCallback(questionbox, XmNokCallback, (XtCallbackProc)motFileDlgAskUserCallback, (XtPointer)&ret_code);
  XtAddCallback(questionbox, XmNcancelCallback, (XtCallbackProc)motFileDlgAskUserCallback, (XtPointer)&ret_code);
  XtUnmanageChild(XmMessageBoxGetChild(questionbox, XmDIALOG_HELP_BUTTON));
  XtManageChild(questionbox);

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

  XtUnmanageChild(questionbox);

  if (ret_code == 1)
    return 1;
  else
    return 0;
}
Esempio n. 22
0
void errwin(const char *s)
{
    static XmString str;
    log_results((char *)s);
    if ((!inwin) || (!ismaster))
    {
        fprintf(stderr, "%s\n", s);
        return;
    }
    if (error_popup)
    {
        XmStringFree(str);
        str = XmStringCreateLtoR((char *)s, charset);
        XtVaSetValues(error_popup,
                      XmNmessageString, str,
                      NULL);
        XtManageChild(error_popup);
        return;
    }
    str = XmStringCreateLtoR((char *)s, charset);
    error_popup = XmCreateErrorDialog(app_shell, (char *)"errordlg", NULL, 0);
    XtVaSetValues(error_popup,
                  XmNmessageString, str,
                  XmNdialogTitle, XmStringCreateLtoR((char *)"Error", charset),
                  XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
                  NULL);
    XtAddCallback(error_popup, XmNhelpCallback, (XtCallbackProc)error_helpCB,
                  (XtPointer)NULL);
    XtUnmanageChild(XmMessageBoxGetChild(error_popup, XmDIALOG_CANCEL_BUTTON));
    XtManageChild(error_popup);
}
Esempio n. 23
0
static void 
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
static Widget Dialog = NULL;
char HelpText[] =
   "Generic help for XltFilePicker\n"
   "Type in a file name, or click on Browse\n"
   "to search for one."
   ;

    if (Dialog == NULL)
    {
    Widget ParentShell;
    XmString string;

    	ParentShell = w;
    	while (!XtIsApplicationShell(ParentShell)) ParentShell = XtParent(ParentShell);
    	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
    	XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
    	string = XmStringCreateLtoR(HelpText,XmFONTLIST_DEFAULT_TAG);
    	XtVaSetValues(Dialog,
    		XmNmessageString, string,
    		NULL);
    }
    XtManageChild(Dialog);
}
Esempio n. 24
0
static void PlotterNotFoundHP(Agent *plotter, void *client_data, void *)
{
#if !NDEBUG
    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;
    assert(plot->plotter == 0 || plot->plotter == plotter);
#endif

    plotter->removeHandler(Died, PlotterNotFoundHP, client_data);

    string base = app_data.plot_command;
    if (base.contains(' '))
	base = base.before(' ');

    Arg args[10];
    Cardinal arg = 0;
    MString msg = rm( capitalize(base) + " could not be started.");
    XtSetArg(args[arg], XmNmessageString, msg.xmstring()); arg++;
    Widget dialog = 
	verify(XmCreateErrorDialog(find_shell(),
				   XMST("no_plotter_dialog"), args, arg));
    XtUnmanageChild(XmMessageBoxGetChild
		    (dialog, XmDIALOG_CANCEL_BUTTON));
    XtAddCallback(dialog, XmNhelpCallback, ImmediateHelpCB, XtPointer(0));

    Delay::register_shell(dialog);
    manage_and_raise(dialog);
}
Esempio n. 25
0
void
XltHelpOnStrokes(Widget W)
{
static Widget Dialog = NULL;
Widget Shell = W;

	while (!XtIsShell(Shell)) Shell = XtParent(Shell);
	if (Dialog == NULL)
	{
	XmString string;
	XtResource resources[] =
	{
	    {"messageString", "MessageString", XtRString, sizeof(String), XtOffset(AppResourcesPtr, DefaultHelpString), XtRImmediate, DefaultHelp},
	};
	    Dialog = XmCreateInformationDialog(Shell, "HelpOnStrokes", NULL, 0);
	    XtGetSubresources(W,
			      &AppResources,
			      XtName(Dialog),
			      XtClass(Dialog)->core_class.class_name,
			      resources,
			      XtNumber(resources),
			      NULL, 0);
	    string = XmStringCreateLtoR(AppResources.DefaultHelpString, XmFONTLIST_DEFAULT_TAG);
	    XtVaSetValues(Dialog,
		    XmNmessageString, string,
		    NULL);
	    XmStringFree(string);
	    XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
	}
	XtManageChild(Dialog);
}
Esempio n. 26
0
Widget CreateWarningDialogWithCancelBox(Widget widgetParent)
{
   int i, lng;
   Widget warning, bouton;
   XmString label1, label2;
   Arg args[8];
   
   lng = c_getulng();

   i = 0;
   label1 = XmStringCreateLtoR(labelNon[lng], XmSTRING_DEFAULT_CHARSET);
   XtSetArg(args[i], XmNcancelLabelString, label1); i++;

   label2 = XmStringCreateLtoR(labelOui[lng], XmSTRING_DEFAULT_CHARSET);
   XtSetArg(args[i], XmNokLabelString, label2); i++;
   XtSetArg(args[i], XmNinitialResourcesPersistent, False); i++;

   warning = (Widget)XmCreateWarningDialog(widgetParent, "popup", args, i);
   CheckColormap(warning);

   XmStringFree(label1);
   XmStringFree(label2);

   bouton = (Widget)XmMessageBoxGetChild(warning, XmDIALOG_HELP_BUTTON);
   XtUnmanageChild(bouton);

   XtAddCallback(warning, XmNcancelCallback, (XtCallbackProc) AvrtOk, BTN_CANCEL);
   XtAddCallback(warning, XmNokCallback, (XtCallbackProc) AvrtOk, (XtPointer) BTN_OK);

   return warning;
   }
Esempio n. 27
0
static int motMessageDlgMap(Ihandle *h)
{
  Widget parent;
  Widget MsgBox;
  Pixel fg, bg;
  XmString caption, message;
  Arg args[10];
  int ac = 0;

  if (child(h) != NULL && handle(child(h)) != NULL)
    return IUP_NOERROR;

  iupCpiDefaultMap( h, 0 );

  parent = XtNameToWidget( (Widget)handle(h), "*dialog_area");
  XtVaSetValues( parent, XmNresizePolicy, XmRESIZE_ANY, NULL );
  XtVaGetValues( parent, XmNforeground, &fg, XmNbackground, &bg, NULL );

  caption = XmStringCreateLocalized(IupGetAttribute(h, IUP_TITLE));
  message = XmStringCreateLocalized(IupGetAttribute(h, IUP_VALUE));
  XtSetArg(args[ac], XmNmessageString, message); ac++;
  XtSetArg(args[ac], XmNdialogTitle, caption); ac++;
  XtSetArg(args[ac], XmNforeground, fg ); ac++;
  XtSetArg(args[ac], XmNbackground, bg ); ac++;
  XtSetArg(args[ac], XmNresizePolicy, XmRESIZE_NONE ); ac++;

  MsgBox = XtCreateWidget("msgbox",
    xmMessageBoxWidgetClass, parent,
    args, ac );

  if (!MsgBox)
    return IUP_ERROR;

  XmStringFree( caption );
  XmStringFree( message );
  XtUnmanageChild(XmMessageBoxGetChild(MsgBox, XmDIALOG_CANCEL_BUTTON));
  XtUnmanageChild(XmMessageBoxGetChild(MsgBox, XmDIALOG_HELP_BUTTON));

  XtAddCallback(MsgBox, XmNokCallback,
    (XtCallbackProc)motMessageDlgOkCb, (XtPointer)h);

  XtManageChild(MsgBox);
  handle(child(h)) = MsgBox;

  return IUP_NOERROR;
}
Esempio n. 28
0
File: ssX.c Progetto: q3k/ski
void prodInfoCallback(CALLBACK_ARGS)
{
    static Widget dialog = NULL;

    if (!dialog) {
	XmString xms;
	Arg arg;

	xms = XmStringCreateLtoR(productInfo(), XmFONTLIST_DEFAULT_TAG);
	XtSetArg(arg, XmNmessageString, xms);
	dialog = XmCreateInformationDialog(cmd, "prodInfo", &arg, 1);
	XmStringFree(xms);
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
    }
    XtManageChild(dialog);
}
Esempio n. 29
0
File: Main.c Progetto: juddy/edcde
void
InfoDialog(
        char *infoString,
        Widget parent,
        Boolean unmapParent )
{
    int             n;
    Arg             args[10];
    static XmString ok = NULL;
    Widget          w;

    /* create the compound string */
    style.tmpXmStr = CMPSTR(infoString);

    if (ok == NULL)
	ok = CMPSTR((String) _DtOkString);

    /* create it */
    n = 0;
    XtSetArg(args[n], XmNokLabelString, ok);                            n++;
    XtSetArg(args[n], XmNmessageString, style.tmpXmStr);                n++;
    XtSetArg(args[n], XmNdialogStyle, XmDIALOG_MODELESS);               n++;
    XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC);                n++;
    w = XmCreateInformationDialog(parent, "Notice", args, n);

    if (unmapParent)
        XtAddCallback (w, XmNokCallback, DestroyCB, parent);
    else
        XtAddCallback (w, XmNokCallback, DestroyCB, NULL);
    XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON) );
    XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_HELP_BUTTON) );

    /* set the dialog shell parent title */
    n=0;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 2, "Notice")));   n++;
    XtSetValues (XtParent(w), args, n);

    /* free the compound string */
    XmStringFree (style.tmpXmStr);

    /* manage the info dialog */
    XtManageChild(w);

}
Esempio n. 30
0
void CoWowMotif::DisplayError( const char *title, const char *text)
{
    Arg	    arg[10];
    Widget  err_widget, w;
    XmString cstr, ctitle;
    XmFontList fontlist;
    XFontStruct *font;
    XmFontListEntry fontentry;

    // Set default fontlist
    font = XLoadQueryFont( XtDisplay(m_parent),
	      "-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1");
    fontentry = XmFontListEntryCreate( (char*) "tag1", XmFONT_IS_FONT, font);
    fontlist = XmFontListAppendEntry( NULL, fontentry);
    XtFree( (char *)fontentry);

    cstr = XmStringCreateLtoR( (char*) text, XmSTRING_DEFAULT_CHARSET);
    ctitle = XmStringCreateLtoR( (char*) title, XmSTRING_DEFAULT_CHARSET);    
    XtSetArg(arg[0],XmNheight,75);
    XtSetArg(arg[1],XmNwidth,200);
    XtSetArg(arg[2],XmNmessageString, cstr);
    XtSetArg(arg[3],XmNx,400);
    XtSetArg(arg[4],XmNy,300);
    XtSetArg(arg[5],XmNdialogTitle, ctitle);
    XtSetArg(arg[6], XmNbuttonFontList, fontlist);
    XtSetArg(arg[7], XmNlabelFontList, fontlist);

    err_widget = XmCreateErrorDialog( m_parent,(char*) "err_widget",arg,8);
    XtAddCallback(err_widget, XmNokCallback, 
		(XtCallbackProc) error_ok_cb, NULL);

    XmStringFree( cstr);
    XmStringFree( ctitle);
    XmFontListFree( fontlist);
      
    XtManageChild(err_widget);	       
    
    w = XmMessageBoxGetChild(err_widget, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild( w);    
    
    w = XmMessageBoxGetChild(err_widget, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild( w);    

} /* END DisplayErrorBox */