| module helloworld
version = 'v1.0'
names = case_sensitive
include file '/usr/include/X11/DECwDwtApplProg.uil';
procedure
helloworld_button_activate();
object
helloworld_main : main_window {
arguments {
accept_focus = true;
height=150;
width=150;
};
controls {
scale helloworld_scale;
};
};
object
helloworld_scale : scale {
arguments {
x = 25;
y = 25;
! sensitive = false;
};
};
end module;
cut here
==============================================================
#include <stdio.h>
#include <X11/DECwDwtApplProg.h>
#include <X11/Vendor.h>
#include <X11/Intrinsic.h>
static DRMHierarchy s_DRMHierarchy; /* DRM database hierarch id */
static char *vec[]={"scale.uid"};
/* DRM database file list */
static void helloworld_button_activate();
static DRMCode class ;
static DRMCount regnum = 1 ;
static DRMRegisterArg regvec[] = {
{"helloworld_button_activate",(caddr_t)helloworld_button_activate}
};
Display *display; /* display pointer */
Widget toplevel, helloworldmain,helloworlddialog,helloworldbutton;
/*
* Main program
*/
int main(argc, argv)
unsigned int argc;
char **argv;
{
Arg arglist[10] ;
int n = 0;
if (! (display = XOpenDisplay(NULL)))
{
fprintf (stderr, "Can't open display\n");
}
/* create menu window */
DwtInitializeDRM ();
toplevel = XtInitialize(
"Hi", /* application name */
"helloworldclass", /* application class */
NULL, 0, /* options */
&argc, argv); /* command line parameters */
if (DwtOpenHierarchy (1, /* number of files */
vec, /* files */
NULL, /* os_ext_list (null) */
&s_DRMHierarchy) /* ptr to returned id */
!= DRMSuccess) {
printf ("can't open hierarchy");
}
DwtRegisterDRMNames (regvec, regnum) ;
if (DwtFetchWidget (s_DRMHierarchy,
"helloworld_main",
toplevel,
&helloworldmain,
&class)
!= DRMSuccess)
printf("can't fetch interface");
XtSetArg (arglist[n], DwtNx, 50) ; n++;
XtSetArg (arglist[n], DwtNy, 50) ; n++;
/* XtSetArg (arglist[n], DwtNsensitive, True) ; n++; */
XtSetValues (toplevel, arglist, n) ;
n=0;
helloworlddialog=XtNameToWidget(helloworldmain,
"helloworld_main.helloworld_scale");
XtSetArg (arglist[n], DwtNsensitive, True) ; n++;
XtSetValues (helloworlddialog, arglist, n) ;
XtManageChild(helloworldmain);
XtRealizeWidget(toplevel);
/* Get the widget id's to install the accelerator */
XtMainLoop();
return (0);
}
static void helloworld_button_activate( widget, tag, callback_data )
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
Arg arglist[2];
static int call_count = 0;
String call_name = "regvec";
call_count += 1 ;
switch ( call_count )
{
case 1:
XtSetArg( arglist[0], DwtNlabel,
DwtLatin1String("Goodbye\nWorld!") );
XtSetArg( arglist[1], DwtNx, 11 );
XtSetValues( widget, arglist, 2 );
break ;
case 2:
break ;
case 3:
exit(1);
break;
}
}
|