home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
motifpg2.zip
/
ch10
/
xpixmap.c
< prev
Wrap
C/C++ Source or Header
|
1992-07-09
|
2KB
|
94 lines
/*
* Copyright 1989, 1992 O'Reilly and Associates, Inc.
* See ../Copyright for complete rights and liability information.
*/
/*
* xpixmap.c - simple program to test invoking a converter directly
*/
#include <X11/IntrinsicP.h> /* temporary, until we find out how
* to register a type converter without
* referencing the core structure */
/*
* Include files required for all Toolkit programs
*/
#include <X11/Intrinsic.h> /* Intrinsics Definitions */
#include <X11/StringDefs.h> /* Standard Name-String definitions */
/*
* Public include file for widgets we actually use in this file.
*/
#include <Xm/Label.h> /* Motif Label Widget */
/*
* Include file for Xmu converters
*/
#include <X11/Xmu/Converters.h>
#define OURPIXMAPNAME "xlogo64"
main(argc, argv)
int argc;
char **argv;
{
XtAppContext app_context;
Widget topLevel, hello;
XrmValue from, to;
Pixmap pixmap;
void XmuCvtStringToBitmap();
Boolean success;
static XtConvertArgRec screenConvertArg[] = {
{
XtBaseOffset,
(XtPointer) XtOffset(Widget, core.screen),
sizeof(Screen *)
}
};
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 */
XtAppAddConverter(app_context, XmRString, XmRBitmap, XmuCvtStringToBitmap,
screenConvertArg, XtNumber(screenConvertArg));
from.addr = OURPIXMAPNAME;
from.size = strlen(OURPIXMAPNAME);
success = XtConvertAndStore(topLevel, XmRString, &from, XmRBitmap, &to);
if (!success)
exit(1);
pixmap = *(Pixmap *) to.addr;
hello = XtVaCreateManagedWidget(
"hello", /* arbitrary widget name */
xmLabelWidgetClass, /* widget class from Label.h */
topLevel, /* parent widget*/
XmNlabelType, XmPIXMAP,
XmNlabelPixmap, pixmap,
NULL);
/*
* Create windows for widgets and map them.
*/
XtRealizeWidget(topLevel);
/*
* Loop for events.
*/
XtAppMainLoop(app_context);
}