home *** CD-ROM | disk | FTP | other *** search
- {-----------------------------------------------------------------------------}
- { TEGL Windows ToolKit II }
- { Copyright (C) 1990, 1991 TEGL Systems Corporation }
- { All Rights Reserved. }
- {-----------------------------------------------------------------------------}
- {$I Switches.inc }
-
- UNIT TwKernel;
-
- INTERFACE
-
- USES
-
- FastGrph,
- Virtmem,
- {$IFDEF NoGr}
- TGraph,
- {$ELSE}
- Graph,
- {$ENDIF}
-
- teglfont,
- teglintr,
- teglmain,
- teglunit,
- teglmenu,
- teglspec,
- twcommon;
-
-
- TYPE
-
- {-- TYPE definitions for DIALOGUES }
-
-
- twDialogPtr = ^twDialogItem;
-
- twDialogItem = RECORD
- x1, y1 : integer; {-- display relative on window }
- x2, y2 : integer;
- sx1, sy1 : integer; {-- xor box selection indicator locations }
- sx2, sy2 : integer;
- active : boolean; {-- set true if active, false if non-selectable }
- len : byte; {-- length of input string (max) }
- places : byte; {-- for floating point display }
- ms : msclickptr; {-- store the associate mouse click ptr }
- ms_edit: msclickptr; {-- associated editior mouse clikc ptr }
- tdtype : integer; {-- type of dialogue item, def in twcommon }
- message: ^string; {-- prompt or message }
- msnum : integer; {-- mouse click number association }
- number : integer; {-- simply the counter }
- clusNum: integer; {-- cluster number, for grouping items together }
- clusItem: integer; {-- cluster item, item of group }
- data : pointer; {-- points to data item, nil if not required }
- strdata: ^string; {-- store intermediate string }
- Prev : twdialogPtr; {-- point to previous dialog item }
- Next : twdialogPtr; {-- point to next dialog item }
- action : CallProc; {-- user event (attaches to button) }
- END;
-
-
- twMenuPtr = ^MenuItem;
-
- MenuItem = RECORD
- Next : Pointer; {-- points to next, NIL if last }
- Item : byte; {-- just a counter }
- prompt : String[20]; {-- the menu item name }
- om : OptionmPtr; {-- what pulls down from it }
- MouseNum : Integer; {-- store associated mouse num }
- Entries : byte; {-- }
- EntryActive : Boolean; {-- true if active }
- EntryCall : CallProc; {-- point to event if its not a pull down}
- END;
-
- {-- The WinFrame record is an 'object-like' data structure. It contains }
- {-- all the data items required to program and manipulate a complex window.}
- {-- All the procedure and functions which access this data record start with }
- {-- tw<name> and the parameter list is AT LEAST ONE but may be more, and the
- {-- first parameter is always a WinFramePtr. In this respect the WinFramePtr }
- {-- points to what would be called 'self' in an object-oriented version. }
- {-- Note that this only mimics an object version. It is done to make }
- {-- the switch to a true object oriented version easier. }
-
- winframe = RECORD
- ifs : ImageStkPtr; {-- pointer from image stack }
- iconifs : ImageStkPtr;
- firsttime : boolean; {-- flag for window drawing. DO NOT TOUCH!}
- redrawonmove : boolean; {-- force redraw after a window move }
- style : FrameDrawFunc; { -- window framestyle }
- thickness : integer; { -- window framethickness }
- x1,y1,x2,y2 : Word; { -- window coordinates }
- mx1,my1,mx2,my2 : word; {-- store window size before maximize }
- wx1,wy1,wx2,wy2 : Word; { -- window working coordinates }
- { -- these are the absolute coordinates inside }
- { -- the window allowing for header, border, }
- { -- menu and sliders. }
- wmaxx,wmaxy : Word; { -- the maximum working area }
- minx,miny,maxx,maxy : Word; { -- min max for resize }
- font : Pointer; { -- font to use for text output }
- displayfont : Pointer; { -- font for header, menus }
- theight : Byte; { -- text height in pixels }
- twidth : Byte; { -- text width in pixels }
- rows : Byte; { -- number of rows in the working window }
- cols : Byte; { -- number of cols in the working window }
- curx : Integer; { -- cursor location (col, row) }
- cury : Integer;
- textattr : byte; { -- traditional text char attribute }
- CharClear : Boolean; { -- clear character before drawing new one }
- bordercolor : Integer; { -- color scheme }
- headercolor : Integer;
- framecolor : Integer;
- framecolor2 : Integer;
- fillcolor : Integer;
- textcolor : Integer;
-
- {-- Header and buttons stuff }
-
- Header : boolean; { -- if header shown }
- HeaderStr : String[twMaxHeaderLen];
- Maximize : boolean; { -- true if minimize, maximize OK }
- Maximized : boolean; { -- true if we are maximized }
- ThickStore : integer; { -- remember thickness when maximized }
- Minimized : boolean; { -- true if we are now an icon }
- Icon : Pointer; { -- icon to display when window minimized }
-
- {-- SLIDERS - up down }
-
- UpDownslider : Boolean; { -- true if updown slider shown }
- UpDnSlidePer : Integer; { -- set to sliders relative position %}
- UpbuttonPress: Boolean; { -- set true if up button was pressed }
- DnButtonPress: Boolean; { -- set true if down button was pressed }
- UpDownEvent : CallProc; { -- user event to process up down slider action }
- UpDownSldPtr : SliderPtr; { -- store slider pointer }
- UpDownRange : Integer; { -- scale of the slider }
- UpDownStep : Integer; {-- button step value }
-
- {-- Left right }
-
- LeftRightSlider : Boolean; { -- true if leftright slider shown }
- LfRtSlidePer : Integer; { -- }
- LfButtonPress: Boolean; { -- true if left button was pressed }
- RtButtonPress: Boolean; { -- ture if right button was pressed }
- LeftRightEvent: CallProc; { -- user event to process left right slider action }
- LeftRightSldPtr: SliderPtr; { -- store slider pointer }
- LeftRightRange: Integer;
- LeftRightStep: Integer;
-
-
- Resize : Boolean; { -- true if resizeable }
- Moveable : Boolean; { -- true if window is moveable }
- Buffered : Boolean;
- Proportional: Boolean; { -- true if text is displayed proportionally }
- Wrap : Boolean; { -- true if text is to wrap at border }
-
- {-- framemenu }
- Om : OptionmPtr; { -- the alt-space bar menu }
- {-- twMenu }
-
- MenuEntries : Byte; { -- number of main menu bar selections }
- MenuThickness: Byte; { -- depends on number of lines }
- Menu : twMenuPtr; { -- points to first item, NIL if none }
- MenuLast : twMenuPtr; { -- last item added }
- {-- }
-
- {$IFDEF twWorld }
- {-- world coordinate data items follow, procedures in 'twWorld.pas' }
- wcx1,wcy1,wcx2,wcy2 : wcFloat; {-- coordinate system range to use }
- wcHeight,wcWidth, {-- width an hight in defined system }
- wcXoff,wcYoff, {-- offset to normalize }
- wcXfac,wcYfac : wcFloat; {-- factor to multiply by (transforms) }
- {$ENDIF }
-
-
- {-- for 'twGraph.pas' - standard graph calls, window relative }
- clipping : Boolean; {-- clipping for twgraph & twworld }
- gvars : GraphVars; {-- used to set the graph unit state }
-
- {-- for 'twdialog.pas' - anchor pointer for dialog list }
- twdanchor : twDialogPtr; {-- anchor, starting point for list }
- twdcurrent : twDialogPtr; {-- current is also the last item }
- twdcount : Word; {-- counts the number of dialog entries }
- twdfont : pointer;
-
- {-- procedural pointers follow }
- closeevent : Callproc; { -- userdefined Close from mouse click}
- menucloseevent : CallProc; { -- userdefined close from menu }
- redrawevent : Callproc; { -- redraw window event }
- aboutevent : CallProc { -- the about selection from space bar menu }
- end;
-
-
- WinFramePtr = ^WinFrame;
-
-
- Function FindWinFrame(ifs : ImageStkPtr) : WinFramePtr;
- Procedure twClear(wf : WinFramePtr);
- Procedure twClose(wf : WinFramePtr);
- function twcloseEvent(ifs : ImageStkPtr; ms : MsClickPtr) : Word;
- function twMenuCloseEvent(ifs : ImageStkPtr; ms : MsClickPtr) : Word;
- Procedure twSetCloseEvent(wf: WinFramePtr; event: CallProc);
- Procedure twSelect(wf : WinFramePtr);
- Procedure twWriteXY(wf : WinFramePtr; col,row :Integer; s : string);
- Procedure twFixUp(wf : WinFramePtr);
- Procedure twDefineMouseClickArea(wf : WinFramePtr;
- x1_, y1_, x2_, y2_ : Word;
- active : Boolean;
- action : CallProc);
-
- Procedure twPutPict(wf : WinFramePtr; x,y : Integer; Image:Pointer; Color :Integer);
- Procedure twMenuItem(wf : WinFramePtr; s : String; Active: Boolean);
- Procedure twSubMenuItem(wf : WinFramePtr; s : String; Active: Boolean; event : CallProc);
- Procedure twSetBorderColor(wf : WinFramePtr; Color : Byte);
- Procedure twSetFont(wf : WinFramePtr; font: pointer);
-
- Procedure twSetDisplayFont(wf : winFramePtr; Font: Pointer);
-
- Procedure twSetMaximize(wf : WinFramePtr; tf : Boolean);
- Procedure twSetMinimizeIcon(wf : WinFramePtr; Icon : Pointer);
- Procedure twSetRedraw(wf : WinFramePtr; Redraw_ : CallProc);
- Procedure twSetResize(wf : WinFramePtr; tf: Boolean);
-
- Procedure twSetUpDownSlider(wf : WinFramePtr; Active : Boolean);
- Procedure twSetLeftRightSlider(wf : WinFramePtr; Active : Boolean);
- Procedure twSetUpDownRange(wf: WinFramePtr; range,step : Integer);
- Procedure twSetLeftRightRange(wf: WinFramePtr; range,step: Integer);
-
- Procedure twSetUpDownEvent(wf: WinFramePtr; Event : CallProc);
- Procedure twSetLeftRightEvent(wf : WinFramePtr; Event : CallProc);
-
-
- Procedure twScrollDown(wf : winFramePtr; Num : Integer);
- Procedure twScrollUp(wf : WinFramePtr; Num : Integer);
- Procedure twSetFillColor(wf : WinFramePtr; Color: Byte); {-- background }
- Procedure twSetColor(wf : WinFramePtr; Color: Byte); {-- foreground }
- Procedure twSetThickness(wf : WinFramePtr; Thickness : Byte);
-
- Procedure twInit(VAR wf : WinFramePtr; x_,y_,x1_,y1_ : Word);
- Procedure twSetWinFrameColors(wf : WinFramePtr; Color1, Color2 : Byte);
- Procedure twSetWindowStyle(wf: WinFramePtr; Style : FrameDrawFunc);
- Procedure twSetHeader(wf : WinFramePtr; s : String);
- Procedure twUnSelect(wf : WinFramePtr);
- Procedure twDrawWindowFrame(wf : winframeptr);
-
- TYPE
-
- WinFrameStkPtr = ^WinFrameStk;
-
- WinFrameStk = Record {-- for maintaining linked list of windows }
- Next : WinFrameStkPtr; {-- points to next window frame, NIL if no more }
- Item : WinFramePtr; {-- points to actual window frame data }
- num : integer; {-- count it. }
- END;
-
- CONST
- WinFrameAnchor : WinFrameStkPtr = NIL; {-- anchor linked list in data seg}
- WinCount : Integer = 0; {-- increment as each window is opened }
-
- IMPLEMENTATION
-