[LWN Logo]

From: "Joseph H. Buehler" <jhpb@sarto.gaithersburg.md.us>
Subject: Wcl-2.7.3 uploaded for X11::Wcl
Date: 27 Apr 1998 15:27:10 GMT

I just uploaded Wcl-2.7.3 to PAUSE.  Compared to Wcl-2.7.2,
this version has been ported to RedHat 5.0 linux and swim motif
2.1.  I also tested it under AIX 3.2.5, AIX 4.2 and HPUX 10, so
I don't think I broke anything compared to 2.7.2.

Wcl-2.7.3 is a library for generating GUI interfaces based on widgets
that use Xt.  It allows widget trees and callbacks to be specified using
X resource files.

The X11::Wcl module provides access to the library from PERL, allowing
rapid generation of GUI interfaces using Xt toolkits such as Motif.
A trivial example supplied with the X11::Wcl tar.gz is attached.

Joe Buehler

#!/usr/bin/perl
#
# This is a simple demo of a Motif PushButton widget.
# It does not require Motif 2.0.
#

use X11::Wcl;

X11::Wcl::mainloop(
    ARGV => ["XmPushButton", "-trrf"],
    DELETE => \&delete_window,
    EDITRES_SUPPORT => 1,
    INITIAL_RESOURCES => \*DATA,
    CALLBACKS => [
        ["buttonCB", \&buttonCB, "argument object"],
    ],
    STARTUP => \&startup,
    NEED_MOTIF => 1,
);

# called when window manager is used to close application
sub delete_window
{
    print "closed by window manager\n";
}

# exit button was pressed
#
# $widget is the invoking widget, of type Widget
# $arg1 is the argument string appearing in the resource that caused
#     this callback to be invoked
# $arg2 is the callback struct; it must be cast into the proper type
#     using the proper constructor
# $arg3 is the argument from callback registration time; it is
#     whatever PERL object was passed to X11::Wcl::WcRegisterCallback()
sub buttonCB
{
    my($widget, $arg1, $arg2, $arg3) = @_;

    print "exit button pressed\n";
    exit(0);
}

# for application-specific startup actions
sub startup
{
    my($toplevel, $app_context) = @_;

    print "startup($toplevel, $app_context)\n";
}

__END__

MAIN
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
XmPushButton.wcChildren: form

! constants
*wclVerboseWarnings:            True
!*wcPostCreateDumpResources:    True
!*wcPreCreateDumpResources:     True
!*wcTrace:                      True
*background:                    light gray
*foreground:                    black
*FontList:                     
-*-courier-bold-r-*-*-*-140-100-100-*-*-*-*

*form.WcCreate:                 XmForm
*form.WcChildren:               button
!*form.width:                   500
!*form.height:                  500
*form.fractionBase:             1000
!*form.wcAfterChildren:         WcPrintTree(*form)

*button.WcCreate: XmPushButton
*button.labelString: EXIT
*button.activateCallback:   buttonCB()
*button.topAttachment:      ATTACH_FORM
*button.leftAttachment:     ATTACH_FORM