home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
master12.zip
/
mastering
/
tiling.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-27
|
2KB
|
80 lines
#include <Xm/ToggleB.h>
#include <Xm/BulletinB.h>
Widget toplevel;
static XtArgVal GetPixel(colorstr)
char *colorstr;
{
XrmValue from, to;
from.size = strlen(colorstr) +1;
if (from.size < sizeof(String)) from.size = sizeof(String);
from.addr = colorstr;
to.addr = NULL;
XtConvert(toplevel, XmRString, &from, XmRPixel, &to);
return ((XtArgVal) *((XtArgVal *) to.addr));
}
/***********************************************************************
*** MAIN ***
***********************************************************************/
void main(argc, argv)
unsigned int argc;
char **argv;
{
Widget bboard, tbutton;
Arg args[10];
int n;
char *text = "Push Me";
XmString label_text;
Pixel foregnd, backgnd;
XtAppContext app_context;
/*
* Initialize the toplevel shell widget
*/
toplevel = XtAppInitialize(&app_context, "Tiling", NULL, 0, &argc, argv,
NULL, args, 0);
/*
* Create the bulletin board widget
*/
foregnd = GetPixel ("light blue");
backgnd = GetPixel ("sky blue");
n = 0;
XtSetArg(args[n], XmNbackgroundPixmap, XmGetPixmap(XtScreen
(toplevel),"slant_right", foregnd, backgnd)); n++;
bboard = XmCreateBulletinBoard (toplevel, "bboard", args, n);
XtManageChild(bboard);
/*
* Set up compound string
*/
label_text = XmStringCreateLtoR(text, XmFONTLIST_DEFAULT_TAG);
/*
* Create the pushbutton.
*/
foregnd = GetPixel ("light blue");
backgnd = GetPixel ("sky blue");
n = 0;
XtSetArg(args[n], XmNbackgroundPixmap, XmGetPixmap(XtScreen
(toplevel),"vertical", foregnd, backgnd)); n++;
XtSetArg(args[n], XmNlabelString, label_text); n++;
tbutton = XmCreateToggleButton(bboard, "tbutton", args, n);
XtManageChild(tbutton);
XmStringFree (label_text);
/*
* Realize the toplevel widget, which displays all children
*/
XtRealizeWidget(toplevel);
/*
* Go into a loop and wait for input
*/
XtAppMainLoop(app_context);
}