home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ober1096.zip
/
libsrc
/
Xlib.def
< prev
next >
Wrap
Text File
|
1995-04-04
|
12KB
|
388 lines
INTERFACE DEFINITION MODULE Xlib;
(* Modula definition of Xlib library facilities defined in Xlib.h
Revision record:
Nov 89 John Hynd Original minimal version
19 Sep 90 John Hynd Add GC display functions
*)
IMPORT IMPLEMENTATION FROM "-lX11";
FROM Xglobal IMPORT int, long, unsigned, unsignedInt, unsignedLong,
unsignedShort, Bool;
FROM SYSTEM IMPORT BYTE, ADDRESS;
CONST
AllocNone = 0;
AllocAll = 1;
Fail = 0;
Success = 1; (* Good Status - Xlib.h says 0!? *)
None = 0;
many = 100; (* for pointers to 'open' arrays *)
(* Input event masks *)
ExposureMask = 8000H;
PointerMotionMask = 0040H;
ButtonPressMask = 0004H;
KeyPressMask = 0001H;
(* Event names *)
KeyPress = 2;
ButtonPress = 4;
MotionNotify = 6;
Expose = 12;
(* Visual attribute masks *)
VisualNoMask = 0000H;
VisualIDMask = 0001H;
VisualScreenMask = 0002H;
VisualDepthMask = 0004H;
(* ... *)
VisualAllMask = 01FFH;
QueuedAlready = 0;
QueuedAfterReading = 1;
QueuedAfterFlush = 2;
(* Point draw modes *)
CoordModeOrigin = 0; (* relative to origin - absolute! *)
CoordModePrevious = 1; (* relative to previous point
- first is absolute *)
(* Polygon fill shapes *)
Complex = 0; (* paths may intersect *)
Nonconvex = 1; (* no paths intersect, but not convex *)
Convex = 2; (* wholly convex *)
(* GC display functions *)
GXclear = 0;
(* ... *)
GXcopy = 3;
(* ... *)
GXxor = 6;
(* ... *)
GXset = 15;
TYPE
Status = int;
XID = unsignedLong;
Undefined = INTEGER;
XComposeStatus = Undefined;
Display = BYTE;
DisplayPtr = POINTER TO Display;
Window = XID;
GC = POINTER TO BYTE;
XGCValuesPtr = POINTER TO BYTE;
Drawable = XID;
Font = XID;
KeySym = XID;
Time = unsignedLong;
(* Event descriptors *)
XKeyEvent = RECORD
type : int;
serial : unsignedLong;
sendEvent : Bool;
display : DisplayPtr;
window,
root,
subwindow : Window;
time : Time;
x, y : int;
xRoot, yRoot : int;
state,
keycode: unsignedInt;
sameScreen : Bool;
END;
XButtonEvent = RECORD
type : int;
serial : unsignedLong;
sendEvent : Bool;
display : DisplayPtr;
window,
root,
subwindow : Window;
time : Time;
x, y : int;
xRoot, yRoot : int;
state,
button: unsignedInt;
sameScreen : Bool;
END;
XExposeEvent = RECORD
type : int;
serial : unsignedLong;
sendEvent : Bool;
display : DisplayPtr;
window : Window;
x, y : int;
width, height : int;
count : int;
END;
XEvent = RECORD CASE : CARDINAL OF (* C union *)
| 0 : type : int;
| 2 : xkey : XKeyEvent;
| 3 : xbutton : XButtonEvent;
| 7 : xexpose : XExposeEvent;
| 32 : pad : ARRAY [0..23] OF long;
END;
END;
VisualPtr = POINTER TO VisualInfo;
VisualID = unsignedLong; (* XID! *)
VisualInfo = RECORD
visual : VisualPtr;
visualid : VisualID;
screen : int;
depth : unsignedInt;
class : int;
redMask, greenMask, blueMask : unsignedLong;
colormapSize : int;
bitsPerRGB : int;
END;
VisualInfoPtr = POINTER TO ARRAY [0..many] OF VisualInfo;
Colormap = XID;
XColor = RECORD
pixel : unsignedLong;
red, green, blue : unsignedShort;
flags : CHAR;
pad : CHAR;
END;
XPoint = RECORD
x, y : int;
END;
PROCEDURE XAllocColorCells (display : DisplayPtr;
colorMap : Colormap;
contig : BOOLEAN;
VAR planemaskreturn : ARRAY OF long;
nplanes : INTEGER;
VAR pixelsreturn : ARRAY OF long;
npixels : INTEGER) : Status;
(* See man 3 XAllocColorCells *)
PROCEDURE XAllocColor (display : DisplayPtr; colorMap : Colormap;
VAR screenInOut : XColor)
: Status;
(* Allocate by RGB value a read-only colour cell for the screen associated
with the given colourmap, and return the closest colour supported by the
screen. *)
PROCEDURE XAllocNamedColor (display : DisplayPtr; colorMap : Colormap;
colourName : ARRAY OF CHAR; VAR screenDef, exactDef : XColor)
: Status;
(* Allocate by name a read-only colour cell for the screen associated with the
given colourmap, and return the exact database definition and the
closest colour supported by the screen. *)
PROCEDURE XOpenDisplay(displayName : ARRAY OF CHAR) : DisplayPtr;
(* Connect a client program to an X server *)
PROCEDURE XDefaultScreen(display : DisplayPtr) : int;
PROCEDURE XWhitePixel(display : DisplayPtr; screen : int) : unsignedLong;
PROCEDURE XBlackPixel(display : DisplayPtr; screen : int) : unsignedLong;
PROCEDURE XDisplayWidth(display : DisplayPtr; screen : int) : int;
PROCEDURE XDisplayHeight(display : DisplayPtr; screen : int) : int;
PROCEDURE XCreateSimpleWindow(display : DisplayPtr; parent : Window;
x, y : int; width, height, borderWidth : unsigned;
border, background : unsignedLong) : Window;
(* Create an unmapped InputOutput window *)
PROCEDURE XDefaultRootWindow(display : DisplayPtr) : Window;
PROCEDURE XStoreName(display : DisplayPtr; window : Window;
name : ARRAY OF CHAR);
(* Give the window manager a hint for the window name *)
PROCEDURE XCreateGC(display : DisplayPtr; drawable : Drawable;
valueMask : unsignedLong; values : XGCValuesPtr) : GC;
(* Create a new graphics context for a given screen with the depth of the
specified drawable.
The values parameter is a pointer so that NIL may be passed. *)
PROCEDURE XCreateColormap (display : DisplayPtr;
window : Window;
visual : VisualPtr;
alloc : INTEGER) : Colormap;
(* alloc is AllocAll or AllocNone *)
PROCEDURE XLoadFont(display : DisplayPtr; name : ARRAY OF CHAR) : Font;
(* Load a font if not already loaded; get font ID *)
PROCEDURE XSetForeground (display : DisplayPtr; gc : GC ;
foreground : unsignedLong);
(* Set the foreground pixel in a graphics context *)
PROCEDURE XSetFunction (display : DisplayPtr; gc : GC ; function : int);
(* Set the display function in a graphics context *)
PROCEDURE XSetFont (display : DisplayPtr; gc : GC ; font : Font);
(* Set the current font in a graphics context *)
PROCEDURE XSelectInput (display : DisplayPtr; w : Window;
eventMask : long);
(* Select events to be reported to client *)
PROCEDURE XNextEvent (display : DisplayPtr; VAR eventReturn : XEvent);
(* Get the next event and remove it from the queue *)
PROCEDURE XEventsQueued (display : DisplayPtr; mode : int) : int;
(* Return the number of events queued, by mode:
QueuedAlready, QueuedAfterFlush or QueuedAfterReading *)
PROCEDURE XPending (display : DisplayPtr) : int;
(* Return the number of pending requests (same as XEventsQueued
with the QueuedAfterFlush mode) *)
PROCEDURE XCheckTypedEvent (display : DisplayPtr; eventType : int;
VAR eventReturn : XEvent) : BOOLEAN;
(* Get the next event of the specified type and remove it from the queue *)
PROCEDURE XMapRaised (display : DisplayPtr; w : Window);
(* Map a window on top of its siblings *)
PROCEDURE XMapWindow (display : DisplayPtr; w : Window);
(* Map a window on top? of its siblings *)
PROCEDURE XClearWindow (display : DisplayPtr; w : Window);
(* Clears the window *)
PROCEDURE XDrawPoint (display : DisplayPtr; d : Drawable; gc : GC;
x, y : int);
(* Draw a point at (x,y) on the drawable d with graphics context gc *)
PROCEDURE XDrawPoints (display : DisplayPtr; d : Drawable; gc : GC;
VAR points : ARRAY OF XPoint; nPoints, mode : int);
(* Draw a point at (x,y) on the drawable d with graphics context gc *)
PROCEDURE XDrawLine (display : DisplayPtr; d : Drawable; gc : GC;
x1, y1, x2, y2 : int);
(* Draw a line from (x1,y1) to (x2,y2) on the drawable d with graphics
context gc *)
PROCEDURE XDrawLines (display : DisplayPtr; d : Drawable; gc : GC;
VAR points : ARRAY OF XPoint; nPoints, mode : int);
(* Draw (nPoints-1) connected lines (i.e., a polyline) on the drawable d
with graphics context gc. Endpoints are joined correctly. *)
(* To come : XDrawSegments *)
PROCEDURE XDrawRectangle (display : DisplayPtr; d : Drawable; gc : GC;
x, y : INTEGER; width, height : unsigned);
(* Draw a rectangle with upper left corner (x,y), and given width and
height on drawable d *)
(* To come : XDrawRectangles *)
PROCEDURE XDrawArc (display : DisplayPtr; d : Drawable; gc : GC;
x, y : int; width, height : unsignedInt; angle1, angle2 : int);
(* Draw a circular or elliptical arc with bounding rectangle top left at (x,y),
width and height, from angle1 to angle2 (positive counterclockwise,
limited to 360 degrees). *)
(* To come : XDrawArcs *)
PROCEDURE XFillRectangle (display : DisplayPtr; d : Drawable; gc : GC;
x, y : INTEGER; width, height : unsigned);
(* Draw a filled rectangle with upper left corner (x,y), and given width and
height on drawable d *)
(* To come : XFillRectangles *)
PROCEDURE XFillPolygon (display : DisplayPtr; d : Drawable; gc : GC;
VAR points : ARRAY OF XPoint; nPoints, shape, mode : int);
(* Fill the region closed by the specified path (closed if necessary).
Shape specifies convexity; mode is absolute / relative. *)
PROCEDURE XFillArc (display : DisplayPtr; d : Drawable; gc : GC;
x, y : int; width, height : unsignedInt; angle1, angle2 : int);
(* Fill a circular or elliptical arc with bounding rectangle top left at (x,y),
width and height, from angle1 to angle2 (positive counterclockwise,
limited to 360 degrees). *)
(* To come : XFillArcs *)
PROCEDURE XDrawString (display : DisplayPtr; d : Drawable; gc : GC;
x, y : int; string : ARRAY OF CHAR; length : int);
(* Draw a string at (x,y) on drawable d, foreground only *)
PROCEDURE XDrawImageString (display : DisplayPtr; d : Drawable; gc : GC;
x, y : int; string : ARRAY OF CHAR; length : int);
(* Draw an image string at (x,y) on drawable d *)
PROCEDURE XDefaultGC(display : DisplayPtr; screenNumber : INTEGER) : GC;
(* Return the default graphics context *)
PROCEDURE XWarpPointer (display : DisplayPtr; srcW, dstW : Window;
srcX, srcY : int; srcWidth, srcHeight : unsignedInt;
destX, destY : int);
(* Move the pointer suddenly to another point on the screen *)
PROCEDURE XLookupString(VAR event : XEvent; buffer : ARRAY OF CHAR;
numBytes : int; VAR keysym : KeySym; status : XComposeStatus) : int;
(* Map a key event to an ASCII string, keysym and ComposeStatus;
return length of trnaslated string *)
PROCEDURE XQueryPointer(display : DisplayPtr; w : Window;
VAR root, child : Window; VAR rootX, rootY, winX, winY : int;
VAR buttons : unsignedInt) : Bool;
(* Get the current pointer location *)
PROCEDURE XDisplayPlanes (display : DisplayPtr; screen : int) : int;
(* Return the depth of the root window *)
PROCEDURE XDefaultVisual (display : DisplayPtr; screen : int) : VisualPtr;
(* Return the default visual type of the screen *)
PROCEDURE XGetVisualInfo (display : DisplayPtr; vinfoMask : long;
VAR vinfoTemplate : VisualInfo; VAR nitemsReturn : int) : VisualInfoPtr;
(* Return a list of visuals which match the attributes in the template
selected by the mask. *)
PROCEDURE XFree (data : ADDRESS);
(* Free in-memory data created by some X function. *)
PROCEDURE XDefaultColormap (display : DisplayPtr; screen : int) : Colormap;
(* Return the default colour map for allocation on the screen *)
PROCEDURE XStoreColor (display : DisplayPtr;
colormap : Colormap;
color : XColor);
(* Sets the pixel colour as defined in the XColor record *)
PROCEDURE XCopyColormapAndFree (display : DisplayPtr;
colormap : Colormap) : Colormap;
(* copies the colour map *)
PROCEDURE XInstallColormap (display : DisplayPtr; colormap : Colormap);
PROCEDURE XQueryColor (display : DisplayPtr; colourmap : Colormap;
VAR colour : XColor);
(* Get the RGB values for colour.pixel. *)
PROCEDURE XFlush (display : DisplayPtr);
(* Flush the output buffer (display all queued requests) *)
PROCEDURE XDestroyWindow (display : DisplayPtr; w : Window);
(* Destroy w and all its subwindows *)
PROCEDURE XCloseDisplay (display : DisplayPtr);
(* Close connection to X server, destroying all windows, resources, etc *)
END Xlib.