home *** CD-ROM | disk | FTP | other *** search
Wrap
/* * Copyright 1993, 1994, Silicon Graphics, Inc. * All Rights Reserved. * * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; * the contents of this file may not be disclosed to third parties, copied or * duplicated in any form, in whole or in part, without the prior written * permission of Silicon Graphics, Inc. * * RESTRICTED RIGHTS LEGEND: * Use, duplication or disclosure by the Government is subject to restrictions * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data * and Computer Software clause at DFARS 252.227-7013, and/or in similar or * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - * rights reserved under the Copyright Laws of the United States. */ /******************************************************************************* Question.c *******************************************************************************/ #include <stdio.h> #include <Xm/Xm.h> #include <Xm/DialogS.h> #include <Xm/MenuShell.h> #include "UxXt.h" #include <Xm/MessageB.h> /******************************************************************************* Includes, Defines, and Global variables from the Declarations Editor: *******************************************************************************/ #include "exinterfmotif.h" #include "exglobals.h" /******************************************************************************* The definition of the context structure: If you create multiple instances of your interface, the context structure ensures that your callbacks use the variables for the correct instance. For each Widget in the interface, each argument to the Interface function, and each variable in the Instance Specific section of the Declarations Editor, there is an entry in the context structure. and a #define. The #define makes the variable name refer to the corresponding entry in the context structure. *******************************************************************************/ typedef struct { int mumble; } _UxCQuestion; static _UxCQuestion *UxQuestionContext; Widget Question; /******************************************************************************* Forward declarations of functions that are defined later in this file. *******************************************************************************/ Widget create_Question(); /******************************************************************************* The following are callback functions. *******************************************************************************/ static void okCallback_Question( UxWidget, UxClientData, UxCallbackArg ) Widget UxWidget; XtPointer UxClientData, UxCallbackArg; { _UxCQuestion *UxSaveCtx, *UxContext; UxSaveCtx = UxQuestionContext; UxQuestionContext = UxContext = (_UxCQuestion *) UxGetContext( UxWidget ); { if (DialogType == 2) DeleteDemoFlag = True; else if (DialogType == 3) DeleteGroupFlag = True; else if (DialogType == 4) { RDwin = -1; UxPopdownInterface(BookFile); DialogType = 0; write_file(FileName); } else if (DialogType == 5) WantToEnterFilesFlag = True; else if (DialogType == 6) exit(1); else if (DialogType == 7) write_file(FileName); DialogType = 0; UxNotify(); } UxQuestionContext = UxSaveCtx; } static void cancelCB_Question( UxWidget, UxClientData, UxCallbackArg ) Widget UxWidget; XtPointer UxClientData, UxCallbackArg; { _UxCQuestion *UxSaveCtx, *UxContext; UxSaveCtx = UxQuestionContext; UxQuestionContext = UxContext = (_UxCQuestion *) UxGetContext( UxWidget ); { if (DialogType == 2) DeleteDemoFlag = False; else if (DialogType == 3) DeleteGroupFlag = False; else if (DialogType == 5) WantToEnterFilesFlag = False; DialogType = 0; UxNotify(); } UxQuestionContext = UxSaveCtx; } Widget Question_shell; static Widget _Uxbuild_Question() { Question_shell = XtVaCreatePopupShell( "Question_shell", xmDialogShellWidgetClass, DBtoplevel, XmNx, 650, XmNy, 670, XmNwidth, 400, XmNheight, 190, XmNshellUnitType, XmPIXELS, XmNtitle, "Question", NULL ); Question = XtVaCreateWidget( "Question", xmMessageBoxWidgetClass, Question_shell, RES_CONVERT( XmNcancelLabelString, "No" ), XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL, XmNdialogType, XmDIALOG_QUESTION, RES_CONVERT( XmNtextFontList, "-Adobe-Courier-Bold-R-Normal--14-100-100-100-M-90-ISO8859-1" ), RES_CONVERT( XmNokLabelString, "Yes" ), RES_CONVERT( XmNmessageString, " " ), XmNmarginHeight, 12, XmNmarginWidth, 20, RES_CONVERT( XmNlabelFontList, "-Adobe-Helvetica-Bold-R-Normal--14-100-100-100-P-82-ISO8859-1" ), RES_CONVERT( XmNdialogTitle, "Question" ), RES_CONVERT( XmNbuttonFontList, "-Adobe-Helvetica-Bold-R-Normal--14-100-100-100-P-82-ISO8859-1" ), /* XmNshadowThickness, 5, RES_CONVERT( XmNforeground, "black" ), RES_CONVERT( XmNtopShadowColor, "#e5e5e5" ), RES_CONVERT( XmNbottomShadowColor, "#6c6c6c" ), RES_CONVERT( XmNbackground, "#BBBBBB" ), */ XmNheight, 190, XmNwidth, 400, XmNunitType, XmPIXELS, NULL ); UxPutContext( Question, (char *) UxQuestionContext ); XtAddCallback( Question, XmNdestroyCallback, UxFreeClientDataCB, (XtPointer) UxQuestionContext ); XtAddCallback( Question, XmNokCallback, okCallback_Question, (XtPointer) UxQuestionContext ); XtAddCallback( Question, XmNcancelCallback, cancelCB_Question, (XtPointer) UxQuestionContext ); XtRealizeWidget ( Question_shell ); SetWMhints( Question_shell ); return ( Question ); } /******************************************************************************* The following function includes the code that was entered in the 'Initial Code' and 'Final Code' sections of the Declarations Editor. This function is called from the 'Interface function' below. *******************************************************************************/ static Widget _Ux_create_Question() { Widget rtrn; _UxCQuestion *UxContext; UxQuestionContext = UxContext = (_UxCQuestion *) XtMalloc( sizeof(_UxCQuestion) ); rtrn = _Uxbuild_Question(); XtUnmanageChild(XmMessageBoxGetChild (Question, XmDIALOG_HELP_BUTTON)); return(rtrn); } /******************************************************************************* The following is the 'Interface function' which is the external entry point for creating this interface. This function should be called from your application or from a callback function. *******************************************************************************/ Widget create_Question() { Widget _Uxrtrn; _Uxrtrn = _Ux_create_Question(); return ( _Uxrtrn ); } popup_Question() { char title_string[20]; char question_string[255]; if (DialogType == 2) { strcpy (title_string, "Delete Demo"); strcpy (question_string, "\nDo you want to delete\nthe demo, "); strcat (question_string, msgstring); strcat (question_string, " ?\n"); } else if (DialogType == 3) { strcpy (title_string, "Delete Book"); strcpy (question_string, "\nDo you want to delete\nthe book, "); strcat (question_string, msgstring); strcat (question_string, " ?\n"); } else if (DialogType == 4) { strcpy (title_string, "File Exists"); strcpy (question_string, "File already exists.\n\nDo you want to overwrite it?"); } else if (DialogType == 5) { strcpy (title_string, "No Files"); strcpy (question_string, "You have not entered any Executable or Data Files.\nYou will not be able to copy this demo onto tape.\n\nDo you want to enter the File Names now?"); } else if (DialogType == 6) { printf(" dialog type 6 is not being used \n"); } else if (DialogType == 7) { strcpy (title_string, "Save Book File"); strcpy (question_string, "\nDo you want to save the book file\n"); strcat (question_string, FileName); strcat (question_string, " ?\n"); } XtVaSetValues( Question_shell, XmNtitle, title_string, NULL ); XtVaSetValues( Question, RES_CONVERT( XmNdialogTitle, title_string ), NULL ); XtVaSetValues( Question, RES_CONVERT( XmNmessageString, question_string ), NULL ); UxPopupInterface(Question, exclusive_grab); } /******************************************************************************* END OF FILE *******************************************************************************/