1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/*******************************************************************************
* *
* Viewmol *
* *
* I N F O F O R M . C *
* *
* Copyright (c) Joerg-R. Hill, October 2003 *
* *
********************************************************************************
*
* $Id: infoform.c,v 1.2 2003/11/07 11:03:43 jrh Exp $
* $Log: infoform.c,v $
* Revision 1.2 2003/11/07 11:03:43 jrh
* Release 2.4
*
* Revision 1.1 2000/12/10 15:09:10 jrh
* Initial revision
*
*/
#include<X11/Intrinsic.h>
#include<Xm/Xm.h>
#include<Xm/BulletinB.h>
#include<Xm/Form.h>
#include<Xm/Label.h>
#include<Xm/LabelG.h>
#include<Xm/MessageB.h>
#include<Xm/PanedW.h>
#include<Xm/PushB.h>
#include<Xm/PushBG.h>
#include<Xm/RowColumn.h>
#include<Xm/Separator.h>
#include<Xm/Text.h>
#include<Xm/ToggleB.h>
#include<stdio.h>
#include<stdlib.h>
#include "dialog.h"
extern Widget CreatePushButtonRow(Widget, struct PushButtonRow *, int);
extern void MapBox(Widget, caddr_t, XmAnyCallbackStruct *);
extern Widget initShell(Widget, char *, Widget *, Widget *);
void infoForm(void);
void infoFormExit(Widget, caddr_t, caddr_t);
void infoSetText(char *);
static Widget dialog, text=NULL;
static XmTextPosition position=0;
extern Widget topShell;
void infoForm(void)
{
Widget board, form, scrolledWindow;
static struct PushButtonRow buttons[] = {
{ "cancel", infoFormExit, (XtPointer)0, NULL },
};
dialog=initShell(topShell, "infoForm", &board, &form);
XtAddCallback(dialog, XmNpopupCallback, (XtCallbackProc)MapBox, (XmAnyCallbackStruct *)NULL);
text=XmCreateScrolledText(form, "text", NULL, 0);
scrolledWindow=XtParent(text);
XtVaSetValues(scrolledWindow, XmNtopAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNrightAttachment, XmATTACH_FORM,
NULL);
XtVaSetValues(text, XmNeditMode, XmMULTI_LINE_EDIT,
XmNcolumns, 80,
XmNrows, 10,
XmNeditable, False,
XmNwordWrap, True,
XmNcursorPositionVisible, False,
XmNscrollHorizontal, False,
NULL);
position=0;
CreatePushButtonRow(form, buttons, XtNumber(buttons));
XtManageChild(text);
XtManageChild(form);
XtManageChild(board);
}
void infoFormExit(Widget button, caddr_t dummy, caddr_t call_data)
{
text=NULL;
XtDestroyWidget(dialog);
}
void infoSetText(char *str)
{
if (text == NULL) infoForm();
XmTextInsert(text, position, str);
position+=strlen(str);
}
|