1 /* $Xorg: mainwin.c,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */ 2 /****************************************************************************** 3 4 Copyright 1993, 1998 The Open Group 5 6 Permission to use, copy, modify, distribute, and sell this software and its 7 documentation for any purpose is hereby granted without fee, provided that 8 the above copyright notice appear in all copies and that both that 9 copyright notice and this permission notice appear in supporting 10 documentation. 11 12 The above copyright notice and this permission notice shall be included in 13 all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 22 Except as contained in this notice, the name of The Open Group shall not be 23 used in advertising or otherwise to promote the sale, use or other dealings 24 in this Software without prior written authorization from The Open Group. 25 ******************************************************************************/ 26 /* $XFree86: xc/programs/xsm/mainwin.c,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ 27 28 #include "xsm.h" 29 #include "info.h" 30 #include "save.h" 31 #include "log.h" 32 #include "mainwin.h" 33 34 #include <X11/Shell.h> 35 #include <X11/Xaw/Form.h> 36 #include <X11/Xaw/Command.h> 37 #include <X11/Xaw/SimpleMenu.h> 38 #include <X11/Xaw/MenuButton.h> 39 #include <X11/Xaw/SmeBSB.h> 40 41 Widget mainWindow; 42 Widget clientInfoButton; 43 Widget logButton; 44 Widget checkPointButton; 45 Widget shutdownButton; 46 static Widget shutdownMenu; 47 static Widget shutdownSave; 48 Widget shutdownDontSave; 49 50 51 52 static void 54 DelMainWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params) 55 { 56 XtCallCallbacks (shutdownSave, XtNcallback, NULL); 57 } 58 59 60 61 void 63 create_main_window (void) 64 { 65 /* 66 * Main window 67 */ 68 69 static XtActionsRec actions[] = { 70 {"DelMainWinAction", DelMainWinAction} 71 }; 72 73 mainWindow = XtVaCreateManagedWidget ( 74 "mainWindow", formWidgetClass, topLevel, 75 NULL); 76 77 clientInfoButton = XtVaCreateManagedWidget ( 78 "clientInfoButton", commandWidgetClass, mainWindow, 79 XtNfromHoriz, NULL, 80 XtNfromVert, NULL, 81 XtNresizable, True, 82 XtNjustify, XtJustifyLeft, 83 NULL); 84 85 XtAddCallback (clientInfoButton, XtNcallback, ClientInfoXtProc, NULL); 86 87 logButton = XtVaCreateManagedWidget ( 88 "logButton", commandWidgetClass, mainWindow, 89 XtNfromHoriz, clientInfoButton, 90 XtNfromVert, NULL, 91 XtNresizable, True, 92 XtNjustify, XtJustifyLeft, 93 NULL); 94 95 XtAddCallback (logButton, XtNcallback, DisplayLogXtProc, NULL); 96 97 checkPointButton = XtVaCreateManagedWidget ( 98 "checkPointButton", commandWidgetClass, mainWindow, 99 XtNfromHoriz, NULL, 100 XtNfromVert, clientInfoButton, 101 XtNresizable, True, 102 XtNjustify, XtJustifyLeft, 103 NULL); 104 105 XtAddCallback (checkPointButton, XtNcallback, CheckPointXtProc, NULL); 106 107 shutdownButton = XtVaCreateManagedWidget ( 108 "shutdownButton", menuButtonWidgetClass, mainWindow, 109 XtNmenuName, "shutdownMenu", 110 XtNfromHoriz, checkPointButton, 111 XtNfromVert, clientInfoButton, 112 XtNresizable, True, 113 XtNjustify, XtJustifyLeft, 114 NULL); 115 116 shutdownMenu = XtVaCreatePopupShell ( 117 "shutdownMenu", simpleMenuWidgetClass, mainWindow, 118 NULL); 119 120 shutdownSave = XtVaCreateManagedWidget ( 121 "shutdownSave", smeBSBObjectClass, shutdownMenu, 122 NULL); 123 124 shutdownDontSave = XtVaCreateManagedWidget ( 125 "shutdownDontSave", smeBSBObjectClass, shutdownMenu, 126 NULL); 127 128 XtAddCallback (shutdownSave, XtNcallback, ShutdownSaveXtProc, NULL); 129 XtAddCallback (shutdownDontSave, XtNcallback, ShutdownDontSaveXtProc, NULL); 130 131 XtAppAddActions (appContext, actions, XtNumber (actions)); 132 } 133