home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
rtl
/
bp7lib
/
winlib.doc
< prev
next >
Wrap
Text File
|
1993-04-15
|
6KB
|
130 lines
unit winlib;
interface
type winptr=^winrec;
winrec=record
x1,y1,x2,y2, { ul & lr corners }
wintype, { developer defined - # indicates what kind of
win for drawing, running, opening, closing,
etc. }
zoom, { 0=normal, 1=iconified, 2=full screen }
wincol,scrollcol,btncol,btntxt,titletxt,titlebak, { colors }
scrollrate, { scroll rate for scroll bars }
ox1,oy1,ox2,oy2, { saves corners @ zoom=0 for return to zoom=0
from zoom=1 or zoom=2 }
ix,iy:integer; { UL corner for zoom=1 }
width,height, { width & height of contents (for scaling
scrollbars) }
xoff,yoff:longint; { offsets of contents }
title:string;
next:winptr; { points to next win in linked list of wins }
data:pointer; { developer defined. use typecasting to treat
this as a pointer to a dynamically
allocated data structure which is specific
to the wintype. In this manner you may tack
wintype specific data onto a generic window
record. Allocating, deallocating, loading,
saving, and initializing wintype specific
data is not handled by winlib. }
redraw:boolean; { used when redrawing windows }
end;
winproc=procedure(var p:winptr); { developer defined procedure for running
or drawing windows }
winfile=file of winrec;
{############################# generial routines ###########################}
procedure raisewin(var p,wins:winptr);
{ raises window p to top of window list wins }
function runwin(var p,wins:winptr; bakcolor,style:integer;
drawcon,runcon:winproc; dosound:boolean):boolean;
{ p is win to run, wins is winlist. returns true if selected close }
procedure openwin(var p:winptr; r:winrec);
{ p is winlist, inserts at front }
procedure closewin(var p:winptr; p2:winptr);
{ p is winlist, p2 is window to close}
procedure savewins(var wins:winptr; s:string);
{ saves windows in list wins to file s }
procedure loadwins(var wins:winptr; s:string);
{ loads windows from file s into list wins }
function numwins(wins:winptr):integer;
{ returns # of windows in list wins }
function is_covered(i,wins:winptr):boolean;
{ true if win i is covered in whole or part by any window in winlist wins }
{############################# mouse routines #############################}
function inwin(p:winptr):boolean;
{ returns TRUE if mouse is currently located within window p }
function wmx(p:winptr):integer; { returns mousex in win p virt coords }
function wmy(p:winptr):integer; { returns mousey in win p virt coords }
{############################## drawing routines ##########################}
procedure drawwin(p:winptr); { p is win to draw }
procedure winport(p:winptr); { sets viewport to window p. }
procedure drawwins(wins:winptr; bak,fill:integer; drawcon:winproc);
{ redraws entire screen including all windows and their contents. bak
is background color. fill is background fillstyle. drawcon is a
developer defined procedure that draws the contents of a window based
on its window type. }
procedure saywin(x,y,color,font,size,orientation,hjustify,vjustify,multx,
divx,multy,divy:integer; s:string; p:winptr);
{ saygraf3d in win p, handles scroll offsets, x & y in win coords,
assumes winport(p) is on already }
procedure winpanel(x1,y1,x2,y2,width,color:integer; pressed:boolean;
p:winptr);
{ panel in win p, handles scroll offsets, x1,y1,x2,y2 in win
coords, assumes winport(p) is on already }
procedure winfill(x1,y1,x2,y2,color,fillstyle:integer; p:winptr);
{ does fill in window p. assumes winport(p) is on already }
procedure winline(x1,y1,x2,y2,color,style,thickness:integer; p:winptr);
{ does line in window p. assumes winport(p) is on already }
procedure winpie(x,y,sa,ea,r,fore,bak,style:integer; p:winptr);
{ does grafpie in win p. assumes winport on }
procedure zoomwin(var p,wins:winptr; drawcon:winproc; bakcolor,style:integer);
{ zooms window p in list wins full size. drawcon is developer
defined draw win contents procedure. bakcolor and style are for
the background }
procedure doiconify(p:winptr; var wins:winptr; bakcolor,style:integer; drawcon:winproc);
{ iconifies window p. all parameters are as in zoomwin. }
procedure winbtn(x,y,fore,bak:integer; s:string; pressed:boolean; p:winptr);
{ does a btn in window p. assumes winport on. }
procedure winbtn2(x,y,fore,bak:integer; s:string; pressed:boolean; p:winptr);
{ does a btn2 in window p. assumes winport on. }
procedure presswinbtn(x,y,fore,bak:integer; s:string; doclick:boolean; p:winptr);
{ turns on winport, does a pressbtn in window p. turns off winport. }
procedure presswinbtn2(x,y,fore,bak:integer; s:string; doclick:boolean; p:winptr);
{ as presswinbtn but for btn2's }
implementation