#include "xsm.h"
#include "info.h"
#include "save.h"
#include "log.h"
#include "mainwin.h"
#include <X11/Shell.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/MenuButton.h>
#include <X11/Xaw/SmeBSB.h>
Widget mainWindow;
Widget clientInfoButton;
Widget logButton;
Widget checkPointButton;
Widget shutdownButton;
Widget shutdownMenu;
Widget shutdownSave;
Widget shutdownDontSave;
static void
DelMainWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (shutdownSave, XtNcallback, NULL);
}
void
create_main_window (void)
{
static XtActionsRec actions[] = {
{"DelMainWinAction", DelMainWinAction}
};
mainWindow = XtVaCreateManagedWidget (
"mainWindow", formWidgetClass, topLevel,
NULL);
clientInfoButton = XtVaCreateManagedWidget (
"clientInfoButton", commandWidgetClass, mainWindow,
XtNfromHoriz, NULL,
XtNfromVert, NULL,
XtNresizable, True,
XtNjustify, XtJustifyLeft,
NULL);
XtAddCallback (clientInfoButton, XtNcallback, ClientInfoXtProc, 0);
logButton = XtVaCreateManagedWidget (
"logButton", commandWidgetClass, mainWindow,
XtNfromHoriz, clientInfoButton,
XtNfromVert, NULL,
XtNresizable, True,
XtNjustify, XtJustifyLeft,
NULL);
XtAddCallback (logButton, XtNcallback, DisplayLogXtProc, 0);
checkPointButton = XtVaCreateManagedWidget (
"checkPointButton", commandWidgetClass, mainWindow,
XtNfromHoriz, NULL,
XtNfromVert, clientInfoButton,
XtNresizable, True,
XtNjustify, XtJustifyLeft,
NULL);
XtAddCallback (checkPointButton, XtNcallback, CheckPointXtProc, 0);
shutdownButton = XtVaCreateManagedWidget (
"shutdownButton", menuButtonWidgetClass, mainWindow,
XtNmenuName, "shutdownMenu",
XtNfromHoriz, checkPointButton,
XtNfromVert, clientInfoButton,
XtNresizable, True,
XtNjustify, XtJustifyLeft,
NULL);
shutdownMenu = XtVaCreatePopupShell (
"shutdownMenu", simpleMenuWidgetClass, mainWindow,
NULL);
shutdownSave = XtVaCreateManagedWidget (
"shutdownSave", smeBSBObjectClass, shutdownMenu,
NULL);
shutdownDontSave = XtVaCreateManagedWidget (
"shutdownDontSave", smeBSBObjectClass, shutdownMenu,
NULL);
XtAddCallback (shutdownSave, XtNcallback, ShutdownSaveXtProc, 0);
XtAddCallback (shutdownDontSave, XtNcallback, ShutdownDontSaveXtProc, 0);
XtAppAddActions (appContext, actions, XtNumber (actions));
}