Article View: comp.windows.misc
Article #969Re: Window Toolkits and Systems for a bunch of systems.
From: Freek Wiedijk
Date: Fri, 22 Jul 1988 11:15
Date: Fri, 22 Jul 1988 11:15
214 lines
7923 bytes
7923 bytes
In article <732@muddcs.Claremont.EDU> lam@muddcs.Claremont.EDU (Grace Lam) writes:
>Are there any graphics toolkits around that can help? For example a
>drawing and widget toolkit that provides a common interface to a variety
>of window systems, so I only have to write graphics code ONCE.
>
> Ken Nelson
At the Centre for Mathematics and Computer Science (CWI) here in Holland, Guido
van Rossum has made exactly what you describe here. It is called STDWIN, and it
is intended to be an analogon to STDIO for windowing.
The describing report is:
Guido van Rossum, STDWIN - A Standard Window Interface. Centre for Mathematics
and Computer Science, Report CS-R8817. Amsterdam, 1988.
Abstract:
STDWIN is an interface layer placed between an application written in C and
arbitrary window system, making the use of windows both easier and more
portable. For applications using STDWIN for their window management
requirements, adaptation to a different window system is as easy as linking
with an appropriate version of the STDWIN library. So far, STDWIN libraries are
available for the Apple Macintosh, for the Whitechapel MG-1 (running Oriel),
for MIT's X Window System version 11, for the Atari ST, and (subsets) for
alphanumeric terminals on UNIX and MS-DOS. New implementations are easily
written.
Like STDIO, C's Standard I/O library, STDWIN's aim is to give a simple
interface, high-level functionality, and portablility. It does not attempt to
allow access to all possible features of window management systems; rather, it
provides the programmer with a model wich allows easy construction of that part
of the program which is concerned with window management.
STDWIN's high-level operations include automatic window positioning and
resizing, scrolling, menus, keyboard shortcuts, and multiple-click detection.
If you want to learn more about STDWIN I suggest you should try to contact the
author. His e-mail address is
guido@cwi.nl or
mcvax!guido
The address of the CWI is:
Centre for Mathematics and Computer Science
P.O. Box 4079
1009 AB Amsterdam
The Netherlands
I've appended the file stdwin.h, to give you an impression of the interface.
Greetings, Freek.
--
Freek Wiedijk <the pistol major> UUCP: uunet!mcvax!uva!freek
#P:+/ = #+/P?*+/ = i<<*+/P?*+/ = +/i<<**P?*+/ = +/(i<<*P?)*+/ = +/+/(i<<*P?)**
------------------------ This is the file stdwin.h ---------------------------
/* GENERIC STDWIN -- INTERFACE HEADER FILE. */
#ifndef GENERIC_STDWIN
#define GENERIC_STDWIN
/* So this header file is skipped if included twice */
#define CURSOR_CARET
/* Defined so textedit will always set the caret at the start of
the focus -- useful only for ASCII terminals. */
#ifndef ARGS
#define ARGS(x) () /* replace by x for ANSI C */
#endif
#ifndef NOARGS
#define NOARGS () /* replace by (void) for ANSI C */
#endif
#ifndef bool
#define bool int
#endif
void winit NOARGS;
void winitnew ARGS((int *pargc, char ***pargv));
void wdone NOARGS;
void wgetscrsize ARGS((int *pwidth, int *pheight));
void wgetscrmm ARGS((int *pmmwidth, int *pmmheight));
void wsetmaxwinsize ARGS((int width, int height));
void wsetdefwinsize ARGS((int width, int height));
void wsetdefwinpos ARGS((int h, int v));
#define MENU struct menu
/* The contents of a text attributes struct are disclosed here because
the interface allows the programmer to declare objects of this type.
(I'm not so sure anymore that this is the right thing to do!) */
struct textattr {
short font;
unsigned char size;
unsigned char style;
};
#define TEXTATTR struct textattr
#ifndef WINDOW
struct window {
short tag;
};
#define WINDOW struct window
#endif
WINDOW *wopen ARGS((char *title,
void (*drawproc)(/*WINDOW *win,
int left, int top, int right, int bottom*/)));
void wclose ARGS((WINDOW *win));
#define wgettag(win) ((win)->tag)
#define wsettag(win, newtag) ((win)->tag= newtag)
void wsetactive ARGS((WINDOW *win));
WINDOW *wgetactive NOARGS;
void wgetwinsize ARGS((WINDOW *win, int *width, int *height));
void wsetdocsize ARGS((WINDOW *win, int width, int height));
void wsettitle ARGS((WINDOW *win, char *title));
void wsetorigin ARGS((WINDOW *win, int h, int v));
void wshow ARGS((WINDOW *win, int left, int top, int right, int bottom));
void wchange ARGS((WINDOW *win, int left, int top, int right, int bottom));
void wscroll ARGS((WINDOW *win, int left, int top, int right, int bottom,
int dh, int dv));
void wfleep NOARGS;
void wmessage ARGS((char *str));
void wperror ARGS((char *name));
bool waskstr ARGS((char *prompt, char *buf, int buflen));
int waskync ARGS((char *question, int dflt));
bool waskfile ARGS((char *prompt, char *buf, int buflen, bool newfile));
void wsetcaret ARGS((WINDOW *win, int h, int v));
void wnocaret ARGS((WINDOW *win));
void wsettimer ARGS((WINDOW *win, int deciseconds));
MENU *wmenucreate ARGS((int id, char *title));
void wmenudelete ARGS((MENU *mp));
int wmenuadditem ARGS((MENU *mp, char *text, int shortcut));
void wmenusetitem ARGS((MENU *mp, int i, char *text));
void wmenusetdeflocal ARGS((bool local));
void wmenuattach ARGS((WINDOW *win, MENU *mp));
void wmenudetach ARGS((WINDOW *win, MENU *mp));
void wmenuenable ARGS((MENU *mp, int item, int flag));
void wmenucheck ARGS((MENU *mp, int item, int flag));
/* The following is only available in termcap stdwin: */
void wsetshortcut ARGS((int id, int item, char *keys));
#include "stdevent.h"
void wgetevent ARGS((EVENT *ep));
void wungetevent ARGS((EVENT *ep));
void wupdate ARGS((WINDOW *win));
void wbegindrawing ARGS((WINDOW *win));
void wenddrawing ARGS((WINDOW *win));
void wflush NOARGS;
void wdrawline ARGS((int h1, int v1, int h2, int v2));
void wxorline ARGS((int h1, int v1, int h2, int v2));
void wdrawcircle ARGS((int h, int v, int radius));
void wdrawelarc ARGS((int h, int v, int hrad, int vrad, int ang1, int ang2));
void wdrawbox ARGS((int left, int top, int right, int bottom));
void werase ARGS((int left, int top, int right, int bottom));
void wpaint ARGS((int left, int top, int right, int bottom));
void winvert ARGS((int left, int top, int right, int bottom));
void wshade ARGS((int left, int top, int right, int bottom, int percent));
int wdrawtext ARGS((int h, int v, char *str, int len));
int wdrawchar ARGS((int h, int v, int c));
int wlineheight NOARGS;
int wbaseline NOARGS;
int wtextwidth ARGS((char *str, int len));
int wcharwidth ARGS((int c));
int wtextbreak ARGS((char *str, int len, int width));
void wgettextattr ARGS((TEXTATTR *attr));
void wsettextattr ARGS((TEXTATTR *attr));
void wgetwintextattr ARGS((WINDOW *win, TEXTATTR *attr));
void wsetwintextattr ARGS((WINDOW *win, TEXTATTR *attr));
void wsetplain NOARGS;
void wsethilite NOARGS;
void wsetinverse NOARGS;
void wsetitalic NOARGS;
void wsetbold NOARGS;
void wsetbolditalic NOARGS;
void wsetunderline NOARGS;
void wsetfont ARGS((char *fontname));
void wsetsize ARGS((int pointsize));
#include "stdtext.h"
#endif /* GENERIC_STDWIN */
----------------------- This was the file stdwin.h --------------------------
--
Freek Wiedijk <the pistol major> UUCP: uunet!mcvax!uva!freek
#P:+/ = #+/P?*+/ = i<<*+/P?*+/ = +/i<<**P?*+/ = +/(i<<*P?)*+/ = +/+/(i<<*P?)**
Technical Details
Message-ID:
<356@uva.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!uva!freekReferences:
<732@muddcs.Claremont.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!uva!freek From: freek@uva.UUCP (Freek Wiedijk) Newsgroups: comp.windows.misc,comp.graphics Subject: Re: Window Toolkits and Systems for a bunch of systems. Keywords: Window Toolkits, Window Systems, Portability Message-ID: <356@uva.UUCP> Date: 22 Jul 88 11:15:00 GMT References: <732@muddcs.Claremont.EDU> Reply-To: freek@uva.UUCP (Freek Wiedijk) Organization: Faculteit Wiskunde & Informatica, Universiteit van Amsterdam Lines: 214