(* Copyright (C) 1989, 1990 Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* File: xhw.i3 *) (* Last modified on Thu Apr 12 00:11:21 1990 by muller *) (* modified on Mon Feb 12 10:08:53 1990 by jerome *) (*==============================================================*) (* The X11 R4 Interface for Modula 3 *) (* *) (* The Athena Widgets Set Example (re)coded in Modula3 *) (*==============================================================*) (* * This an example of how "Hello, World" could be written using * The X Toolkit and the Athena widget set. * * November 14, 1989 - Chris D. Peterson *) (* * $XConsortium: xhw.c,v 1.7 89/12/11 15:31:33 kit Exp $ * * Copyright 1989 Massachusetts Institute of Technology * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) MODULE xhw EXPORTS Main; FROM M3toC IMPORT TtoS, argc, argv; IMPORT Xt, Xaw; VAR fb_res := NEW (Xt.FallbackResList); app_con: Xt.AppContext; root: Xt.Widget; BEGIN (* * These resources will only get loaded if there is no app-defaults * file for this application. Since this is such a simple application * I am just loading the resources here. For more complex applications * It is best to install an app-defaults file. *) fb_res[0] := TtoS ("*Label.Label: Hello, World"); fb_res[1] := NIL; (* * Initialize the Toolkit, set the fallback resources, and get * the application context associated with this application. *) root := Xt.AppInitialize (app_con, TtoS ("Xhw"), NIL, 0, argc, argv, fb_res); (* * Create a Widget to display the string. The label is picked up * from the resource database. *) EVAL Xt.CreateManagedWidget (TtoS ("label"), Xaw.labelWidgetClass, root); (* * Create the windows, and set their attributes according * to the Widget data. *) Xt.RealizeWidget(root); (* * Now process the events. *) Xt.AppMainLoop(app_con); END xhw.