home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
motifpg2.zip
/
ch02
/
xsetstring.c
< prev
Wrap
C/C++ Source or Header
|
1992-07-08
|
2KB
|
76 lines
/*
* Copyright 1989, 1992 O'Reilly and Associates, Inc.
* See ../Copyright for complete rights and liability information.
*/
/*
* xsetstring.c - simple program to put up a banner on the display
* Demonstrates setting a compound string.
*/
/*
* Header files required for all Toolkit programs
*/
#include <X11/Intrinsic.h> /* Intrinsics definitions */
#include <Xm/Xm.h> /* Standard Motif definitions */
/*
* Public header file for widgets we actually use in this file.
*/
#include <Xm/PushB.h> /* Motif PushButton Widget */
main(argc, argv)
int argc;
char **argv;
{
XtAppContext app_context;
Widget topLevel;
Widget hello;
static String greeting = "Hello, World!";
XmString text;
/*
* Register the default language procedure
*/
XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
topLevel = XtVaAppInitialize(
&app_context, /* Application context */
"XHello", /* Application class */
NULL, 0, /* command line option list */
&argc, argv, /* command line args */
NULL, /* for missing app-defaults file */
NULL); /* terminate varargs list */
/* text = XmStringCreateLtoR("Hello World", XmFONTLIST_DEFAULT_TAG); */
/* text = XmStringCreateLocalized("Hello World"); */
hello = XtVaCreateManagedWidget(
"hello", /* arbitrary widget name */
xmPushButtonWidgetClass, /* widget class from PushButton.h */
topLevel, /* parent widget */
XtVaTypedArg, XmNlabelString, XmRString,
greeting, strlen(greeting)+1,
/* XmNlabelString, text, */
XmNalignment, XmALIGNMENT_END,
NULL); /* terminate varargs list */
/* XmStringFree(text); */
/*
* Create windows for widgets and map them.
*/
XtRealizeWidget(topLevel);
/*
* Loop for events.
*/
XtAppMainLoop(app_context);
}