home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 9
/
CD_ASCQ_09_1193.iso
/
maj
/
4437
/
int
/
spx_gui.int
< prev
next >
Wrap
Text File
|
1993-09-21
|
10KB
|
220 lines
Unit spx_gui;
{$X+,O+ }
{ SPX Library Version 2.0 Copyright 1993 Scott D. Ramsay }
{ NOTE: Keystrokes does not work with keyboard interupt in spx_key enabled }
Interface
Uses crt,dos,spx_vga,spx_dos,spx_obj,spx_fnc,spx_txt,mouse;
const
id_button = 1; { button id numbers }
id_string = 2;
id_check = 3;
id_radio = 4;
id_scroll = 5;
id_pbox = 6;
{ system color index values }
sysc_black = 0; { black }
sysc_background = 1; { background }
sysc_medbkgnd = 2; { medium shade background }
sysc_darkbkgnd = 3; { dark shade background }
sysc_text = 4; { default text }
sysc_textshadow = 5; { default text shadow color }
sysc_highlite1 = 6; { highlight text 1 }
sysc_highlite2 = 7; { highlight text 2 }
mLeftButton = 1; { button action values for the MMASK variable }
mRightButton = 2;
mBothButtons = 3;
WinUpdate : boolean = true; { FALSE - don't update save back on offwin call }
DiskVerify : boolean = true; { TRUE - Check within diskdo if file exist or can overwrite }
type
Tattr = record
x,y,w,h : integer;
end;
Pbutton = ^Tbutton;
Pobjlist = ^Tobjlist;
itempos = (center,top,left,bottom,right);
vcolortypes = array[0..7] of byte;
wcolortypes = array[0..7] of rgbtype;
Tproc_a = procedure(p:pbutton);
Tproc_b = procedure(p:pbutton;on:boolean);
Tbutton = object(tobjs)
idnum : word;
tch : char;
mmask : byte;
attr : Tattr;
title : string;
titlex,titley : itempos;
tfunct,
visible,disabled : boolean;
cdraw,caction : Tproc_a;
cnear : Tproc_b;
root : Pobjlist;
res1 : pointer; { reserved for internal use }
msg : string;
constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string);
procedure drawitemobject;virtual;
procedure nearitemobject(on:boolean);virtual;
procedure actionitemobject;virtual;
procedure showpress;virtual;
procedure show(on:boolean);virtual;
function ncheckhit(hx,hy,ohx,ohy:integer;item:pobjlist):boolean;virtual;
destructor done;virtual;
end;
Pstring = ^Tstring;
Tstring = object(Tbutton)
esx,esy,epx,epy : integer;
objectx,objecty : itempos;
spaceok,upper,
numonly : boolean;
tlenmax : byte;
tstr : string;
constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t,t2:string;tmax:byte);
procedure drawitemobject;virtual;
procedure showpress;virtual;
procedure filename(px,py:integer;var fname:string);
end;
Pcheck = ^Tcheck;
Tcheck = object(Tstring)
tchk : boolean;
constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string;chk:boolean);
procedure drawitemobject;virtual;
procedure show(on:boolean);virtual;
procedure showpress;virtual;
procedure actionitemobject;virtual;
end;
Pradio = ^Tradio;
Tradio = object(Tcheck)
group : integer;
constructor init(x,y,w,h,idn,grp:integer;ch:char;fnc:boolean;t:string;chk:boolean);
procedure drawitemobject;virtual;
procedure show(on:boolean);virtual;
procedure showpress;virtual;
procedure actionitemobject;virtual;
end;
Pscroll = ^Tscroll;
Tscroll = object(Tbutton)
horz : boolean;
tx1,ty1,
tx2,ty2,
pvlu,siz,
bmin,bmax,
bpos,binc : integer;
constructor init(x,y,w,h,idn,min,max,bi,bp:integer;hz:boolean);
procedure showpress;virtual;
procedure drawitemobject;virtual;
procedure redrawscroll;
function porp(vlu,max,min,p1,p2,wd:integer):integer;
end;
Ppbox = ^Tpbox;
Tpbox = object(Tbutton)
objs : Pobjlist;
sh,st : plist;
lhstr : string;
lhdat : longint;
items : integer;
constructor init(x,y,w,i,idn:integer;t:string);
function ncheckhit(hx,hy,ohx,ohy:integer;item:Pobjlist):boolean;virtual;
procedure drawitemobject;virtual;
procedure additem(s:string;d:longint;draw:boolean);virtual;
function delitem(s:string;d:longint;draw:boolean):boolean;virtual;
function getcount:integer;virtual;
procedure show(on:boolean);virtual;
destructor done;virtual;
end;
Pkey_io = ^Tkey_io;
Tkey_io = object
funct : boolean; { TRUE - extended character }
ch : char; { character pressed }
constructor init(h:char;f:boolean);
procedure inkey; virtual;
function apress : boolean; virtual;
procedure clearbuffer; virtual;
destructor done; virtual;
end;
Pmouse_io = ^Tmouse_io;
Tmouse_io = object(Tkey_io)
mpx,mpy, { mouse position }
opx,opy, { mouse old position }
mop,lmop, { mouse button, old button }
lx,ly,x,y : integer; { mouse motion variables }
constructor init(h:char;f:boolean;sx,sy,m:integer);
procedure inkey; virtual;
function apress : boolean; virtual;
function mousepressed : boolean; virtual;
procedure clearbuffer; virtual;
destructor done; virtual;
end;
Tobjlist = object
head,tail : plist;
io : Pmouse_io;
focus : pbutton;
gmsg : string;
orange : pbutton;
constructor init;
procedure inkey;virtual;
procedure clearbuffer;virtual;
function addobject(item:Pbutton):Pbutton;virtual;
function checkpress(var p:pbutton):integer;virtual;
function retobject(hnd:integer):pbutton;virtual;
procedure showall;virtual;
destructor done;virtual;
private
rmop,
rmx,rmy,
romx,romy : integer;
end;
const
cl : vcolortypes = (0,23,31,8,15,8,9,28); { System colors }
defaultcolors : wcolortypes = { System want colors }
((red:00;green:00;blue:00), { background - black }
(red:35;green:35;blue:35), { object background }
(red:49;green:49;blue:48), { Medium Shade }
(red:21;green:21;blue:21), { Dark Shade }
(red:63;green:63;blue:63), { Text, Light Shade }
(red:21;green:21;blue:21), { Generic medium }
(red:21;green:21;blue:63), { Highlite 1 }
(red:53;green:14;blue:14)); { Highlite 2 }
burntsienna : wcolortypes =
((red:00;green:00;blue:00),
(red:48;green:28;blue:00),
(red:54;green:35;blue:00),
(red:35;green:15;blue:00),
(red:63;green:63;blue:63),
(red:35;green:15;blue:00),
(red:58;green:57;blue:18),
(red:00;green:63;blue:45));
var
drives : string[26] ;
driveset : set of 'A'..'Z';
gx,gy : integer;
menucolors : wcolortypes;
function strlen(s:string):word;
procedure textpos(title:string;tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
procedure pointpos(tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
procedure drawstring(x,y:integer;s:string;c1,c2:byte);
procedure vgaborder(x1,y1,x2,y2:integer;border:boolean);
procedure vgainvr(x1,y1,x2,y2:integer;border:boolean);
procedure vgarect(x1,y1,x2,y2:integer);
procedure vgabox(x1,y1,x2,y2:integer);
function onwin(x,y,w,h:integer;border:boolean):boolean;
procedure offwin;
procedure message(s:string;wait:boolean);
function yes(msg:string):boolean;
function diskdo(x,y:integer;fpath,mask,title:string;loading:boolean):string;
procedure finddrives;
function writeable(pth:string):boolean;
procedure adjustmenupalette; { changes menu index colors (CL) to match }
{ the (menucolor) colors }