This is gui_utils.c in view mode; [Download] [Up]
/* $Id: gui_utils.c,v 2.5 1993/05/28 22:15:01 klute Exp klute $ */
/*
* Copyright 1993 Rainer Klute <klute@irb.informatik.uni-dortmund.de>
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. The author makes no representations about the suitability
* of this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
#include <X11/cursorfont.h>
#include <Xm/Xm.h>
#include <Xm/MessageB.h>
#include <Xm/Label.h>
#include "gui_utils.h"
/*
* "LabelSetString" stellt einen C-String in einem XmLabel-Widget dar.
*/
void LabelSetString (Widget w, char *string)
{
XmString cs = XmStringCreate (string, XmFONTLIST_DEFAULT_TAG);
XtVaSetValues (w, XmNlabelString, cs, NULL);
XmStringFree (cs);
}
/*
* InformationDialog
*/
void InformationDialog (Widget w, char *title, char *msg)
{
static Widget dialog = (Widget) 0;
XmString message;
if (dialog == (Widget) 0)
{
dialog = XmCreateInformationDialog (w, "information", (Arg *) 0,
(Cardinal) 0);
XtVaSetValues (XtParent (dialog), XmNtitle, title, NULL);
XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON));
XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON));
}
if (*msg)
{
message = XmStringCreateSimple (msg);
XtVaSetValues (dialog, XmNmessageString, message, NULL);
XmStringFree (message);
XtManageChild (dialog);
XtPopup (XtParent (dialog), XtGrabNone);
}
else
XtPopdown (XtParent (dialog));
}
/*
* StringCat
*/
XmString StringCat (XmString s1, XmString s2)
{
XmString tmp = XmStringConcat (s1, s2);
XmStringFree (s1);
XmStringFree (s2);
return tmp;
}
/*
* SetBusyCursor
*/
void SetBusyCursor (Widget w)
{
Widget toplevel = TopLevelShell (w);
static Cursor busyCursor = (Cursor) 0;
if (busyCursor == (Cursor) 0)
busyCursor = XCreateFontCursor (XtDisplay (w), XC_watch);
XDefineCursor (XtDisplay (toplevel), XtWindow (toplevel), busyCursor);
XFlush (XtDisplay (toplevel));
}
/*
* UnsetBusyCursor
*/
void UnsetBusyCursor (Widget w)
{
Widget toplevel = TopLevelShell (w);
XUndefineCursor (XtDisplay (toplevel), XtWindow (toplevel));
}
/*
* "TopLevelShell" liefert das zum angegebenen Widget gehörende Shell-Widget.
*/
Widget TopLevelShell (Widget w)
{
while (w != (Widget) 0 && !XtIsShell (w))
w = XtParent (w);
return w;
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.